How to Create Interceptor

How to Create Interceptor in Pricefx

Prerequisites: Make sure you have the Develop Interceptors role assigned.

Steps to create an interceptor:

  1. Go to Configuration > CRM Integration > Interceptors.

  2. Click the Set Interceptor button which will display a modal window where you can create an interceptor.
    Note that all interceptors have pfxInterceptor_ as a prefix which will be used when saving them as an Advanced Configuration record. You can also set the interceptor as temporary which means that the given interceptor will be activated only for your own browser session.

Interceptors are specific to each CRM configuration.

Example scenario:

  1. Your app uses two CRM configurations: crm_config_account and crm_config_opportunity

  2. You set up an Interceptor while the app is using crm_config_account

  3. Result: The Interceptor will only work with crm_config_account

  4. Important: crm_config_opportunity will not have this Interceptor and you need to set it seperatly for crm_config_opportunity.

In simpler terms, when you set up an Interceptor, it only applies to the specific CRM configuration you're currently using. Other CRM configurations in your app won't automatically get the same Interceptor.

How to Create Interceptor in IntelliJ

Prerequisites: Make sure you have the Develop Interceptors role assigned.

This method requires more steps and might be more difficult than creating an interceptor using pricefx, but provides more control while creating.

Steps to create an interceptor:

  1. Check your version of Pricefx Studio in Plugins and update the version if necessary. If the plugin is missing, install Pricefx Studio first.

     

  2. Edit the Config.js file to be able to fetch and deploy your solution to the correct environment.

     

  3. Create in Advanced configuration new file and name it pfxInterceptor_*.txt (instead of * put name of interceptor).

     

  4. Edit Interceptor and Deploy it to partition.

  5. Find and Fetch CRM config which will use interceptor, default value of the CRM config is crm_config.

  6. In CRM config find or add key interceptor, as a value should be interceptor name.

  7. After the code is deployed, use the Reload Interceptor functionality.

     

  8. Optional. Open pricefx and check if in Administration > Configuration > CRM Integration > Interceptors interceptor is selected.