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

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Incident Entity PriorityCode type - Error to set Int32 value.

(0) ShareShare
ReportReport
Posted on by 20

Hello:

I need to insert a value to the prioritycode field of Entity Incident

caso.Attributes["prioritycode"] = 2;

In docs.microsoft.com this is the type of prioritycode

prioritycode Edm.Int32

Select the priority so that preferred customers or critical issues are handled quickly.

Display Name: Priority

Default Options
TABLE 19
Value Label
1 High
2 Normal
3 Low

When I go to insert I get this error

Incorrect attribute value type System.Int32

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Incident Entity PriorityCode type - Error to set Int32 value.

    Hi 

    You need to change this line:

    caso.Attributes["prioritycode"] = 2;

    To:

    caso.Attributes["prioritycode"] = new OptionSetValue(2);

    Because it is an option set the type must be OptionSetValue, not int.

    pastedimage1626335377514v1.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 100 Super User 2025 Season 2

#2
Suresh Kulla Profile Picture

Suresh Kulla 72 Super User 2025 Season 2

#3
DAnny3211 Profile Picture

DAnny3211 54

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans