Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As it was described in Dynamic Interceptors , it’s possible to create interceptors through Unity UI. For a better user experience while development, we strongly recommend to use IntelliJ with PriceFX Studio plugin:

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

    Image Added

     

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

    Image Added

     

  3. After creating a new Dynamic Interceptor on the Configuration > Interceptors page, you can fetch it. Select the Environment and Partition that you want to work with and locate your interceptor in the Advanced configuration. Then click the Fetch button.

    Image Added

     

  4. The procedure is similar to deploying your solution after some changes.

    Image Added

     

  5. After the code is deployed, use the Reload interceptor functionality.

    Image Added

How interceptors work

Basically, this piece of javascript code will be structured like:

Code Block
export const compensationsDetailCreateNewRevision = async ({ compensationPlanOriginAPI, compensationPlanNewRevisionAPI, api: { notify }}) => {
  await notify.success('Triggered interceptor compensationsDetailCreateNewRevision');
  // TODO: Add your code
}

For each method that you would like to trigger something, there will be a function being exported. This function has one argument, which has different APIs that will offer interaction with Unity, and CLIC data manipulation. In here you can find the type definitions and documentation of all available methods and their available API through its argument. In case you struggle to find out exactly what’s available, you can run the specific interceptor method with a debugger:

Code Block
export const quotesDetailNew = (parameter) => {
  debugger;
};

As you may see, there are also some methods that have both the option to add PRE and POST code.

The idea behind this is that the PRE code will run before the event itself, i.e. when you have a PRE method on create new quote, this will run before the quote is created, and in case your PRE method returns false it will stop and the quote will not be created.

In case it returns something, that will be passed to Unity and can be used according to the method.

Then, the POST code will run.

PRE and POST methods have the same name, and for PRE ones they must have a Pre suffix, as in quotesDetailNew (POST) and quotesDetailNewPre (PRE).

TO BE DELETED FROM HERE

...

Info

This article is not exhaustive. More content will be added later.

...