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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Add custom Attribute to custom Entity

(0) ShareShare
ReportReport
Posted on by 45

Hi, Experts!

I create new Entity - nav_role

It has Attribute - "nav_rolecode" with Type - Set of Parameters. (in Web interface you can select the desired option from the drop down list).

Each Parameter has Label and Value - so how can I set this Attribute in c#?

for example - i tried this:

Entity NavRole = new Entity("nav_role");
    NavRole.Attributes["nav_systemuserroleid"] = new EntityReference("systemuser", FindUID);
    NavRole.Attributes["nav_validfrom"] = DateTime.Today;
    NavRole.Attributes["nav_rolecode"] = "808630010";
   

"808630010" it's a Value of Parameter in Set of Parameters. So it  doesn't work - for "nav_rolecode"

Help me please with this....

I have the same question (0)
  • Verified answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi

    In case of optionset you need to pass value in OptionsetValue in c# code.

    Please refer below code:

    NavRole.Attributes["nav_rolecode"] = new OptionSetValue(808630010);

  • NickGrava Profile Picture
    45 on at

    Great Thnx!

    It work!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans