Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Suggested answer

The template language function 'int' was invoked

(2) ShareShare
ReportReport
Posted on by 40

Hello,

 

I have an excel sheet with multiple columns that is connected to my power automate flow to automatically enter entries into sharepoint list. I get the data by email and I manually copy and paste it into the Excel sheet afterwards I run the flow. In many cases the flow runs smoothly and it add everything into the sharepoint list which is great. In some instances it runs but only adds some of the entries into the sharepoint list and gives me the following error:

 

 

 

InvalidTemplate. 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.

 

 

 

I think the problem is coming from my currency fields. I have 7 currency fields (Total Requested, Funding Amount, Planning, Organization, Equipment, Training, Exercise And Cost Share) sometimes the field in empty in the excel sheet and sometimes is not. Please see below the function template I used for each currency field:

 

 

 

if(empty(item()?[‘Organization’], null, int(item()?[‘field name’]))

 

 

 

What I need: How I should update the functions so this error doesn’t keep happening?

 

 

 

 

  • Suggested answer
    Michael E. Gernaey Profile Picture
    44,770 Super User 2025 Season 1 on at
    The template language function 'int' was invoked
     
    First issue, which you should fix
    if(empty(item()?[‘Organization’], null, int(item()?[‘field name’]))
    should be
    if(empty(item()?[‘Organization’]), null, int(item()?[‘field name’]))
    In your flow maybe its correct, but what you typed in or shared is not.
     
    Next.
    1. you either have a bad field listed, as in its NOT even there or its not an int compatible value, such as null or blank or its just a string 'Michael' and that cannot be converted to a string
     
    is field name in that instance actually a string, or is it null? if its a string string, you won't fix it as its not compatible to convert, if its just null (empty), then you can just
     
    I wrote this one for you, its long on purpose. Here it is and what it does
    You woudl replace my variables('Test') with your fields
     
    1) it checks your Org value is empty and returns null
    2) It check if your Field is null (put your item()?['field name'] is null and it returns null if so
    3) if your field is NOT null it then checks if it is an int cause otherwise it cannot convert it, if it IT an int, it does the conversion
    if its not an int it returns null
    if(empty(variables('Test')), null, 
       if(not(empty(variables('Test2'))), 
         if(isInt(variables('Test2')), 
            int(variables('Test')), 
         null), 
        null)
    )
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
    Thank you!
    Sincerely, Michael Gernaey
  • Suggested answer
    Srinivas Kadamati Profile Picture
    3,150 Super User 2025 Season 1 on at
    The template language function 'int' was invoked
     
    I see an issue in the expression, try as below
     
    if(empty(item()?['Organization']), null, int(item()?['field name']))
     
    Hope this helps you
     

    (If this answers your question you can mark as Answered and give it a Like)

    Regards,
    Srini

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1