Notifications
Announcements
No record found.
Hi Guys,
I m writing a plugin in which is need to check weather oppurtunity is open , close , won or lost .
pls help
Thsnks
*This post is locked for comments
Check Status(statecode) and Status Reason(statuscode) field values in your plugin.
Values can be found from this link
https://technet.microsoft.com/en-us/library/dn531157.aspx
can you give me C# code to check weather oppurtunity is closed or open
get the opportunity entity record store it in a variable (for ex. objOpp).
if(objOpp.GetAttributeValue<OptionSet>("statecode").Value == 1)
{
//opp is won
}
Hi,
Try the code below.
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) { // Obtain the target entity from the input parameters. Entity entity = (Entity)context.InputParameters["Target"]; // Verify that the target entity represents an opportunity. // If not, this plug-in was not registered correctly. if (entity.LogicalName != "opportunity") return; try { int stateCode = GetAttributeValue<OptionSetValue>("statecode").Value; if(stateCode == 0) { //Open Opportunity } if(stateCode == 1) { //Won Opportunity } if(stateCode == 2) { //Lost Opportunity } } }
Hope this helps.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2