cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shagoul
Helper I
Helper I

Invalid type. Expected String but got Null

Hi All,

 

Am very new to MS flow please help me one this.

 

Here I am triggered bot from MS flow when a new message enters on teams.

 

After that, I am running the bot with the UiPath orchestrator which working fine.

 

After sucessfull run the bot I want to reply to that message the task is done or NOT. So I’ve used parse JSON and below is my schema.

 

Sometimes it’s working fine some time I am getting errors inflow  "message": "Invalid type. Expected String but got Null.",

 

Can someone help me why sometimes it’s working fine and sometimes it’s not working fine, please advise how to resolve it.

 

Note: I’ve manually edit the JSON Parser allowing null type still this is not working some time.

 

"type": [

              "string",

              "null"

            ]

 

schema:

{

  "type": "object",

  "properties": {

    "value": {

      "type": "array",

      "items": {

        "type": "object",

        "properties": {

          "Key": {

            "type": "string"

          },

          "StartTime": {

            "type": "string"

          },

          "EndTime": {

            "type": "string"

          },

          "State": {

            "type": "string"

          },

          "JobPriority": {

            "type": "string"

          },

          "Source": {

            "type": "string"

          },

          "SourceType": {

            "type": "string"

          },

          "BatchExecutionKey": {

            "type": "string"

          },

          "Info": {

            "type": "string"

          },

          "CreationTime": {

            "type": "string"

          },

          "StartingScheduleId": {},

          "ReleaseName": {

            "type": "string"

          },

          "Type": {

            "type": "string"

          },

          "InputArguments": {

            "type": "string"

          },

          "OutputArguments": {

            "type": "string"

          },

          "HostMachineName": {

            "type": "string"

          },

          "HasMediaRecorded": {

            "type": "boolean"

          },

          "PersistenceId": {},

          "ResumeVersion": {},

          "StopStrategy": {},

          "RuntimeType": {

            "type": "string"

          },

          "RequiresUserInteraction": {

            "type": "boolean"

          },

          "ReleaseVersionId": {

            "type": "integer"

          },

          "EntryPointPath": {

            "type": "string"

          },

          "OrganizationUnitId": {

            "type": "integer"

          },

          "OrganizationUnitFullyQualifiedName": {

            "type": "string"

          },

          "Reference": {

            "type": "string"

          },

          "ProcessType": {

            "type": "string"

          },

          "ProfilingOptions": {},

          "Id": {

            "type": "integer"

          }

        },

        "required": [

          "Key",

          "StartTime",

          "EndTime",

          "State",

          "JobPriority",

          "Source",

          "SourceType",

          "BatchExecutionKey",

          "Info",

          "CreationTime",

          "StartingScheduleId",

          "ReleaseName",

          "Type",

          "InputArguments",

          "OutputArguments",

          "HostMachineName",

          "HasMediaRecorded",

          "PersistenceId",

          "ResumeVersion",

          "StopStrategy",

          "RuntimeType",

          "RequiresUserInteraction",

          "ReleaseVersionId",

          "EntryPointPath",

          "OrganizationUnitId",

          "OrganizationUnitFullyQualifiedName",

          "Reference",

          "ProcessType",

          "ProfilingOptions",

          "Id"

        ]

      }

    },

    "@odata.context": {

      "type": "string"

    },

    "@odata.count": {

      "type": "integer"

    }

  }

}

 

 

Thanks & Regards,

shagoul 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Modify schema about "EndTime" and "OutputArguments" properties.

-----------

"type": "string" ->  "type": [ "string",  "null"    ]

-----------

 

And delete them from "requiered" section.

 

The auto-generated schema is not perfect.

View solution in original post

Thank you, however, I find a solution by default I assigned some value in my argument now working fine. 

 

Every time when new value comes it will overwitire. 

View solution in original post

23 REPLIES 23
MiyukiAmino
Microsoft
Microsoft

Which property is causing the error?

 

I’ve manually edit the JSON Parser allowing null type still this is not working some time.

 

This is the solution in many case.

If "required" section has an error property, try to delete.

 

 

 

 

Shagoul
Helper I
Helper I

 

This is flow I've edit the Schema in the JSON Parser

 

Shagoul_1-1625752022974.png

 

 

Can you check "Show raw outputs"?

It shoud say the name of the property that caused the error.

 

here it's 

Shagoul_0-1625752392836.png

 

Modify schema about "EndTime" and "OutputArguments" properties.

-----------

"type": "string" ->  "type": [ "string",  "null"    ]

-----------

 

And delete them from "requiered" section.

 

The auto-generated schema is not perfect.

View solution in original post

You’re great 🙂 Thank you so much it’s working fine. however, will test again and let you know.

MiyukiAmino
Microsoft
Microsoft

No problem! Waiting for your reply.

If my answer helps you, please click thumbs-up button.

 

Thanks.

Yes, it really helps, and any suggestion on how to format my output argument.

 

Now am getting out as curly brace like below.

 

The result" is the variable name I don’t want show “result” variable name and curly brackets { } .

 

How do I format my output with the right structure please advise.

Shagoul_0-1625753689831.png

 

 

 

MiyukiAmino
Microsoft
Microsoft

Which action are you using? Share a screenshot with me.

Am just replying to the output via teams for that user.

 

Shagoul_0-1625755442027.png

 

MiyukiAmino
Microsoft
Microsoft

Thanks.

There are many ways to do this, how about cutting the text you don't want to show?

 

replace('<text>', '<oldText>', '<newText>')

Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

 

You can replace unwanted text with ''(nothing).

ex. replace ('{result: xxx}', '{result:', '')  -> 'xxx}'

 

You want to remove last bracket '}', so like this.

replace(replace('{result:xxx}', '{result:', ''), '}', '')

 

If you try, using 'Expression' tab.

MiyukiAmino_0-1625756618144.png

 

Shagoul
Helper I
Helper I

Thanks a ton 😊

MiyukiAmino
Microsoft
Microsoft

You're welcome. Enjoy Power Automate!

Shagoul
Helper I
Helper I

Hi Again,

 

When I try to update the expression I am getting the expression is invalid. how can I format my output without curly brackets.

 

Example:  replace(replace('{result:xxx}', '{result:', ''), '}', '')

 

I’ve update my flow replace(replace('@{items('Apply_to_each_4')?['OutputArguments']}', '{result:', ''), '}', '')

 

 

Shagoul_0-1625817023331.png

 

MiyukiAmino
Microsoft
Microsoft

Hi, thank you for reaching out.
 
You have to remove red charactor.
 
before:
replace(replace('@{items('Apply_to_each_4')?['OutputArguments']}', '{result:', ''), '}', '')
 
after:
replace(replace(items('Apply_to_each_4')['OutputArguments'], '{result:', ''), '}', '')
 
Try it.
Shagoul
Helper I
Helper I

Hi @MiyukiAmino ,

 

Shagoul_0-1627211169874.png

 

Still am facing the same issue any issue 

 

{
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Key": {
"type": "string"
},
"StartTime": {},
"EndTime": {
"type": [
"string",
"null"
]
},
"State": {
"type": "string"
},
"JobPriority": {
"type": "string"
},
"Source": {
"type": "string"
},
"SourceType": {
"type": "string"
},
"BatchExecutionKey": {
"type": "string"
},
"Info": {},
"CreationTime": {
"type": "string"
},
"StartingScheduleId": {},
"ReleaseName": {
"type": "string"
},
"Type": {
"type": "string"
},
"InputArguments": {
"type": "string"
},
"OutputArguments": {
"type": [
"string",
"null"
]
},
"HostMachineName": {
"type": "string"
},
"HasMediaRecorded": {
"type": "boolean"
},
"PersistenceId": {},
"ResumeVersion": {},
"StopStrategy": {},
"RuntimeType": {},
"RequiresUserInteraction": {
"type": "boolean"
},
"ReleaseVersionId": {
"type": "integer"
},
"EntryPointPath": {
"type": "string"
},
"OrganizationUnitId": {
"type": "integer"
},
"OrganizationUnitFullyQualifiedName": {
"type": "string"
},
"Reference": {
"type": "string"
},
"ProcessType": {
"type": "string"
},
"ProfilingOptions": {},
"Id": {
"type": "integer"
}
},
"required": [
"Key",
"StartTime",
"State",
"JobPriority",
"Source",
"SourceType",
"BatchExecutionKey",
"Info",
"CreationTime",
"StartingScheduleId",
"ReleaseName",
"Type",
"InputArguments",
"HostMachineName",
"HasMediaRecorded",
"PersistenceId",
"ResumeVersion",
"StopStrategy",
"RuntimeType",
"RequiresUserInteraction",
"ReleaseVersionId",
"EntryPointPath",
"OrganizationUnitId",
"OrganizationUnitFullyQualifiedName",
"Reference",
"ProcessType",
"ProfilingOptions",
"Id"
]
}
},
"@odata.context": {
"type": "string"
},
"@odata.count": {
"type": "integer"
}
}
}

Yeah, "ReleaseVersionId" is still declared as "integer" only.

Rewrite schema like below and remove from "required section".

------------------

"ReleaseVersionId": {
"type":  [
"integer",
"null"
]
},

------------------

 

Hi Miyuki,

 

after replacing the above solution I got the below error message. 

 

Please advise what went wrong 

 

Shagoul_0-1627451333687.png

 

Hi, @Shagoul ! Thanks for reaching out!

 

Error message says 1st parameter ( '<text>' ) is null in "replace" function.

  replace('<text>', '<oldText>', '<newText>')

 

Please make sure that the parameters are set correctly in the function. Is there a case where it will be NULL?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,362)