Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Capturing 'Read Only' Error for JavaScript Save Event

Posted on by Microsoft Employee

Hi,

I have a button on a form that when clicked will call the Xrm.Page.data.entity.save(); command followed by other code.

Somehow I have users that are finding themselves in a situation whereby they have the same record open twice, they close the record in one instance and then try to update it in another instance.  Of course, when they try to update a record that has already been closed, CRM presents them with the following error.

Error

The object cannot be updated because it is read-only.

I have tried using a 'Try' and 'Catch' to allow for the error and simply refresh the page if the record is closed but it is not working - the error is still being shown to users.

Is there another way that I can catch this error and stop my users seeing the standard CRM error message?

Many thanks

Rob

*This post is locked for comments

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Capturing 'Read Only' Error for JavaScript Save Event

    Hello,

    You can use this tool to build query - crmrestbuilder.codeplex.com

    As an example you can check this article - dynamicscrmgirl.wordpress.com/.../crm-2013-javascript-retrieve-record-using-odatarest-endpoint-without-jquery

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Capturing 'Read Only' Error for JavaScript Save Event

    Hi Andrii,

    Thanks for the reply.  I'm not overly technical, do you have an example of how I would achieve this using your method please?

    By the way, I am using Dynamics Online 2016 (if that makes a difference).

    Regards

    Rob

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Capturing 'Read Only' Error for JavaScript Save Event

    Hello,

    The only way I see is to retrieve current status of record from CRM using ednpoints, analyze it and based on this value continue with save if record is still updatable and exit if it is not.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans