Develop: Data-Driven Notices
This page describes how an Apex developer can configure data-driven Notices with Improved NoticeBoard.
We will use a simple, large Opportunity Bid Review use case to illustrate how to trigger automated, data-driven Notices to Opportunity stake-holders – complete with dynamic content!
Our example Bid Review process is a ‘set-piece’ activity affecting all Opportunities that reach a specific Opportunity Stage / Probability:
- Trigger Criteria: Fires when Opportunity Stage equals Value Proposition (with Probability = 50%). (Our simple example could be extended to deal with multiple criteria – such as different Opportunity types or record types – to support local sales processes & policies.)
- Target Audience: The Selected Recipients for the are based on clear various functional responsibilities for specific Opportunity types / criteria, often defined within some kind of responsibilities matrix, which can be reflected in Salesforce Roles or Public Groups.
We will use a worked of an Opportunity Bid Review alert, where a:
- ‘Template’ Notice: complete with the appropriate Selected Recipients – which can then be cloned as needed with a relatively simple…;
- Apex Notice Trigger: with logic to monitor Opportunity data changes and when Probability ≥50% clone the ‘Template Notice’. (Of course, more sophisticated trigger code could create Notices from scratch).
1. Create Template Notice
The Bid Review process owner would also own an associated publishing team NoticeBoard, which would contain & manage various Bid Review ‘template’ Notices to cover local policy variations – complete with appropriate Selected Recipients. (Please see Notice Management for more detail on drafting Notices and Selecting Recipients.)
2. Assign Template to Records
In the real world, the assignment of the appropriate Bid Review ‘template’ Notice to a specific Opportunity would be rule-based. This process would be managed via Apex or standard Salesforce workflow techniques to, for example, write the template Notice ID into a hidden Opportunity field when an Opportunity meets certain criteria.
For simplicity in our worked example, we simply added a custom Alert Notice ID field to an Opportunity page layout. You will need to create this field.
3. Create Trigger
A standard Apex Trigger is used to clone the assigned Bid Review template Notice and specialise its contents for the Opportunity – when it reaches or exceeds 50% Probability.
Salesforce Developer / Sandbox instances
If you are testing Improved NoticeBoard in a Salesforce Sandbox environment, you will be able to paste our trigger code directly into a trigger in your Sandbox org.
- Download our example Opportunity after update trigger code. Please note this example code is provided as-is and you use it at your own risk – Improved Apps provide no support or warranty and take no responsibility for your use. We have to cover ourselves, but would be happy to discuss your specific situation – please contact us;
- Create a new after update Trigger on the Opportunity Object (or open your existing trigger) and copy & paste our sample code into the trigger & save;
- Activate the Trigger.
Salesforce Production instances
If you are working with Improved NoticeBoard in a Salesforce Production instance, you will need (an Apex developer) to:
- Install Improved NoticeBoard into a Salesforce Developer sandbox;
- Create your trigger in the Developer sandbox, as shown above;
- Create an outbound change set in the Developer sandbox containing the Trigger, targeting Production (or any Test sandbox, depending on local procedures for pre-production testing);
- Deploy the inbound change set into your Production instance (after any local testing procedures are complete).
Now to test your trigger:
- Draft a test Bid Review alert Template Notice: and Select Recipients (include yourself);
- Create a test Opportunity: set the Alert Notice ID field with the Salesforce record ID of your test Bid Review alert Notice (the 15 character id in its page URL) and save;
- Edit your Opportunity: and set its Stage to a Milestone with Probability ≥50%;
- Refresh your page: and you will see a Bid Review alert Notification in your Improved NoticeBoard Notification Banner. And notice the Notice name includes your Test Opportunity Name – dynamic Notice content, courtesy of your trigger.
That’s it! You have the recipe for creating & triggering data-driven Notices – now adapt the trigger to suit your local policies.