Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

How to Choose and Use Interceptor Method

All interceptor method names follow a simple naming structure. For example, let's break down the name quotesDetailCreateNewRevision and understand when this method will be called. Quotes indicates that this function will be triggered on a quote page module. Detail implies that it will be triggered on a single selected or opened quote. Meanwhile, quote list would be triggered only on the list. Lastly, CreateNewRevision suggests that the interceptor will be triggered when a new revision will be created.

Here you can find all available interceptor Method Names.

How to Use Interceptor Methods

On the top level of the JS file, you can declare multiple interceptor methods.

Interceptor Method Parameters

With a parameter you can make a query in a CRM system, call notification in Pricefx, etc. Parameters are an essential part of the Interceptors.

What Parameters Does the Interceptor Method Have?

Every interceptor has its own unique set of parameters, but there is a logic behind understanding what parameters you can expect to find in different interceptor methods.

api: is a common parameter for all interceptor methods, InterceptorMethodAPI.

quoteAPI: is only available in the Quoting module.

compensationPlanAPI: is only available in the Sales Compensations module.

contractAPI: is only available in the Agreements & Promotions module.

rebateAgreementAPI: is only available in the Rebates module.

opportunityId: is available in methods with action OpportunityAssign.

accountId: is available in methods with action AccountAssign.

filter: is available in methods with action that contains word filter, for example action: FilterAdd.

For more details about the parameters that each method has, you can refer to the interceptor Method Names.

More About API Parameter

In api parameter, the most commonly used functions are:

crmManager: InterceptorMethodAPI | crmManager allows you to access CRM system, but it is only available inside CRM system.
notify: InterceptorMethodAPI | notify is used for calling notification.
navigate: InterceptorMethodAPI | navigate with this function, you can navigate to other pages or even create new quote with selected type.

This is not all you can do with api. Explore InterceptorMethodAPI and find more functions that you can call from api.

PRE and POST Methods

Some methods have both the options – to add PRE and POST code.

The idea behind is that the PRE code will run before the intercepted method, i.e. when you have a PRE method to create a 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.

If it returns some value, it is passed to Pricefx 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.
Example: quotesDetailNew (POST) and quotesDetailNewPre (PRE)

image-20241002-110105.png

  • No labels