You need to sign in to do that
Don't have an account?
Integration 39
Send email from opportunity with product data
Hello,
I am trying to create an email template with data from the product accociated to the opportunity.
When i use the product varabiles i get null data returned.
I updated a trigger to write to the opportunity line item to grab the information i needed but that is also null.
It is not possible to get a trigger to update the opportunity as it is locked when triggered.
Does anyone have any suggestions to get around this?
I am trying to create an email template with data from the product accociated to the opportunity.
When i use the product varabiles i get null data returned.
I updated a trigger to write to the opportunity line item to grab the information i needed but that is also null.
It is not possible to get a trigger to update the opportunity as it is locked when triggered.
Does anyone have any suggestions to get around this?
YOUR APPROACH :
First of all In the email template, you are getting null as in the email template cross object data can not be accessed.
FYR : https://help.salesforce.com/apex/HTViewSolution?id=000005093&language=en_US
So you have the option to add the fields required through a trigger which you have rightly chosen.
Based on your second problem it seems that the record can not be updated as it is locked So if you'd like to modify this records (or records), you will need to query anew, modify, then execute another DML statement
FYR :http://salesforce.stackexchange.com/questions/14950/exeception-on-after-insert-record-is-read-only
NEW APPROACH :
But if you want to create email template on Opportunity and you are trying to replicate the data from line item to Opportunity (both on line item and opportunity) it would be a data duplication. You can try with Visual force email templates and check if it suffices your requirement.
Hope this solves your problem.