Some companies would like the option to select multiple Projects to Cancel on one Screen. Initiating the Flow from the Project page will query all Projects related to the same Sale and allow the User to cancel multiple Projects at one time.
The completed Screen Flow will look something like this:
The Screen Flow will begin with a Get Records element to locate all the Projects with the same Sale ID as the Project which the Screen Flow is being initiated from. Be sure to Store All Records.
Next add a Decision node to determine if any Projects were found.
Choose the Collection from the Get action 'Is Empty' and a global constant of False.
On the Default (Negative) Outcome path you will create a Screen element to display text that no Projects were found in the query:
Format the Text as you would like it to appear on the screen:
Next, create a second Screen Element on the Positive outcome path:
Use a Data Table within the Screen to display the Collection of Projects from the Get records element.
Be sure to Configure the Columns to display Fields the User would want to see from the Project records.
Next we will add another Decision node to identify if the User has selected any Projects which should be Canceled.
Set the Condition Requirements to
Screen element's Selected Rows 'Is Empty' and select a global constant of False.
On the Default (negative) Outcome path, create another Screen element to display that No Projects were selected.
Format the Text component as you'd like it to appear to the User.
On the Positive Outcome path of the Decision, create a Loop element to Loop through the User selected records.
Next, add another Decision node to identify Projects which already have a Status of Canceled (or may have other Statuses you want to update to a different Value)
In this example, we're identifying Projects which were in a Status of Pending and updating them with the Status of 'Cancel Pending' (this may not be necessary for your business requirements).
In the first outcome path our Filter looks for Projects that already have a Status of Canceled.
This path has no action or assignment to update the Status Value.
The next outcome path identifies Projects in a Pending Status and the Assignment element is used to update their Status to Canceled. The Assignment also stores those records in a collection.
After Last, create another Decision element to check if the Collect of records is empty. If it is not, we will update the records in the Collection.
The final element in the Flow is a Screen you will use to display a Text component and enter in the text to display:
All Selected Projects Have Been Canceled
Next you'll need to add this Flow to the Sale Record Page.
Go to the Sale, click the gear icon and click Edit Page
In the Standard components menu, find Flow and drag and drop it onto the record page.
Select the Flow we just created.
Comments
0 comments
Article is closed for comments.