locked
How to always reply as another person (Easy Question?) RRS feed

  • Question

  • It is policy that many of our users don't show their real names, but instead reply as a generic email.

    e.g. the response will appear to be from enquiries@contoso.com 

    At the moment the user is hitting reply on the queue item, and then manually changing the From field to enquiries@contoso.com 

    Is there an easier way?

     

    Thanks

     

    Phil

    Tuesday, August 30, 2011 9:15 PM

Answers

  • if (crmForm.FormType ==2) //reply

    Not the best way out regarding replies, Neil. Just imagine that someone started to create email, saved (but not sent) an email and after tried to open this email for send. This will invoke issues... But this article will help to remove this issue:

    if (crmForm.FormType == 2 && 
    
    window.location.search != null &&
    window.location.search.indexOf('_InReplyToId') != -1)
    {
    //code for lookup prefilling
    }

    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    • Marked as answer by Phil98765 Monday, September 12, 2011 12:26 AM
    Wednesday, August 31, 2011 7:06 AM
    Moderator

All replies

  • Hi Phil, you should be able to achieve your requirement by using JScript or by writing plugin. A plugin is probably a neater design, but here's a sample of the kind of JScript you might be able to use:

    if (crmForm.FormType ==2) //reply

    {

     var queueId = 'xxx1'; //Guid of the queue

     var queueName = 'XXX'; //Name of the queue

     var lookup = new Array();

     var lookupItem = new Object();

     

     lookupItem.id = queueId;

     lookupItem.name = queueName;

     lookupItem.typename = "queue";

     lookup[0] = lookupItem;

     crmForm.all.from.DataValue = lookup; //set the sender

    }


    Neil Benson, CRM Addict and MVP at Customery Ltd. You can reach me on LinkedIn or Twitter. Join over 10,000 other CRM professionals on the Microsoft Dynamics CRM group on LinkedIn.

    • Proposed as answer by Jehanzeb.Javeed Wednesday, August 31, 2011 12:02 AM
    Tuesday, August 30, 2011 9:24 PM
    Moderator
  • if (crmForm.FormType ==2) //reply

    Not the best way out regarding replies, Neil. Just imagine that someone started to create email, saved (but not sent) an email and after tried to open this email for send. This will invoke issues... But this article will help to remove this issue:

    if (crmForm.FormType == 2 && 
    
    window.location.search != null &&
    window.location.search.indexOf('_InReplyToId') != -1)
    {
    //code for lookup prefilling
    }

    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    • Marked as answer by Phil98765 Monday, September 12, 2011 12:26 AM
    Wednesday, August 31, 2011 7:06 AM
    Moderator
  • I've put a workflow on the creation of an email - if the current "From" user is on a special list of people the From field is updated to  enquiries@contoso.com.

    When the email is created, the email window pops up - the From field doesnt seem to have changed - but after the email is sent it arrives at the client with the from field from enquiries@contoso.com. Users are happy with this :)

     

    Thursday, September 1, 2011 12:24 AM
  • Hello Phil,

    Just imagine that your CRMAsyncService stopped to work (this thing happens often). Would this approach work or not?


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    Thursday, September 1, 2011 12:28 AM
    Moderator
  • OK - so we cant rely on workflows to work :(.. I'll have a look at your previous replies

     

    Sunday, September 4, 2011 9:39 PM
  • So my final solution was to create an "Always Send As" field in the user entity.

    (This is a N:1 relationship User:User, each user can have one "Always Send as" user)

    I used javascript on the email form to look at the "Always send As" field for the current user.

    If the form was in new record mode (Formtype=1) and the "Always send as" field is populated, then the From field contents is replaced.

    You have to make sure the user has rights to send as the specified person.

    • Edited by Phil98765 Tuesday, September 6, 2011 9:01 PM
    Tuesday, September 6, 2011 8:55 PM
  • This approach would not work in the case someone will reply on the email.
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    Tuesday, September 6, 2011 9:16 PM
    Moderator
  • Why not?

    When the user replies to an email, the java script detects it's a new email record and changes the From field.

    This is what the user requires.

    Friday, September 9, 2011 1:43 AM
  • Because when someone replies to email FormType of form equals to 2 like you've opened record for editing.
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    Friday, September 9, 2011 4:51 AM
    Moderator
  • OK you're right :)

    When an email is created it uses: formtype==1.

    When you reply to a form it has: formtype==2

    So using code from your previous article... ( this article):

    if (crmForm.FormType == 1 ||
      (crmForm.FormType == 2 &&
      window.location.search != null &&
      window.location.search.indexOf('_InReplyToId') != -1))

     {

    If this condition is true then the email is a new email, or a reply (and I need to replace the value in the "from" field)

    This seems to work. (I wish there was an easier way)

    Many thanks!

     

     

     

    Monday, September 12, 2011 12:25 AM