cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielRK
Continued Contributor
Continued Contributor

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
Super User
Super User

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
Super User
Super User

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

DanielRK
Continued Contributor
Continued Contributor

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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,111)