Download PDF
Download page Approval Required Check for Agreement.
Approval Required Check for Agreement
Approval Required check is performed to determine whether a custom object, Conga object, standard Salesforce object or its line item requires an approval and if an approval process needs to be executed. Approval Required check sets the approval status of the header or child object to Approval Required. Approval Required check does not evaluate the approval process, but rather performs a simple check outside of the approval process definition. Approval Required Check sets the approval status of the header or child objects items to Approval Required to make it easy to check whether approval is needed. The purpose of the Approval Required check is to reduce the overhead of performing detailed process evaluation to determine if approval is needed. While defining the Entry criteria of the Approval Process in conjunction with Approval Required check, you should use the Approval Required approval status as one of the criteria.
For example, Approval Required check is invoked prior to the execution or evaluation of the approval process. Approval criteria or conditions are defined using Search Filters(Approvals) of type Entry Criteria. Approval Required Check is primarily used with CPQ approvals, but can also be used with approval on other objects, such as Agreement and its related objects.
Steps to Set up Approval Required check
Adding Approval Status fields to an object
Adding the custom object to the search filter
Setting up the Approval Required check trigger
Setting up an entry criteria for the Approval Required check
To create an approval required check trigger
Approval Status picklist enables triggers in the Approval Required check process. Ensure that you have added Approval Status picklist for your context object by navigating to Build > Custom object (Object Name) > Fields > New and adding the values: Not Submitted (default), Approval Required, Pending Approval, Approved, Rejected, Cancelled, Closed.
- Use the following two global methods of the ApprovalRequiredCheck class to create your Approval Trigger or Workflow Rule.
doCheck(Id objId) – This API takes up the IDs of all the records of your context object and checks if these records satisfy the Entry Criteria defined at the Search Filter (Approvals). If the Entry Criteria is satisfied, this API returns true, otherwise false. For example, if you have approval processes defined for your Agreement header fields and Agreement Line Items, this API checks if your Agreement record and Agreement Line Items satisfy the Entry Criteria (RecordType == NDA) returns True or False, and sets the Approval status of filtered records to Approval Required. Also, if there is a change in the value of your Agreement header or Agreement Line Item, and the entire approval request is re-submitted, this API considers all record IDs for Approval Required Check and re-evaluates them.
If a child object record, such as an Agreement Line Item is already Approved, this API does not consider these Line Items. For rest of the Approval Statuses, such as Cancelled, Rejected, Not Submitted, this API is useful.
This API is invoked as follows:
Apttus_Approval.ApprovalRequiredCheck checker = new Apttus_Approval.ApprovalRequiredCheck()
Boolean result =checker.doCheck(objId)
doCheck(SObject object) – This API returns a map of approval status values keyed by object ids for your context object. The first entry in the map corresponds to the header context object. The Key-Value pair indicates what Approval Status should be set for a specific record of your context object. For example, if you make any change in one of the field of Agreement header, such as Agreement End Date and the Approval Status for your Agreement record is Cancelled.
This API is invoked in a trigger before update as follows:
Apttus_Approval.ApprovalRequiredCheck checker = new Apttus_Approval.ApprovalRequiredCheck()
Boolean result = checker.doCheck(object)
- Add the custom object to a search filter criteria by clicking Create Objects > Search Filter (Approvals) > Business Object. Add the API name of your custom object to the pick list.
- Create a trigger that sets the Approval Required check for your custom object.
- Navigate to Conga Approvals Management > Search Filters (Approvals) tab and set up your entry criteria in this section.
After you setup the Search Filter Criteria for your object, define the Approval Process for it. If the approval criteria is fulfilled, the approval status of the object changes based on the trigger you configure.
Creating Search Filters (Approvals)
The two Filter Type options (Child Filter and Entry Criteria) serve two different purposes.
Entry Criteria | This is required for approvals to be initiated for a custom object. To improve performance, the system will check if there are any Entry Criteria search filters that match the attributes of the custom object and set the approval status to Approval Required. You can have the entry criteria at the line item to set the approval status to Approval Required or Approval Triggered. |
Child Filter | This is required to have a header-level approval-step entry criteria that makes use of the line item fields for the header custom object. After you create a child filter, you then need to create step-entry criteria using child filters that mirrors the expression used in the child filter. |
Configuring and Creating Search Filters
Search filters of type Entry-Criteria are used to check whether the object requires approval before it can be finalized. If you want approvals to be triggered at the header level, then you need to configure search filters based on the context object. If you want approvals to be triggered at a Line Item level, then you would configure search filters for the Line Item context object. Additionally, if you want consolidated approvals for the whole object configuration, then you would create both. You must follow the procedure listed in the following section to configure and create search filters.
Configuring Search Filters - this adds custom objects to the Search Filter object picklist so you can create search filters that use these objects for their entry criteria.
Creating Search Filters - the Search Filters are used to determine if the products in the object require approval.
To configure Search Filters for Approvals
- Go to Setup > Build > Create > Objects and select Search Filter (Approvals).
- From the Custom Fields & Relationships section, select Business Object.
- From Picklist Values, click New and enter the API names for the Header object and the line items: Header Object API name for Header level approvals and Child Object API namefor Line Item level approvals.
- Click Save. The values are added to the Picklist Values list.
- Click Back to Search Filter (Approvals) and from the Custom Fields & Relationships section, select Filter Type.
- From Picklist Values, click New and enter Child Filter and Entry Criteria.
- Click Save.
The values are added to the picklists, which are required to create search filters.
You can create Search Filters (Approvals) for controlling which objects are checked to see if they need approval.
To create Search Filters for Approvals
- Click All tabs and select Search Filter (Approvals).
- Click New Search Filter (Approvals) and select one of the following options.
- Header Object Name - select this if you want the filter to be at the context object level.
- Child Object Name - select this if you want the filter to be at the Line Item context object level, which are the individual line items within the Header object.
- Click Next. The Configure Filter page appears.
- From Filter Type, select one of the following options.
- Child Filter - This enables you to have step entry criteria within your approval process that reference the child record fields of the main context object. This enables you to use line item fields with your Header Object Name approval process. The line item child Filters you create here enable you to have them available for approval step entry criteria.
- Entry Criteria - Indicates that the search filter will be used for the Approval Required check, which checks whether the header or header line item values of an object required to undergo an approval. Essentially, you have and an additional level of entry criteria for approvals here, before the system searches for matching approval processes.
Note
You must have set at least either the Entry Criteria or the Child Filter for approvals to be available from the parent object.
- Enter a required Filter Name and Sequence. The sequence is used to determine the order in which the search filters will check if approvals are required.
- Enter the Filter criteria, which is used to determine if the object requires approval.
- Click Save.
The Search Filter is now active. If it is an Entry Criteria filter, the system will determine if a header object requires approval.
You must create an Approval Process that can be used with the header object.