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

Invalid Template. Unable to process

In a Condition I reference a manual trigger field (subject/body) using this expression:  

lastIndexOf(triggerOutputs()?['bodysubject'],'-') IS EQUAL TO IndexOf(triggerOutputs()?['bodysubject'],'-')

 

I get this error:

Unable to process template language expressions for action 'Check_If_Old_Subject_Format' at line '1' and column '25728': 'The template language function 'lastIndexOf' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#lastindexof for usage details.'.

 

Why?  The trigger 'bodysubject' is a text.  Is that different a 'string"?  'String' isn't an option in the manual trigger step.

Thanks very much.

 

Paul_Iowa_0-1605136290544.png

Paul_Iowa_1-1605136498448.png

 

Details in trigger:

{
  "type""object",
  "properties": {
    "text": {
      "title""bodysubject",
      "type""array",
      "x-ms-dynamically-added"true,
      "description""Subject line from \"Zoom Joined\" email",
      "items": {
        "enum": [
          "Susie has joined your meeting - XXXXXXX Britt/Kellie 60 minute XXXXXX Session (277-48-18-Z1)",
          "John Doe has joined your meeting - XXXX 18's Zoom Meeting"
        ],
        "type""string"
      },
      "x-ms-content-hint""TEXT"
    }
  },
  "required": [
    "text"
  ]
}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Wonderful! Solved!

And your help @v-bofeng-msft has gotten me past something else as well. 

My main issue was that I should have selected "Drop-down list of options" in the manual trigger.  I only needed one result. 

With only one result my original expressions work!

IndexOf(triggerOutputs()?['bodysubject'],'-')

IndexOf(triggerOutputs()?['bodysubject'],'-')

 

If I remove the [0] from your expressions (because it's no longer a set) it also works!

lastIndexOf(triggerBody()['text'],'-')
IndexOf(triggerBody()['text'],'-')

 

PS - 

The answer to your question: I was temporarily using the "Manual Trigger" because the Outlook "Get an email" trigger was not working and I needed to move on and test other parts of my flow.  Now that you've helped me I can go back and tackle that issue. 

 

Thanks very much!

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi @Paul_Iowa :

Could you tell me:

  • When the user triggers the flow, will multiple values be selected for bodysubject?

I assume the user selects only one value.

Firstly,let me explain why you encountered this problem.

The point is the value of triggerOutputs()?['bodysubject'] is an array.Because you set multiple selections in the trigger, its return value is an array.The first parameter of the lastIndexOf and IndexOf functions must be a string, so your flow will report an error.

Secondly,I suggest you use [0] to extract the value of the first item in the array to solve this problem.For example

lastIndexOf(triggerBody()['text'][0],'-')
IS EQUAL TO
IndexOf(triggerBody()['text'][0],'-')

Best Regards,

Bof

Wonderful! Solved!

And your help @v-bofeng-msft has gotten me past something else as well. 

My main issue was that I should have selected "Drop-down list of options" in the manual trigger.  I only needed one result. 

With only one result my original expressions work!

IndexOf(triggerOutputs()?['bodysubject'],'-')

IndexOf(triggerOutputs()?['bodysubject'],'-')

 

If I remove the [0] from your expressions (because it's no longer a set) it also works!

lastIndexOf(triggerBody()['text'],'-')
IndexOf(triggerBody()['text'],'-')

 

PS - 

The answer to your question: I was temporarily using the "Manual Trigger" because the Outlook "Get an email" trigger was not working and I needed to move on and test other parts of my flow.  Now that you've helped me I can go back and tackle that issue. 

 

Thanks very much!

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (68,204)