0

I need to access Account Name from Quote Calculator Plugin. Sample code snippet is as below -

export function onBeforeCalculate(quoteModel, lineModels) {
alert(quoteModel.record["Account__r"]["Name"])
return Promise.resolve();
};

I am getting below error -

Plugin Error (onBeforeCalculate) - Cannot read property 'Name' of undefined

As per the Quote Calculator Plugin Guidelines, account information should be accessible.

You can also reference fields on related records. For example, if you want to reference the field MyField__c on an account associated with a quote, access the record ["Account__r"]["MyField__c"].

I am very new to Salesforce. I am bit clueless on how to make it work. Based on the error, I think quoteModel.record["Account__r"] is becoming undefined. How can we get account information from quoteModel object?

Thanks in advance.

0

The relationship from Quote to Account is actually SBQQ__Account__r

Try using quoteModel.record["Account__r"]["Name"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.