web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Ms Dynamics CRM Plugins Auto Update field based on optionset values

(0) ShareShare
ReportReport
Posted on by 67

Hi Experts,

I have a requirement 

I have 2 optionset fields resolution and satisfied in Case entity 

if both fields are set to 'yes' then new_caseStatus optionsest field should be updated to Closed

I have the same question (0)
  • Verified answer
    ajyendra Profile Picture
    1,738 on at

    Hi,

    To fetch all columns use

    ColumnSet = new ColumnSet(true); as you already Use.

    Now if a field does not contain a value, CRM will not return it.

    You can verify it using

    act.Contains("columnName")

    If it returns true that means the value is present, if false, that means the field is null.

    how to do the contains condition. Refer docs:

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/tutorial-update-plug-in

    As my suggestion you can use only that columns you need by using like this:

    new ColumnSet("firstname", "lastname", "contactid"); because Retrieving all columns for an entity can have a negative impact on performance

  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    which part of the code?

    If the field you wanted to retrieve doesn't contain any value, system will not retrieve it.

  • rishireddy220 Profile Picture
    67 on at

    Thanks Ajyendra Singh,

    I"m new to technical

    Can u please help me in how to write a code for this requirement

    or

    any reference regarding condition satisfying syntax's 

  • Suggested answer
    ajyendra Profile Picture
    1,738 on at

    After retrieve record get both value as per the below link

    https://crm365blog.wordpress.com/2018/05/29/get-set-field-values-in-c-javascript-and-utility-functions/

    After getting both value then check if both value is Yes through if condition (value you get from below code is that optionset value which you set when you create optionset liek for Yes (100000000) for No (10000001) which I Set for my optionset)

    then after than you have to update by using
    inside that if condition
    Entity entIncident = new Entity("incident");
                entIncident["incidentid"] = new Guid("21cb74e2-6254-e811-80dc-005056be7607"); // put here your incidentid 
    entIncident["new_caseStatus"] = new OptionSetValue(0); // you have to put the value of Closed in OptionsetValue 
    Go to setting -> Customization -> Component->Entities->Cases-> Fields-> then select the new_caseStatus field
    pastedimage1571209396819v1.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 37

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans