I have created 1:N relation ship from Opportunity to a custom entity respectively.
I have created a workflow with send email step. In the email body, I am trying to read the child record attributes but the values are not getting displayed in the email.
I think the problem is - As there can be 'n' records for a particular opportunity, the system is unable to recognize the fields, from which child it has to pick the values..
I want to access the recently created child data from the opportunity(parent) in the email body. How can I achieve this?
In most cases creating a custom workflow activity using .Net would be the preferred course of action as there isn't really any good to to pull in the N number of child records into a usable format. You certainly could create a field(s) on the parent and update it it with the child record information and use that field in a workflow but you won't have that much control over the formatting of the output in an email body.
Jason Lattimer My Blog - Follow me on Twitter - LinkedIn
“Recently created child data” is the key here.
The best way to achieve this is through custom development. But, there’s an alternative which may not be as good as doing it through custom development.
Configure a workflow, which fires upon creation of the child record. This workflow picks up the necessary information on the child record and updates it on the parent opportunity record. You need to have appropriate fields configured on the opportunity form to capture this information. Now that all this information will be available on the Opportunity form, you will easily be able to access this information on your workflow to send email which runs on the Opportunity record.
Note that every time a child record is created, the fields on the opportunity entity are overwritten.
Do you want to evaluate this option?
LinkedIn Profile | Rockstar 365 Profile | Blog
What you said about the key is correct.
I thought of two approaches - One is custom development and another is a dirty method though.
Custom Development - Written a plugin on parent record update which will copy the approval status field from parent record to recently created child record.
and then designed a OOB workflow which will send the mail on update of its approval status.
Dirty Method - Have all the child record attributes which are needed in the mail template and then set their values from JS.
I have chosen the plugin option and proceeding with it.
Please let me know if you can suggest any other optimized way.
One of the SMEs suggested me that this can be achieved using a mail merge template.
Any idea on how to achieve it using mail merge template?
You can use a mail merge template under some circumstances (depending on what you need to do) in order to group your child records by opportunity so that each set of child records are grouped on a single page per opportunity. To do this you need to create an export of the child records but also include the parent opportunity fields you need on every row - then you can follow the instructions described at support.microsoft.com/.../294686
Hope this helps,
Read my Blog | Follow Me on Twitter | Rockstar365