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)

Unable to update records using XRMService Toolkit

(0) ShareShare
ReportReport
Posted on by 3,634

I have following code snippet to update a certain record using XRMServiceToolkit but it throws exception as well. I could not find out the reason. any idea what I am missing in it.

function updateOrderStatus(){
var orders = XrmServiceToolkit.Soap.Fetch(query);

var value = Xrm.Page.getAttribute(attr);
var osId = orders[0].attributes['new_testid'];
var update = new XrmServiceToolkit.Soap.BusinessEntity("new_test", osId);

update.attributes["new_assignedto"] = { id: value.getValue()[0].id, logicalName: 'systemuser', type: 'EntityReference' };
update.attributes["new_assignedtodate"] = { value: new Date(), type: "DateTime" };

var result = XrmServiceToolkit.Soap.Update(update);
}


Exception:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter schemas.microsoft.com/.../Services:request. The InnerException message was 'There was an error deserializing the object of type Microsoft.Xrm.Sdk.OrganizationRequest. The value '[object Object]' cannot be parsed as the type 'Guid'.'.  Please see InnerException for more details.


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    It's definitely better to troubleshoot your code using debugging tools but one line looks suspicious:

    try to replace line

    var osId = orders[0].attributes['new_testid'];

    with line

    var osId = orders[0].attributes['new_testid'].id;

  • Mohsin Ali Profile Picture
    3,634 on at

    I tried with .id but it pass 'undefined' to osId

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Then I have no other suggestions than - good luck learning how to troubleshoot JavaScript - blogs.msdn.microsoft.com/.../debugging-custom-javascript-code-in-crm-using-browser-developer-tools

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