Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Creating an Apex Trigger for a Custom Object as a Process Object and a Step

A trigger is Apex code that executes before or after specific data manipulation language (DML) events occur, such as before object records are inserted into the database, or after records have been deleted. A list of all triggers in your organization is located in Setup under Apex Triggers. You can invoke Apex through the use of triggers. Apex triggers are stored as metadata in the application under the object with which they are associated.

A trigger is Apex code that executes before or after the following types of operations:

  • Insert
  • Update
  • Delete
  • Merge
  • Upsert
  • Undelete

For Conga Orchestrate to use a custom object you've created, you must create a trigger and test class in a sandbox environment and deploy them to your production environment. Salesforce does not allow you to create an Apex trigger or Apex class directly in a production org. Refer to Deploy from Sandbox with Change Sets for instructions on the deployment process.

To create Custom Object as Process Object and a Step trigger in a sandbox environment

  1. In your sandbox environment, open Settings by clicking the gear icon (in Lightning) or your name (in Classic) in the upper right corner of Salesforce.
  2. Select Developer Console.
  3. Select File.
  4. Hover over New and choose Apex Trigger.
  5. Give your trigger a descriptive name, like CustomObjectAsStepProcessTrigger.
  6. Choose the custom object from the sObject dropdown.
  7. Click Submit.
  8. Copy the following code and paste it into the new trigger window. Replace the code that was automatically entered when you created the trigger.
    trigger TRIGGERNAME on YOUR_CUSTOM_OBJECT_API_NAME (after insert, before insert, before update, after update, before delete, after delete, after undelete) { FSTR.COTriggerHandler.handleOrchestrateTrigger(); }
  9. Replace TRIGGERNAME in line 1 with the name of your new trigget, which you chose in step 5 above.
  10. Replace YOUR_CUSTOM_OBJECT_API_NAME with your custom object's API name.
  11. Save the trigger by pressing Ctrl+S or by selecting File > Save in the top menu of the Developer Console.
  12. Close the Developer Console.
  13. Ensure the correct configuration exists for your step or process object in the Conga Orchestrate Object custom setting. This setting dictates whether Conga Orchestrate uses the object as a process, as a step, or both.