locked
crm 4.0 e-mail (reply; reply all) RRS feed

  • Question

  • Is there a way to know, some property or something that can tell me if there is way to know, some property or something else that can tell me if it was replied to an e-mail from crm.

    I've received a mail and have replied to it. Is the RE: mail somehow associated with the original?

    Wednesday, June 8, 2011 12:31 PM

Answers

  • Hello,

    I had the same task. I did the investigation and I found that this is not tracked. So I used following approach:

    1. I added custom varchar attribute to email and called it new_parentemailid.

    2. Added following script to onload of email:

    if (crmForm.FormType == 2 && 
      window.location.search != null &&
      window.location.search.indexOf('_InReplyToId') != -1)
    {
    	var query = window.location.search;
    	if (query == null || query == "")
    		return;
    
    	query = query.substring(1, query.length - 1);
    	var queryparts = query.split("&");
    
    	var parentid = null;
    
    	for(var i = 0; i < queryparts.length; i++)
    	{
    		var params = queryparts[i].split("=");
    		if (params[0].toLowerCase() == "_inreplytoid")
    		{
    			parentid = params[1].replace("%7b","").replace("%7d","");
    			break;
    		}
    	}
    
    	if (parentid == null)
    		return;
    
    	var xml = "<?xml version='1.0' encoding='utf-8'?>"+ 
    	"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
    	" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
    	" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ 
    	GenerateAuthenticationHeader()+
    	"<soap:Body>"+ 
    	"<Update xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ 
    	"<entity xsi:type='email'>"+ 
    	"<new_parentemailid>"+parentid+"</new_parentemailid>"+ 
    	"<activityid>"+crmForm.ObjectId+"</activityid>"+ 
    	"</entity>"+ 
    	"</Update>"+ 
    	"</soap:Body>"+ 
    	"</soap:Envelope>";
    
    	var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    	xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    	xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Update");
    	xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    	xHReq.setRequestHeader("Content-Length", xml.length);
    	xHReq.send(xml);
    }
    
    Purpose of following script is to update added custom field with identifier of parent email for creation of relation. After it I was able to build relations with these emails.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, June 8, 2011 12:45 PM
    Moderator

All replies

  • Hello,

    I had the same task. I did the investigation and I found that this is not tracked. So I used following approach:

    1. I added custom varchar attribute to email and called it new_parentemailid.

    2. Added following script to onload of email:

    if (crmForm.FormType == 2 && 
      window.location.search != null &&
      window.location.search.indexOf('_InReplyToId') != -1)
    {
    	var query = window.location.search;
    	if (query == null || query == "")
    		return;
    
    	query = query.substring(1, query.length - 1);
    	var queryparts = query.split("&");
    
    	var parentid = null;
    
    	for(var i = 0; i < queryparts.length; i++)
    	{
    		var params = queryparts[i].split("=");
    		if (params[0].toLowerCase() == "_inreplytoid")
    		{
    			parentid = params[1].replace("%7b","").replace("%7d","");
    			break;
    		}
    	}
    
    	if (parentid == null)
    		return;
    
    	var xml = "<?xml version='1.0' encoding='utf-8'?>"+ 
    	"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
    	" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
    	" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ 
    	GenerateAuthenticationHeader()+
    	"<soap:Body>"+ 
    	"<Update xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ 
    	"<entity xsi:type='email'>"+ 
    	"<new_parentemailid>"+parentid+"</new_parentemailid>"+ 
    	"<activityid>"+crmForm.ObjectId+"</activityid>"+ 
    	"</entity>"+ 
    	"</Update>"+ 
    	"</soap:Body>"+ 
    	"</soap:Envelope>";
    
    	var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    	xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    	xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Update");
    	xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    	xHReq.setRequestHeader("Content-Length", xml.length);
    	xHReq.send(xml);
    }
    
    Purpose of following script is to update added custom field with identifier of parent email for creation of relation. After it I was able to build relations with these emails.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, June 8, 2011 12:45 PM
    Moderator
  • I'll try that. Thanx for your suggestion Andriy.

    Wednesday, June 8, 2011 12:49 PM