Skip to main content

Notifications

Dynamics 365 general forum
Answered

When update a record, type value is sending null

Posted on by 50

Hi everyone,

I have a plugin and the plugin check type field. If type value is equals to 0 or 3, there are two decimal field and they should be not empty. When I update the decimal field to null and there is no update on the type field at the same time, option value is null in plugin. Why is that reason? 

Thanks. 

Categories:
  • Efnan Profile Picture
    Efnan 50 on at
    RE: When update a record, type value is sending null

    Thank you Mahen, it works!

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,041 on at
    RE: When update a record, type value is sending null

    Hi,

    In your plugin entity collection you will only get the dirty fields so as user is not doing any changes you won't get the type field.

    You need to register a preimage in your plugin where you need to add your type field, and in your code check if the type field is available in the entity collection get it from there (means user updated this field) and it this field is not there get it from the preimage ( it will be always there) so it will be something like below

    if (pluginContext.PreEntityImages.Contains("preimage"))

               {

                   preimageobject = pluginContext.PreEntityImages["preimage"];

               }

    if(yourentityobject.contains("yourtypefieldname")

    {

    //get type from the entity collection which you are doing currently

    }

    else if(preimageobject .contains("yourtypefieldname")

    {

    //get type from the preimage.

    }

    You can refer this post for how to work with plugin images: carldesouza.com/.../

    let me know if you need more details on this.

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans