cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
klishb
Regular Visitor

function 'int' error after months of working fine

I have a simple 2 step flow.  I'm sending an http request from a website to create a SharePoint list item.  It's been working great for several months, but it failed for the first time today with this error:

 

Unable to process template language expressions in action 'Create_item' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

The HTTP request outputs several strings and some null values to a SharePoint create item step.  Looking at the raw data everything looks okay to me.  Nothing unexpected.  My understanding is that error states there was a failure trying to convert a string to an INT.  There is only one Expression using that function in my Create Item step which is for the Donation amount. 

 

int(triggerBody()?['DonationAmount'])

 

In this case it's null though since it was not a donation.  On the SharePoint list these columns are all "Single line of text" aside from the Details which is "Multiple lines of text".  This is what my JSON body looks like with some minor changes to protect the innocent:

 

"body": {
"EntryID": "11539",
"DonationDate": "",
"Name": "Something's Here",
"Breed": "belgian",
"Discipline": "102 - Draft",
"Sex": "Male",
"Color": "Blonde",
"DonationAmount": "",
"DonatedByFirst": "",
"DonatedByLast": "",
"DonorPhone": "",
"DonorMailingAddressStreet": "",
"DonorMailingAddressLn2": "",
"DonorMailingAddressCity": "",
"DonorMailingAddressState": "",
"DonorMailingAddressZip": "",
"Details": "Purchased 6/17/22 at the a special place",
"Inv#": "2765",
"Reg#": "S74775"
}
}

1 ACCEPTED SOLUTION

Accepted Solutions
klishb
Regular Visitor

Added some logic to make sure it sends a null value to SharePoint when those values are empty.  That fixed it.

 

See https://powerusers.microsoft.com/t5/Building-Flows/Flow-Fails-to-Update-List-When-Form-Field-is-Blan...

View solution in original post

2 REPLIES 2
klishb
Regular Visitor

Interestingly I just found that if I remove that INT expression for DonationDate I get this error for the same data above where DonationDate is null.  It is not a required field on the SharePoint list.

 

The 'inputs.parameters' of workflow operation 'Create_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/DonationDate' is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'.

klishb
Regular Visitor

Added some logic to make sure it sends a null value to SharePoint when those values are empty.  That fixed it.

 

See https://powerusers.microsoft.com/t5/Building-Flows/Flow-Fails-to-Update-List-When-Form-Field-is-Blan...

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,094)