Setting up a Routing Rule allows you to have greater control over when SObjects are inserted, updated, and deleted from your database. These rules can be enabled and disabled on the fly.
For example, your Event needs a seat record created for that Event before an attendee record is created. You would set up two Routing Rules - one to create the attendee record, and a second to create the seat. You can control the Execution Order through the Routing Rules so the seat is created before the attendee record.
Create a New Routing Rule
From the Routing Rules Dashboard:
- Click .
- Enter the following:
- sObject Name - The target SObject.
- Namespace - The namespace for the above SObject.
- Apex Class - This is NOT the Domain Class you provided with your Registered Object. This is a new Domain Class created as part of an extended package.
- Execution Order - The order in which you want your Routing Rules executed. Your Registered Object is always executed first, then your Routing Rules are executed in the order you provide.
- Click the Is Enabled select box to enable your rule.
- Click .
- Routing Rules should not be created in the same Managed Package as your Registered Object.
- See Apex Class for more information on creating Domain Classes.
You can also create a new Routing Rule by injecting the following code into your Fonteva App through the Developers Console. Copy and paste this code into the console and replace the values for each field.
Framework.RoutingRule accPermission = new Framework.RoutingRule(); accPermission.apexClass = AccessPermissions.class.getName(); accPermission.namespace = PackageUtils.namespace; accPermission.isEnabled = true; accPermission.sObjectName = SObjectType.OrderApi__Access_Permission__c.getName(); accPermission.executionOrder = 0; rules.add(accPermission);
When using the above code snippet, enter the full sObjectName, including the Namespace.