Question Status

Suggested Answer
P V Raghu Kumar asked a question on 26 Mar 2014 9:09 AM

Hi,

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?

Thanks,

Raghu.

Reply
Suggested Answer
Jason Lattimer responded on 26 Mar 2014 10:06 AM

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

Reply
Suggested Answer
Karthik Srinivasan responded on 26 Mar 2014 3:24 PM

“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?

Reply
Suggested Answer
Scott Durow responded on 28 Mar 2014 1:33 AM

Hi,

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,

Scott

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply
Suggested Answer
Jason Lattimer responded on 26 Mar 2014 10:06 AM

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

Reply
Suggested Answer
Karthik Srinivasan responded on 26 Mar 2014 3:24 PM

“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?

Reply
P V Raghu Kumar responded on 27 Mar 2014 6:17 AM

Hi Karth,

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.

Thanks,

Raghu.

Reply
P V Raghu Kumar responded on 28 Mar 2014 12:23 AM

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?

Thanks,

Raghu.

Reply
Suggested Answer
Scott Durow responded on 28 Mar 2014 1:33 AM

Hi,

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,

Scott

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply