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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (4,680)