cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoshPayneSays
Frequent Visitor

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
Frequent Visitor

@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 II
Dual Super User II

@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
Frequent Visitor

@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

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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,089)