Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to set two option field from code activity

(1) ShareShare
ReportReport
Posted on by 1,558

Hello Team,

I want to set two option control from the code activity by the workflow.

Please send me the correct way.I need to change it by the C# code.

*This post is locked for comments

  • Suggested answer
    Jharana Baliyar Singh Profile Picture
    Jharana Baliyar Singh 2,665 on at
  • Tin Profile Picture
    Tin 1,558 on at
    RE: How to set two option field from code activity

    Thanks for reply.
    I want set value of two option set control from C# code via a cutome code activity.

  • Aileen Gusni Profile Picture
    Aileen Gusni 44,524 on at
    RE: How to set two option field from code activity

    Hi Rahul,

    It might help you

    community.dynamics.com/.../136016

    if you need Boolean (both input and output)

    *For Input & output

    [Input("bool input")]

    [Output("bool output")]

    public OutArgument<bool> outBool{ get; set; }

    Output only:

    [Output("bool output")]

    public OutArgument<bool> outBool{ get; set; }

    To set:

    this.outBool.Set(context, true); //if true

    this.outBool.Set(context, false); //if false

    Hope this helps.

    Thanks.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: How to set two option field from code activity

    Hello,

    Assuming you want setup output argument to set two optionset, you need to define boolean property.

    other wise you can simply set entityobject["fieldname"]=true;

    For output:

    [Output("Response")]

    public OutArgument<bool> ResponseParameter { get; set; }

    then you can set this parameter using following code

    ResponseParameter.Set(executionContext, true);

    Now this argument will be available under form assistant while destining workflow

    you can refer our post:mahenderpal.wordpress.com/.../step-by-step-creating-custom-workflow-in-microsoft-crm-2011 for how to work with custom workflow

    Thanks

  • Suggested answer
    Royal King Profile Picture
    Royal King 27,686 on at
    RE: How to set two option field from code activity

    You have to set value as Boolean value  like true or false

    Sample code to set two option set value

    entity.Attributes["attributename"] = true;

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans