improveit 360 has created an invokable Apex method to allow Admins to create a Project and assign the Project Template using a Flow and have all the applicable Project Template Activities be generated for the Project. You may want to use a Decision node to Assign the Template based on Product Category.
An invocable method has been created for Project Templates that will allow the Project Templates to be added to a Project via Flow and have all related Project Template Activities subsequently added to the Project. Previously, stamping the Project Template ID on the Project using a Flow would not create the related and desired Project Activities on the Project. Release v1.25 and the Apex method solves for this.
Required inputs:
- Project ID
- Project Template ID
Example Use Case: When a Sale record is updated to a status of “Approved”, a Flow is triggered to create a Project and assign a Project Template based on the Product Category, resulting in the Project Activities being created on the Project.
The Start Node condition of the Flow will be when the Sale Approved on Date is no longer Null, and only when the recorded is subsequently edited to meet the Condition Requirements.
Next use a Create Records element to Create the Project record. Set the values Manually. You will need to pass the Contact, Account, and Sale IDs from the Sale record which triggered the Flow.
Next, you'll use a Decision node to determine which Project Template should be applied based on Product Category
Be sure to set a unique Outcome path for every Product Category that would have a different Template used. In this example we have an Outcome path for Baths, Roofing and Windows.
Next, you will use the Toolbox to create Constant Text Resources to store the different Project Template IDs you need to reference in the Flow. This ID will be used to Assign the Project Template to the Project.
Repeat this step and create a Constant for every Project Template ID.
Next, on each Outcome path for each Product Category you will create an Apex element and select the "Add Project Template" Apex method.
Project ID and Project Template ID are required.
- Use the Project ID from the Create Records element
- Use the Project Template ID stored in the Constant you created
If there are more than one Product Category, create another Apex Action on the next Outcome path and choose the appropriate Constant for the next Project Template ID. Continue until you have assigned a Project Template ID on ALL Outcomes paths (including the Default path). There should be a Default Template ID stored for any Projects where the Product Category is not one of the specific outcome paths.
When finished your Flow will look something like this:
Save and Activate.
Be sure to test by Approving Sales which have each of the Product Categories defined within the Flow.
Comments
0 comments
Article is closed for comments.