Currency Amount: Product-to-Product Transform Templates
SFDC-to-Max Mappings
You can send a blank POST request to the following custom endpoint to determine whether an org is enabled for multiple currencies:
https://salesforceinstanceurl/services/apexrest/SVMXC/integration/v1/orginfo
If the org is multi-currency enabled. the command returns the following:
{"isMultiCurrency":"true"}
If the org is not multi-currency enabled, the command returns the following:
{"DefaultCurrencyIsoCode":"USD","isMultiCurrency":"false"}
You can then construct the currency value in the following custom transform operation:
def slurped = new JsonSlurper().parseText(content);
slurped.each{
String currencyAmount = it.currency_amount;
String currencyCode = null;
if (defaultCurrencyCode){
currencyCode = defaultCurrencyCode;
} else {
currencyCode = it.currency_code;
}
if (currencyAmount){
it.core_cost = currencyCode + ' ' + currencyAmount;
} else {
it.core_cost = 'USD 0';
}
}
For real-time sync, you can modify SFDC trigger code to set the CurrencyIsoCode field for single-currency support. Alternatively, you can directly use the following custom endpoint:
https://salesforceinstanceurl/services/apexrest/SVMXC/integration/v1/orginfo
Max-to-SFDC Mappings
You can use the currencyInverseFormat function to transform Currency Amount data type values to currency ISO code and amount values as follows:
"CurrencyIsoCode": "currencyInverseFormat(payload.fields.core_cost, 0)",
"SVMXC__Product_Cost__c":"currencyInverseFormat(payload.fields.core_cost, 1)"
For more information: