cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielRK
Super User
Super User

Having trouble referencing data cross cases in switch control- state machine workflow

Hi,

 

I'm building a state machine workflow using a switch control inside a do until loop and using variable to switch between the cases.

 

There are four cases representing 4 approvers and another 4 cases where any of these approvers can ask for revisions and the document can be resubmitted within the same workflow.

 

Case 1 is where the first approver approves. There is some document automation in this case and I want to reference this in the next case but when I try I get this error:

 

Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Get_GM_approved_document' at line '1 and column '32330' cannot reference action 'Update_document-_GM_approved'. Action 'Update_document-_GM_approved' must either be in 'runAfter' path or within a scope action on the 'runAfter' path of action 'Get_GM_approved_document', or be a Trigger.'.'.

 

I tried to put the do until loop into a scope but I still can't reference data points between cases.

 

Do you have any advice on how to handle this as I need to be able to reference data points cross cases as I'm generating new versions of the document with the prior approvers approval and need to pass this along as an attachment to the next approval?

DanielRK_1-1619441475260.png

 

Thanks a lot!

 

Regards,

 

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions
PrasadAthalye
Community Champion
Community Champion

Since it is outside the local scope, it wont find reference from another scope.  There are 2 possibilities...

 

  1. Are you trying to pass anything specific like text OR numbers OR dates? May be you can initialize variable all the way up somewhere and SET the variable with output from action. Then you can use that variable anywhere. If its a JSON output you can parse it back again and use it.
  2. If its a SharePoint Update call, you can use Get Item again under each scope to query it back. I am sorry but I can not read picture that you uploaded as it is extremely tiny.
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

2 REPLIES 2
PrasadAthalye
Community Champion
Community Champion

Since it is outside the local scope, it wont find reference from another scope.  There are 2 possibilities...

 

  1. Are you trying to pass anything specific like text OR numbers OR dates? May be you can initialize variable all the way up somewhere and SET the variable with output from action. Then you can use that variable anywhere. If its a JSON output you can parse it back again and use it.
  2. If its a SharePoint Update call, you can use Get Item again under each scope to query it back. I am sorry but I can not read picture that you uploaded as it is extremely tiny.
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi @PrasadAthalye ,

 

Magic! The variables seem to have done the trick!

 

The data I need to pass is based around my approvers like:

 

DisplayName

Approved- YES/NO

Approval date

 

Which come from the approval actions in one case but I need to reference in another.

 

I also used the 'office365 get user profile action' in the respective case and plugged the approver variable (which contains the approver's email address) into it, so that also helped to get the approvers' information.

 

I also need to have multiple 'Sharepoint update item' actions so the 'get item' is a great suggestion for retrieving the latest version of that item.

 

Thank you again for your wisdom and help on this!

 

Regards,

 

Daniel

 

PS: I'm keen to try the Parse JSON when I get there as well.

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

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.

Users online (1,462)