Before you begin
Plans: Enterprise only
Audience: Administrators
This workflow increases visibility for purchase requests by sending a notification whenever a new one is submitted.
Configuration overview
Goal
Notify users when a new purchase request has been submitted.
Trigger
Type | What it does |
---|---|
Record was changed |
Fires whenever a purchase request was changed. This trigger is used instead of "Record was added" because of the way purchase requests are created in the CMMS. The new record gets added to the table even before the user saves it, which means that the notification wouldn't include all of the necessary information. Using the Record was changed trigger allows us to include additional information such as the item, quantity, and price. |
Activity
Type | What it does |
---|---|
Run separate activities based on an if/else condition |
This condition checks whether the purchase order line item is a purchase request. It does this by ensuring that the line item doesn't have an associated PO. This is because of how the CMMS identifies purchase requests: any line item without an associated PO is treated as a purchase request. If this condition is met (i.e. if the line item isn't associated with a PO), the workflow runs the sub-activity below. |
Send a notification to a user(s) or group(s) | This sub-activity sends a notification to the users you specify. |
Steps
- Go to Settings > Workflows.
- Click New:
- Enter a name for your workflow.
- In the I would like to section, select Run separate activities based on an if/else condition:
- In the Every time that a section, select Record was changed:
- Click OK.
- To configure the trigger:
- Click the Trigger tab:
- In the Table drop-down list, select Purchase Order Line Item:
- Click OK.
This closes the workflow, which is necessary to apply your trigger settings before moving on to the next step.
- Click the Trigger tab:
- To configure the activity:
- Click the workflow to open it again.
- In the Activities tab, click the activity that was created automatically based on the option you selected in step 4:
- In the Condition field, enter the following code:
rec.getColumnValue('intPurchaseOrderID') is null
- To configure the notification sub-activity:
- In the Execute these activities when the condition is true section, click the + button:
- Enter a name for the activity.
- Select the Send a notification to a user(s) or group(s) option:
- Click OK.
- In the Recipients field, select the users you want to send the notification to.
- In the Subject field, enter the subject line you want to use for the notifications (e.g. "New purchase request")
- In the Body field, enter the following HTML:
<p> A purchase request has been submitted for the following item:</p>
<ul>
<li><b>Item</b>: <ma:expr expr="rec.intAssetID"/> - <ma:expr expr="rec.findRelatedRecord('intAssetID').strName"/></li>
<li><b>Quantity</b>: <ma:expr expr="rec.qtyOnOrder"/></li>
<li><b>Price</b>: <ma:expr expr="rec.dblUnitPrice"/></li>
</ul>
- In the Execute these activities when the condition is true section, click the + button:
- If you want to see what the message will look like, click Preview. There may be some slight formatting differences between the preview and the actual notification email.
- Click OK:
- Click OK:
- To activate the workflow, switch the status toggle to Active:
- Click OK.
Once your workflow is activated, you may want to test it by creating a new purchase request and validating that the workflow ran successfully. To learn more, see Monitor workflow activity.