MassLOOP: Automatically Set Email Notification Preference

Overview:

Each time you run a MassLOOP in Drawloop Document Generation you will automatically receive email notifications that the process has:

  • Began
  • Completed
  • Encountered an error for one or more records

Many users prefer to customize this setting to only receive an email notification when an error is received or when the process ends rather than receiving all three of these emails.

Who receive these notifications? The owner of the Document Package (DDP record) and the User running the MassLOOP.

Configuration:

In order to adjust this setting you will need to add the ‘&batchnotification=’ parameter to your custom button along with the appropriate value (listed below). The entire string should look like this: &batchnotification=ON_ERROR.

Values:
BEGIN_AND_COMPLETE  –  Only receive emails when the MassLOOP begins and compeletes.
ON_COMPLETE  –  Only receive an email when the MassLOOP compeletes.
ON_ERROR  –  Only receive an email when the MassLOOP has an error.
NONE  –  Never receive emails.

Sample Code:

{!REQUIRESCRIPT(“/soap/ajax/26.0/connection.js”)}{!REQUIRESCRIPT(“/support/console/26.0/integration.js”)} var ids = {!GETRECORDIDS($ObjectType.Opportunity)};if (!ids || ids.length < 1)alert(“Please select at least one record.”);else{var redirectUrl = “/apex/loop__masslooplus?&batchnotification=ON_ERROR&retURL=” + encodeURI(window.location.pathname+window.location.search);redirectUrl += “&recordIds=”+ids.join(“,”);redirectUrl += “&sessionId={!$Api.Session_ID}”;window.location.href = redirectUrl;}

Drawloop Button: Error when a field has no value

Problem:
You would like a User to only be able to run a DDP from an Opportunity record if the Type field has a value, otherwise you would like the User to receive an alert stating the Type field must be entered first.

Solution:
Using JavaScript we will create a custom button that will evaluate the field, ensure it meets the criteria and if not, present the User with an error.

Steps:
1. In Salesforce, navigate to an Opportunity record.
2. Click the arrow on the right-hand side of the page.
3. Select View Object
4. In the left-hand menu, select ‘Buttons, Links, and Actions’
5. Click the ‘New Button or Link’ button
6. Provide the button with a Label. The value provided will be cloned in the Name field as well.
7. Set the Display Type to ‘Detail Page Button’.
8. Set the Behavior field to ‘Execute JavaScript’. The Content Source field will change to ‘OnClick Javascript’
9. Copy the code below:

{!REQUIRESCRIPT(“/soap/ajax/26.0/connection.js”)} if (‘{!Opportunity.Type}’ == ” )     alert(‘You cannot generate a quote unless Type has a value.’);else    window.location.href = ‘/apex/loop__looplus?eid={!Opportunity.Id}&accountId={!Opportunity.AccountId}&sessionId={!$Api.Session_ID}’;

10. Click ‘Check Syntax’ to ensure there are no errors.
11. Click ‘Save’.

Once the newly created custom button is added to the page layout you’re all set!