Interceptors

Interceptors are used for enriching JavaScript functions in Unity and are intended above all for configuring integration with other applications.

The main idea is that actions are called before and after triggering certain functionality in Unity. A typical example is creating a Quote from Salesforce Opportunity. In the pre-phase, an action checks if the user is entitled to create Quotes from Opportunity. In the post-phase, an action stores the data from Opportunity in the Quote fields.

To create or manage interceptors, go to Administration > Configuration > CRM Configuration > Interceptors

If this section is not shown, ask your administrator to assign the user role "Develop Interceptors" to you.

In this section:

Dynamic Interceptors Overview

The dynamic interceptor is a record in the Advanced Configuration Options which contains at least one exported JavaScript function.

The function name has to be equal to one of the names from supported interceptor names. The name defines where the function will be triggered. For example, quotesDetailCopyPre is triggered when a user clicks the Copy button in the Quote detail, just before the Quote is copied and quotesDetailCopy is triggered after the Quote copy is created.

Interceptor is loaded once, on Unity application startup. It can be reloaded by refreshing the whole page or by clicking the Reload Interceptor option in the Administration menu.

The definition which interceptor is used is stored inside the CRM configuration under the key interceptor. Usually, the interceptor is used across the whole partition. In case that you have two or more CRM configurations then it can differ. For example, you have one for Unity integrated in Salesforce and the second one for a standalone application. In such a case, interceptor can be used just for Salesforce and standalone will be used without it.

See Dynamic Interceptors in the Knowledge Base for configuration details. 

Temporary / Permanent Interceptor

Temporary interceptors – You can use this one to start quick development or test some functionality without any interference with the current solution. It only affects the current session in the browser when new or already existing temporary interceptor is selected and loaded.

Permanent interceptors – This type is written to the active CRM configuration file (declared by confName).

Create New Temporary Interceptor

There is a possibility to create or select different interceptors. 

You can create a temporary interceptor for the current browser session:

  1. Click Set interceptor.

  2. From the drop-down list, select an existing interceptor or the Add new interceptor option. This interceptor is now set as default in your browser session.

  3. The page now displays all the JavaScript API methods that can be extended with interceptors. Expand one of the listed method and click the Add PRE code or Add POST code button depending on whether the action should be called before or after the functionality is triggered in Unity.

  4. From the Available templates drop-down list, you can select one of the predefined code templates or you can select the Empty method option and add your own code to the function call.

  5. Click OK in the edit dialog. The green text PRE or POST is displayed next to the enriched method.

Note:

  • Saved interceptors are stored in the Advanced Configuration Options, where they can be edited or deleted. The key always begins with "pfxInterceptor_".

  • You can edit the interceptor code also in Pricefx Studio.

Found an issue in documentation? Write to us.

 
Pricefx version 12.0