Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

How to Create Interceptor in Unity

...

  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.

    Image RemovedImage Added

  3. Now you will see all available intercepted methods. Each method refers to an event in Unity. Some of these events are:

    • quotesDetailNewCheck
      This method is triggered after clicking the New button at /#/qc/quotes, but before the Quote is created. If this method returns false, the Quote will not be created and the user will stay at the Quote list. In this method you do not have access to quoteAPI, but you can use other APIs for checking conditions from CRMs.

    • quotesDetailNew
      The starting point for this event is clicking the New button at /#/qc/quotes. The method is triggered after the new Quote is recalculated and saved at backend and the user is redirected to the Quote detail page /#/qc/quotes/<quoteId>.

    • quotesDetailEdit
      Triggered when a user opens the Quote detail page.

    • quotesDetailRecalculate
      Triggered when a user clicks the Recalculate button on the Quote detail page /#/qc/quotes/<quoteId>.

    • quotesDetailSubmit
      Triggered when a user clicks the OK button in the Submit modal dialog on the Quote detail page /#/qc/quotes/<quoteId> after clicking Submit.

    • quotesDetailTabSwitch
      Triggered at Quote detail at open and then when the user switches to a different tab.

      To see a regularly updated list of all available methods and when they are triggered, visit Interceptors documentation page.

  4. As you expand one of the method fields, you will see Add PRE Code, and/or Add POST Code buttons (according to each method’s compatibility):


    When clicking any of them, a modal window will show:

    Image RemovedImage Added


    There is a dropdown menu with available templates, and you can also paste your JavaScript code in there.
    More technical explanations how this code is structured and what PRE and POST means are available below.

  5. Finally, you can test the interceptor's functionality, in this case by creating a new quote:

...

  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 RemovedImage Added

     

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

    Image RemovedImage 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 RemovedImage Added

     

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

    Image RemovedImage Added

     

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

    Image RemovedImage Added

How to Create Interceptor in VSCode or VSCodium

...