How to create a interceptor through Unity
Before all, please make sure you have Administration > Develop Interceptors role activated. It’s also important to mention that dynamic interceptors are not compatible with Ember Unity parts.
After that, you will be able to navigate to Interceptors page, which can be found on Configuration Page, under CRM Integration section.
As you open Interceptors page, you will see the Set Interceptor button, which will display a modal where you can create an interceptor. Please note that all interceptors have pfxInterceptor_ as prefix, which will be used when saving them as a Advanced Configuration record. You can also set the interceptor as temporary, which means that the given interceptor will be attached
...
After this step, you will see all available intercepted methods. Each method refers to an event in Unity, some of them are:
quotesDetailNewCheck
This method is triggered after clicking the the New button at /#/qc/quotes, but before the Quote is created. If this method returns false, a Quote will not be created and the user will stay at the Quote list. In this method you don't have access to quoteAPI, but you can use other API 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.
In order to find out the updated list of all available methods and when they are triggered, please visit Interceptors documentation page.
As you expand one of the method fields, you will see Add PRE Code, and/or Add POST Code (according to each method’s compatibility):
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:
...
The idea behind this is that the PRE code will run before the event itselfintercepted method, 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.
...