Datatype conversion in logic app for validation

Vijay 101 Reputation points
2022-06-15T12:54:19.76+00:00

Hi,

I have created a logic app flow I need to validate for fields.

211660-image.png

Here all the inputs it is taking as string

I want to validate these field values

Invoice No must be of type integer
Sender must be of type string
Receiver must be of type string
Date must be of type date

like these I want to validate for each fields and must add it to SharePoint columns using update field properties

Can anyone help with this

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,322 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,796 Reputation points
    2022-06-16T13:02:05.58+00:00

    @Vijay Thanks for reaching out. You can refer to this document for different type specific keywords that are supported. For build in format please refer to this document.
    As per your requirement you can leverage the schema below to validate your JSON input.

    {  
      "type": "object",  
      "properties": {  
        "Date": {  
          "type": "string",  
          "format": "date"  
        },  
        "Filename": {  
          "type": "string"  
        },  
        "Invoice NO": {  
          "type": "integer"  
        },  
        "Receiver": {  
          "type": "string"  
        },  
        "Sender": {  
          "type": "string"  
        }  
      }  
    }  
    

    Valid Input:

    {  
      "Date": "2018-11-13",  
      "Filename": "UE11.019",  
      "Invoice NO": 90020809,  
      "Receiver": "test",  
      "Sender": "41430 Albon"  
    }  
    

    Date | type: string | format: date
    Filename | type : string
    Invoice NO | type : integer
    Receiver | type : string
    Sender | type : string

    **Note: ** Regular expressions are not supported with Parse JSON action. Thea above is only for reference and please modify it as per your business needs.

    In case inbuild type and format doesn't help then you need to write custom logic (leveraging inbuild actions/conditions) or inline line (write custom code in JavaScript to do regular expression validation) as per your need.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.