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 :
Microsoft Dynamics CRM (Archived)

How to set Two Option Value (yes, no) CRM C#

(0) ShareShare
ReportReport
Posted on by

Hi everyone, 

I am developing a plugin that have registered a step in the Create's Entity.

I can't figured out how to set a two option set value when the logic' plugin ends.

My code is somethin like this:


var service = localContext.OrganizationService;

//Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null;
//Obtengo el contexto de la Entidad
Entity contextEntity = (Entity)context.InputParameters["Target"];

// if (!contextEntity.GetAttributeValue<bool>("tps_procesado"))
//{
PluginInitCreate(contextEntity, service);

contextEntity.Attributes["tps_procesado"] = true;
service.Update(contextEntity);
}
}

But whe the logic runs the two option value is not updated.

Someone could help me?

Regards,

Matias.

*This post is locked for comments

I have the same question (0)
  • ansrikanth Profile Picture
    3,115 on at

    Hi

    Thats exactly what we are also doing in our case and we never found it failed.

    Are you sure that it is not updating only this "Bool" field, Can you check with any other say text field ? is that updating ?

    On a different note, I didnt really get the plugin logic -- If I'm not wrong you are writing this on Pre create ? if so, Why dont you directly push the bool value in to the target entity and whcih eventually gets in to the Context automatically ?

    Sorry, If I misunderstood your question or logic, Out of interest i'm asking this question.

    Thank you

    -Srikanth

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks for answering I could fix the problem, I changed the step to Pre-operation and it worked, in consequence I had to delete de line of uptdate.

    Thanks!

    Matias.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans