web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Auto populate

(0) ShareShare
ReportReport
Posted on by 240

Hi,

I am looking for the way to auto populate the 'Customer' lookup field as an account
on the case form from the Contact form, when I select the relevant 'Responsible Contact'.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hello,
    What product line are you using here?

  • jackronic khumalo Profile Picture
    240 on at

    Hi Nick

    Am sorry am a blk male frm SA ..... n my product line is CRM, esp : CRM 4.0 of which am still new @ it

  • Community Member Profile Picture
    on at

    Thank you for letting me know what product line you are using. I will be moving this post to the CRM product forum.

  • jackronic khumalo Profile Picture
    240 on at

    Thanx that will be ma pleasure

  • Inogic Profile Picture
    703 on at

    Hi Jack,

    You may want to check the below post that discusses the similar request. 

    https://community.dynamics.com/forums/p/18454/28796.aspx#28796

    HTH

    Sam

  • jackronic khumalo Profile Picture
    240 on at

    Thanx 'will do that

  • jackronic khumalo Profile Picture
    240 on at

    Hi Sam

    I never use webservices and i have try the whole day to figure it out but ......... with no success

    thanx in advance

  • Inogic Profile Picture
    703 on at

    Hi,

    CRM SDK is always a good place to start your search from.

    It has an article/example code for retrieving information through scripting.

    Here is the snippet of the code.

    // Prepare variables for a contact to retrieve.
    var contactid = "4696f8cb-9a1c-dd11-ad3a-0003ff9ee217";
    var authenticationHeader = GenerateAuthenticationHeader();
    
    // Prepare the SOAP message.
    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'>"+ 
    authenticationHeader+ 
    "<soap:Body>"+ 
    "<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ 
    "<entityName>contact</entityName>"+ 
    "<id>"+contactid+"</id>"+ 
    "<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"+ 
    "<q1:Attributes>"+ 
    "<q1:Attribute>fullname</q1:Attribute>"+ 
    "</q1:Attributes>"+ 
    "</columnSet>"+ 
    "</Retrieve>"+ 
    "</soap:Body>"+ 
    "</soap:Envelope>";
    // Prepare the xmlHttpObject and send the request.
    var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
    xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    xHReq.setRequestHeader("Content-Length", xml.length);
    xHReq.send(xml);
    // Capture the result.
    var resultXml = xHReq.responseXML;
    
    // Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    if (errorCount != 0)
    {
     var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
     alert(msg);
    }
    // Display the retrieved value.
    else
    {
    alert(resultXml.selectSingleNode("//q1:fullname").nodeTypedValue);
    }

    You can write this code on the onchange event of the attribute based on which you wish to auto-populate.

    Hope this helps you get going.

    Sam

  • xtzee Profile Picture
    on at

     HI,

    i did see this example from the SDK...

    the problem is, it gives me an error as to "the contact id does not exist"...

    what could the problem be... am i putting the code in the wrong place or what? please assist me... in telling me what am i doing wrong, also tell me where to put the code?

    Thank you!!

  • Inogic Profile Picture
    703 on at

    hi,

    You need to put this script on the Onchange event of the attribute based on which you would like to auto-populate the other attribute.

    The example in the sdk, they try to retrive the fullName of the contact that you have entered.

    I assume you want to auto-populate the Parent Customer based on the Contact selected.

    So you need to write the script on the Onchange event of the contact.

    Change the script above to read the Parent Account.

    Use the details from here to create a lookup array as explained in the post below.

    Hope this helps!

    Sam

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans