...
Code Block |
---|
|
await api.add.product({
sku: 'KS-2003',
label: 'Test2',
unitOfMeasure: 1,
currency: 'CZK',
formulaName: 'ActionButtons',
attribute18: 'A'
}); |
...
Code Block |
---|
|
await api.app.getCurrentUser()
/*
{
"version": 2,
"typedId": 123,
"loginName": "donatas.ka",
...
}
*/ |
...
Code Block |
---|
|
await api.configuration.overrideConfig(
'applicationEnvironment',
'salesforce'
); |
...
Code Block |
---|
|
const message = {
fields: [
{ id: 'name', value: 'New name' },
{ id: 'description', value: 'New description' }
]
};
return api.crmManager.callAndReceive({ action: 'createNewQuote', data: message }) |
...
Code Block |
---|
|
export const crmFindOpportunitiesPre = ({
result,
searchText,
api: { crmManager }
}) => {
const query = `
SELECT Id, Name, StageName, RecordType.Name
FROM Opportunity
WHERE Name = '%${searchText}%'
LIMIT 10
`;
return api.crmManager.findByQuery(query).then(list => {
list.forEach(item => {
item.Name = `${item.Name} (${item.RecordType.Name})`;
});
result.list = list;
return result;
});
}; |
...
Code Block |
---|
|
export const quotesDetailNew = async ({
quoteAPI,
api:
{ crmManager }
}) => {
const payload = await api.crmManager.getPayload();
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);
}; |
...
Code Block |
---|
|
const parentAccount = await api.crmManager.getSugarCrmEntityById('Accounts', parentId); |
...
Returns true when Pricefx is embedded under an account page in CRM.
Example:
Code Block |
---|
|
export const quotesDetailSubmit = async ({
api
}) => {
if(await api.crmManager.isAccountPage()) {
await api.notify.success('We on account page');
}
}; |
isOpportunityPage
Code Block |
---|
|
isOpportunityPage: (() => Promise<boolean>) |
Returns true when Pricefx is embedded under the opportunity page in CRM.
Example:
Code Block |
---|
|
export const quotesDetailSubmit = async ({
api
}) => {
if(await api.crmManager.isOpportunityPage()) {
await api.notify.success('We on opportunity page');
}
}; |
postCall
Code Block |
---|
|
postCall: ((url, method, payload) => Promise<any>) |
...
Code Block |
---|
|
export const quotesDetailSubmit = async ({
quoteAPI,
api: { crmManager,
notify }
}) => {
const externalRef = await quoteAPI.getHeaderValue('externalRef');
const opportunityUrl = await api.crmManager.getOpportunityURL(externalRef);
const totalValue = await quoteAPI.getHeaderOutputResult('TotalAmount');
const payloadForSF = {
PriceFx_Quote_No__c: quoteAPI.getHeaderValue('uniqueName'),
Amount: totalValue
};
api.crmManager.postCall(opportunityUrl, 'PATCH', payloadForSF).then(() => {
api.notify.success('Opportunity was updated.');
});
}; |
...