How to Get Data from CRM
To get data from a CRM, Pricefx should be placed into CRM system. Currently, Pricefx doesn’t have any possibility to access CRM system data outside the CRM (except PlatformManager).
Use getPayload
Code Block |
---|
|
export const quotesDetailSubmitPre = async ({ api: { crmManager } }) => {
const payload = await crmManager.getPayload();
console.log(payload);
}; |
Returns data from the current CRM page. For example: if getPayload is triggered under account page in Salesforce, getPayload will return all data from that specific account: accountId, accountName and etc.
How to Use Data from getPayload
Code Block |
---|
|
export const quotesDetailSubmitPre = async ({ api: { crmManager } }) => {
const payload = await crmManager.getPayload();
// To find what values exist in payload
// Can be removed later when not needed
console.log(payload);
// If name in payload always exist
await quoteAPI.setHeaderValue('label', payload.name);
// If name in payload can be not existing
await quoteAPI.setHeaderValue('label', payload.name || 'Name do not exist in payload');
}; |
How to Change Inputs/outputs in Pricefx
To populate value/result for inputs in Pricefx with interceptor is fairly easy to do. You can change both inputs and outputs values in Pricefx modules.
...
To do so, you will need to:
Choose interceptor method which has scope detail
.
Add to parameters CLIC API, for example: quoteAPI
, compensationPlanAPI
or …
Inside module write await quoteAPI.setHeaderValue('label', 'pricefx Pivo a Párek');
. This function will set value in header, but there are also functions for setting header input value, output result and line items inputs.
Full code example for inptus:
Code Block |
---|
|
export const quotesDetailOpen = async ({ quoteAPI }) => {
await quoteAPI.setHeaderValue('label', 'pricefx Pivo a Párek');
} |
Code Block |
---|
|
export const quotesDetailOpen = async ({ quoteAPI }) => {
// Simple inputs
await quoteAPI.setHeaderInputValue('ProjectID', 'Some ID');
await quoteAPI.setHeaderInputValue('ProjectName', 'Project Name');
} |
Code Block |
---|
|
export const quotesDetailOpen = async ({ quoteAPI }) => {
// Input with configurator
await quoteAPI.setHeaderInputValue('Configurator_Documents', {
InvoiceMethod: 'Invoice method',
OpportunityOwner: 'Name',
OpportunityOwnerEmail: 'Email',
OpportunityOwnerPhone: 'Phone',
OpportunityOwnerTitle: 'Title'
});
} |
Full code example for outputs:
Code Block |
---|
|
export const quotesDetailOpen = async ({ quoteAPI }) => {
await quoteAPI.setHeaderOutputResult('outputName', 'pricefx Pivo a Párek');
} |
For more information regarding CLIC Methid Interceptor API, you can find here: CLIC Method Interceptor API