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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (6,091)