Add a new product to products
...
await add.product({
sku: 'KS-2003',
label: 'Test2',
unitOfMeasure: 1,
currency: 'CZK',
formulaName: 'ActionButtons',
attribute18: 'A'
});
...
Used for obtaining data from Unity which are not accessible through configuration
Returns logged user
Used to temporarily set a value in the configuration.
Updated configuration is valid only in the current web browser tab.
The path to the value, for example environmentSettings.salesforce.displayLocation.Aura.autoGrow
.
Reads values from Pricefx configuration object.
You can use it to get values from feature flags or some other values such as:
The path to the value, for example environmentSettings.salesforce.displayLocation.Aura.autoGrow
.
Optional
defaultValue: anyThe default value if the value under path
is not defined.
const visibleDashboards = await configuration.retrieveConfig(
'customerSpecificFeatureFlag.dashboards.visible.account',
[]
);
crmManager enables communication with CRMs in which Pricefx is embedded.
Triggers postMessage with a message in the window with CRM.
const message = {
fields: [
{ id: 'name', value: 'New name' },
{ id: 'description', value: 'New description' }
]
};
return crmManager.callAndReceive({ action: 'createNewQuote', data: message })
Will return Account from CRM with provided ID.
Finds opportunities by SQL.
Salesforce only, this has not been implemented yet in other CRMs.
export const crmFindOpportunitiesPre = ({
result,
searchText,
api: { crmManager }
}) => {
const query = `
SELECT Id, Name, StageName, RecordType.Name
FROM Opportunity
WHERE Name LIKE '%${searchText}%' LIMIT 300`;
return crmManager.findOpportunitiesByQuery(query).then(list => {
list.forEach(item => {
item.Name = `${item.Name} (${item.RecordType.Name})`;
});
result.list = list;
return result;
});
};
Returns a value of the accountAssociatedValue
feature flag.
The value is set when the application starts and contains a value from CRM account entity.
The feature flag accountAssociationField
will determine which value is used.
The result is based on CRM which is used with Pricefx.
For "applicationEnvironment": "salesforce"
it will return the value from
salesforce.accountAssociatedValue
For "applicationEnvironment":"c4c"
it will return the value from
c4c.accountAssociatedValue
Similarly for other CRMs:
dynamics.accountAssociatedValue
sugarCRM.accountAssociatedValue
Returns a value of the accountAssociationField
feature flag.
The result is based on CRM which is used with Pricefx.
For "applicationEnvironment": "salesforce"
it will return the value from
salesforce.accountAssociationField
For "applicationEnvironment":"c4c"
it will return the value from
c4c.accountAssociationField
Similarly for other CRMs:
dynamics.accountAssociationField
sugarCRM.accountAssociationField
Returns a value of the opportunityAssociatedValue
feature flag.
The value is set when the application starts and contains a value from CRM opportunity entity.
The feature flag opportunityAssociationField
will determine which value is used.
The result is based on CRM which is used with Pricefx.
For "applicationEnvironment": "salesforce"
it will return the value from
salesforce.opportunityAssociatedValue
For "applicationEnvironment":"c4c"
it will return the value from
c4c.opportunityAssociatedValue
Similarly for other CRMs:
dynamics.opportunityAssociatedValue
sugarCRM.opportunityAssociatedValue
Returns a link to the opportunity with provided ID.
Salesforce only, this has not been implemented yet in other CRMs.
ID of the opportunity which you want to link.
Returns CRM payload. The value of the payload will vary based on CRM which is used with Pricefx.
// Get payload from CRM and fill in data from it to a Quote
export const quotesDetailNew = async ({
quoteAPI,
api: { crmManager }
}) => {
const payload = await crmManager.getPayload();
// you can use developer tools and key word:
// debugger;
// to observe what is in payload
await quoteAPI.setHeaderValue('label', payload.Name);
await quoteAPI.setHeaderInputValue('Customer', payload.Customer_Number__c);
await quoteAPI.setHeaderInputValue('ProjectID', payload.Project_Id__c);
await quoteAPI.setHeaderInputValue('ProjectName', payload.Project__c);
};
This method is deprecated, use getAccountAssociationField instead.
Returns a value of the quoteAccountReferenceField
feature flag.
The result is based on CRM which is used with Pricefx.
For "applicationEnvironment": "salesforce"
it will return the value from
salesforce.quoteAccountReferenceField
For "applicationEnvironment":"c4c"
it will return the value from
c4c.quoteAccountReferenceField
Similarly for other CRMs:
dynamics.quoteAccountReferenceField
sugarCRM.quoteAccountReferenceField
Loads an entity by ID from the module.
SugarCRM only
const parentAccount = await crmManager.getSugarCrmEntityById('Accounts', parentId);
Will return true when Pricefx is embedded under an account page in CRM.
Will return true when Pricefx is embedded under the opportunity page in CRM.
Calls HTTP request in CRM.
Salesforce only, this has not been implemented yet in other CRMs.
HTTP request methods
// Updating opportunity back in Salesforce
export const quotesDetailSubmit = async ({
quoteAPI,
api: { crmManager, notify }
}) => {
const externalRef = await quoteAPI.getHeaderValue('externalRef');
const opportunityUrl = await crmManager.getOpportunityURL(externalRef);
const totalValue = await quoteAPI.getHeaderOutputResult('TotalAmount');
const payloadForSF = {
PriceFx_Quote_No__c: quoteAPI.getHeaderValue('uniqueName'),
Amount: totalValue
};
crmManager.postCall(opportunityUrl, 'PATCH', payloadForSF).then(() => {
notify.success('Opportunity was updated.');
});
};
Sends a number of quotes back to SugarCRM.
It shows this number as a part of the panel name. Currently, users may experience some issues.
SugarCRM only
This function is used to manipulate _initCache in SugarcrmManager. It is mainly used to modify the parent account under the account page in SugarCRM SugarCRM only
// Data is a parent account for the current account
crmManager.updateCache('sugarCRMData.payload.Account', data)
Allow page navigation using interceptor API. It is possible to use appPages to define target.
// Navigate to new Quote page
export const quotesListDataLoad = async ({ api, response, appPages }) => {
const { notify, navigate } = api;
const { totalRows, data } = response;
if (totalRows === 0) {
await notify.success(
'There is no relevant quote existing, go to the create-new page!'
);
await navigate(appPages.QC_NEW_QUOTE);
} else if (totalRows > 0) {
const id = data[0]?.typedId;
await navigate(appPages.QC_NEW_QUOTE, { id });
}
};
API for displaying notifications.
Displays a blue notification message.
Displays a red notification message.
// Will display a notification message with the text: "Error message, with help link"
// where help is a link to https://help.me.
// The notification will stay on the screen, the user has to close it.
notify.error(
'Error message, with help link',
{
urlName: "help",
url: "https://help.me",
duration: 0
}
)
Displays a blue notification message.
Displays a green notification message.
Displays an orange notification message.
Optional
params: Record<string, string | number>Generated using TypeDoc
Default API functions which are available in each intercepted method.
Example