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

Concat() and trim() within variable error: Unable to process template language expressions

I’m trying to create a Power Flow which creates two strings [Opportunity Name] and [Opportunity ID] for a sales pipeline list on SharePoint. The flow also sends the item creator an email with the Opportunity Name & ID for reference. My Flow fails and I’m unable to determine why.

 

Basic Flow Logic
1) When a new list item is created trigger flow
2) Initialize variable (varTEXT_OpyID): Concataion of string "OPY_" and Curremt Item [ID]
3) Initialize variable (varTXT_OppName): Concataion of Item fields i.e. [CountryorRegion] & '_' & ['Location'] & '_' & ['DealSize'] & ['CapacityUnits'] & '_' & ['CodeName']

4) Update current item with "varTXT_OppName", "varTEXT_OpyID" .... other fields.
5) Get [Created By] profile, name, email etc.
6) Send email to [Created By] which include reference to item fields and flow variables

 

Issue:

  • My Flow is failing at Step 3 "Initialize var - Create Op Name String"

     

    Error message:
    Unable to process template language expressions in action 'Initialize_var_-Create_Op_Name_String' inputs at line '1' and column '3011': 'The provided parameters for template language function 'trim' are not valid.'.

    The failed variable expression is as follows:

     

     

 

 

concat
(
trim(triggerBody()?['CountryorRegion']?['Value'])
,'_'
,trim(triggerBody()?['Location'])
,'_'
,trim(triggerBody()?['DealSize'])
,trim(triggerBody()?['CapacityUnits']?['Value'])
,'_'
,trim(triggerBody()?['CodeName'])
)
)

 

 

 

 

Grateful for your help in resolving the issue.

 

 

Flow StepsFlow Steps

 

Error StepError Step

1 ACCEPTED SOLUTION

Accepted Solutions
JoshPayneSays
Helper I
Helper I

@Mira_Ghaly 

Thank you for the hint. The issue was one of my concatenated fields was an integer. Which made the trim() function throw an error.

 

I used formatNumber(<number>, <format>, <locale>) function to handle the integer and then wrapped it in a trim(). As Follows: trim(formatNumber(triggerBody()?['DealSize'],'F','en-gb'))

 

Function Reference:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

e.g.

 

concat
(
trim(triggerBody()?['CountryorRegion']?['Value'])
,'_'
,trim(triggerBody()?['Location'])
,'_'
,trim(formatNumber(triggerBody()?['DealSize'],'F','en-gb'))
,trim(triggerBody()?['CapacityUnits']?['Value'])
,'_'
,trim(triggerBody()?['CodeName'])
)
)

 

View solution in original post

2 REPLIES 2
Mira_Ghaly
Dual Super User
Dual Super User

@JoshPayneSays 

can you try adding a compose data operation on the below expression only for troubleshooting

trim(triggerBody()?['CountryorRegion']?['Value'])

Just guess that the input to the trim function here is an integer rather than a string

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here
JoshPayneSays
Helper I
Helper I

@Mira_Ghaly 

Thank you for the hint. The issue was one of my concatenated fields was an integer. Which made the trim() function throw an error.

 

I used formatNumber(<number>, <format>, <locale>) function to handle the integer and then wrapped it in a trim(). As Follows: trim(formatNumber(triggerBody()?['DealSize'],'F','en-gb'))

 

Function Reference:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

e.g.

 

concat
(
trim(triggerBody()?['CountryorRegion']?['Value'])
,'_'
,trim(triggerBody()?['Location'])
,'_'
,trim(formatNumber(triggerBody()?['DealSize'],'F','en-gb'))
,trim(triggerBody()?['CapacityUnits']?['Value'])
,'_'
,trim(triggerBody()?['CodeName'])
)
)

 

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,182)