Notifications
Announcements
No record found.
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
Hello,What product line are you using here?
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
Thank you for letting me know what product line you are using. I will be moving this post to the CRM product forum.
Thanx that will be ma pleasure
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
Thanx 'will do that
Hi Sam
I never use webservices and i have try the whole day to figure it out but ......... with no success
thanx in advance
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.
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!!
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!
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2