locked
XrmServiceToolkit Help with SOAP RRS feed

  • General discussion

  • var request = "<request i:type=\"a:RetrieveRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"><a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\"><a:KeyValuePairOfstringanyType><b:key>Target</b:key><b:value i:type=\"a:EntityReference\"><a:Id>604e43ed-7d63-e411-88fc-9cb6548d72f4</a:Id><a:LogicalName>contact</a:LogicalName><a:Name i:nil=\"true\"/></b:value></a:KeyValuePairOfstringanyType><a:KeyValuePairOfstringanyType><b:key>ColumnSet</b:key><b:value i:type=\"a:ColumnSet\"><a:AllColumns>true</a:AllColumns><a:Columns xmlns:c=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/></b:value></a:KeyValuePairOfstringanyType></a:Parameters><a:RequestId i:nil=\"true\"/><a:RequestName>Retrieve</a:RequestName></request>";
    
    
                //var whoAmI = XrmServiceToolkit.Soap.Execute(request);
               // whoamiUserId = whoAmI.getElementsByTagName("a:Results")[0].childNodes[0].childNodes[1].text;
    			
    			var resultXml = XrmServiceToolkit.Soap.Execute(request);
    			var buid = resultXml.getElementsByTagName("a:Results")[0].childNodes[0].childNodes[1].text;
    
    //Please tell me how do i get lastname value from buid? any other  way?
    	
    
    //SOAP using retrieve - retrieving Lastname from account entity
    
    
        var cols = ["lastname"];
        var retrievedContact = XrmServiceToolkit.Soap.Retrieve("account", buid, cols);
        var buName = retrievedContact.attributes['lastname'].value;
    	alert(buName); //I get undefined Error

    Thursday, November 27, 2014 10:44 AM

All replies

  • Update : Can anyone tell me how to retrieve last name of Account from Contact Entity Using SOAP? Just a small Example

    would this work?

       XrmServiceToolkit.Soap.Retrieve("account", buid, cols);

       var LastName = retrievedContact.attributes['lastname'].value;

    Thank you

    Friday, November 28, 2014 6:43 AM
  • Hi Sreekanth,

    I don't think we have a lastname field in Account form in CRM. Did you create any custom field? If you want the account name in Contact form then you can just read the Account Control.

        var lookupObject = Xrm.Page.getAttribute("yourlookupattributename");
        if (lookupObject != null) {
            var lookUpObjectValue = lookupObject.getValue();
            if ((lookUpObjectValue != null)) {
                var lookuptextvalue = lookUpObjectValue[0].name;
                var lookupid = lookUpObjectValue[0].id;
            }
        }

    Regards,

    Gopinath.


    Friday, November 28, 2014 12:54 PM
  • https://xrmservicetoolkit.codeplex.com/wikipage?title=Soap%20Functions

    last name need to be added into the column list.

    regards

    Jithesh

    Saturday, November 29, 2014 3:25 AM