Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Flow fails sometimes | The template language function 'int' was invoked with a parameter that is not valid.

(0) ShareShare
ReportReport
Posted on by 8

I have a flow that registers leave days.

* one sharepoint list keeps the leave days on the employee record

* one sharepoint list I create a transaction record

-> the flow takes the transaction record and updates the leave column on the employee record.

 

That mostly works. But then for some reason, every now and again it doesn't.

Whilst everything is exactly the same! (at least as far as I can see).

Mysterious.

 

here is a screenshot

 

Martinus_0-1664358875549.png

 

The Compose action calculates the new leave.

the condition Sick Leave checks if leave does not go under zero

 

The return from the compose is always in the same format.

And sometimes the Condition Sick leave gives this error:

"Unable to process template language expressions for action 'Condition_Sick_Leave' 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.'."

 

below a screenshot

Martinus_1-1664359055398.png

 

As you can see the compose action returns a number. Which is correct.

Then the condition decides it cannot work with this number.

 

this is the condition code:    int(outputs('Compose_SickLeave'))

and again: normally it works with the result from the Compose action.

 

hope someone knows that this might be. 

power automate can be complex, but it should not be mysterious.

 

thanks in advance

 

Martijn

 

  • Martinus Profile Picture
    8 on at
    Re: Flow fails sometimes | The template language function 'int' was invoked with a parameter that is not valid.

    thanks Kaif,

     

    this does make things clear. And I also understand how deconstructing it and then putting it together again makes a bullet proof integer.

     

    What remains is that the flow did not accept the original 29.5 for this run, but other runs that included decimal integers were successful. So at that level, the mystery is not solved.. 

  • Kaif_Siddique Profile Picture
    2,104 Super User 2024 Season 1 on at
    Re: Flow fails sometimes | The template language function 'int' was invoked with a parameter that is not valid.

    Hi @Martinus ,

     

    Lets break the expression into sub expressions:

    int(first(split(string(outputs('Compose_SickLeave')),'.')))

     

    • Convert the outputs to string:
      • string(outputs('Compose_SickLeave'))  --> "29.5"
    • Split strings into multiple substrings based on a delimiter provided(i.e. decimal - '.').  
      • split(string(outputs('Compose_SickLeave')),'.') --> "29" and ".5"
    • first function will return the first character of the array
      • first(split(string(outputs('Compose_SickLeave')),'.')) --> "29"
    • int will convert value to integer
      • int(first(split(string(outputs('Compose_SickLeave')),'.'))) --> 29 (integer value)

     

    Hope this will help you.

     

    Regards

    Kaif

  • Martinus Profile Picture
    8 on at
    Re: Flow fails sometimes | The template language function 'int' was invoked with a parameter that is not valid.

    Dear Kaif,

     

    Thanks a lot for this very speedy reply

     

    I entered your suggested expression and it worked!

    It is still a mystery to me though. 🙂

    Can you perhaps explain what this expression does? and why it is required to make my flow work?

     

    I'll wait for your reply on this before I post it as solved, because I don't know whether that would auto close this topic.

     

    best,

    Martijn

  • Verified answer
    Kaif_Siddique Profile Picture
    2,104 Super User 2024 Season 1 on at
    Re: Flow fails sometimes | The template language function 'int' was invoked with a parameter that is not valid.

    Hi @Martinus ,

     

    Use this expression to convert Float to Integer:

    int(first(split(string(outputs('Compose_SickLeave')),'.')))

    Update the output as per Compose name

     

    Let me know if any queries.

     

    If you like my response, please give it a Thumbs Up.
    If this helps, please Accept as solution.


    Regards
    Kaif

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow