Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Not able to update a locked field by plugin after v9 upgrade

Posted on by Microsoft Employee

In v8.2, I had a pre-op plugin that would update a few of of the locked fields on the quote entity (freight, tax, for example). Once we upgraded to version 9, those fields no longer update. The plugin doesn't throw any exceptions, and if I point the plugin to custom temp fields, it shows the calculations that the plugin is doing is in fact happening, it just can't update those locked fields anymore. Is there anything I can do about this?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Just update, not create. There are quote lines as part of the quote. The tax field does update if I turn off system pricing calculations; but that means all calculations, and we're not currently custom calculating any others. In 8.2, that setting is turned on as well, but it works fine there.

  • Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Is the plugin just running on Create requests or on Update as well? Are any quote lines being created alongside the Quote itself?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Thanks David - audit does in fact show that. My plugin updates the record, CRM flips it back to a default value. I changed to a post op plugin, and it still happens.

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    If you enable auditing, this may help understand what is happening, especially whether your changes are being overwritten. The system changes should be recorded, though note that some of them may show as updates via a Read operation (this is just how the internal processes work)

  • Suggested answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    I think we've seen this before and it's due to something else in the chain of plugins that results in those fields being recalculated again some time after you set the values in the pre-op stage. I also remember a previous example which was not quite the same where the quote was being recalculated as a quote line was added (this was especially true where a quote was being re-created).

    It's also worth remembering that how various items work was significantly changed between 8.2 and 9.0. Many things that were done within the system itself in 8.2 are now done via plugins in 9.0

    While I know it's not an ideal solution my advice would be to see if you can move the plugin into post-operation mode so that you can be sure nothing is trying to override your request.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    The plugin is getting triggered, I'm writing out a debug line after most of the code lines, and I have a test harness to let me step through the code. It steps on the lines that set the values of the entity, and exits without error. In fact, just found there is a separate plugin that tries to update the OOB freight field that is behaving the same way.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Can you share the plugin code if possible? Did you check if the plugin is even getting triggered?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Thanks Ravi - I checked all the biz rules, nothing setting those fields required. Nor any js is setting them.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Not able to update a locked field by plugin after v9 upgrade

    Hi,

    This can't be true as locking of the fields happens on client side whereas plugin runs on server side. Do you have any check/ condition which update the field? If the plugin is triggering then it will update the field irrespective if those are locked

    Are you making these field locked by business rule? If yes, does this business rule have scope as "Entity". If yes then this could be something which is changed in v9 and causing plugin to not update the locked fields.

    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.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans