Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Reopen lost/won opportunity using C# without mentioning specific Opportunity StatusReason

$
0
0

Hello

I'm working on a plugin which needs to update opportunity field, but before updating the opportunity record I'm checking if the opportunity is open, if not I need to reopen it ( like we reopen it manually using ribbon button) without mentioning the status reason as there is another process which changes manually reopened opportunity's status reason.

if (IsOpportunityClosed(opportunityRef.Id, localcontext))

{
 /* Reopen the Opportunity record */
 SetStateRequest openOpp = new SetStateRequest();
 openOpp.EntityMoniker = opportunityRef;
 openOpp.State = new OptionSetValue(0);
 openOpp.Status = new OptionSetValue(100000044);
localcontext.OrganizationService.Execute(openOpp);

}


In, above code I'm using 100,000,044 as status. I'm wondering is there a way to reopen Opportunities without setting value of Status? Thanks in advance.


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>