locked
Changing "From" field name while sending email? RRS feed

  • Question

  • Hi,

    I want to change the "From" filed name while sending an email.

    I have created a workflow which will fire when a new contact is created, in that i need to send an email to the contact. In the send email step i setup the "from" field to the CRM Administractor user. For this administractor user firstname is CRM and last name is ADMIN, after sending email when i check the email the from value is <<firstname lastname>> that is CRM ADMIN, but now for some contacts i need to set the from value of the email should be some <<preferredname lastname>>(preferredname is one of the attribute in the contact form).

    How can i do this run time after creating workflow. Any suggestions are most welcome. Can any one give me any idea or is this kind of requirement is possible in CRM?

    Thanks,

    Rajesh.

    Saturday, May 29, 2010 11:47 AM

Answers

All replies

  • Hi Rajesh,

    It seems, it is not possible to set it through Workflow,But you can try write a plugin on email on send message, I hope there you can change "from" field to set name as "preferredname" .

    Hope it will help you !!!


    Mahain
    Sunday, May 30, 2010 7:32 AM
    Moderator
  • Hi Mahain,

    Thanx for the reply, i have written the sample plugin on email on send message and i have registered through pluging registration rool on send message, but after creating an email activity when i check the email it is giving error and its not providing any description.

    If you can provide me any sample code that would be so helpful for me.

     

    Sunday, May 30, 2010 9:36 AM
  • You could possibly write custom workflow to determine the sender when the workflow is fired, so you could still stick to workflow, by which you don't lose the flexibility of CRM workflow engine. 

    I believe you have certain context information that you can use to write your custom workflow code so that you can determine who the sender is based on the context information. Such context information would be the input parameter of the custom workflow. The output parameter of the workflow is a CrmReferenceTarget of systemuser. After the custom workflow is deployed, you can revisit the current workflow and change the send to the dynamic value of what the custom workflow has generated for you. 

    It seems to me it's less effort than writing plug-in. 

     


    Daniel Cai | http://danielcai.blogspot.com
    Sunday, May 30, 2010 2:34 PM
  • Hi Rajesh,

    In that case I will suggest you to debug your plugin and check your code is working fine or not. check below link to plugin debugging information

    http://msdn.microsoft.com/en-us/library/cc151088.aspx

     


    Mahain
    • Marked as answer by Jim Glass Jr Tuesday, June 1, 2010 4:47 PM
    Sunday, May 30, 2010 5:27 PM
    Moderator