Dynamics 365 Code - Fırsat Kazanma - Kaybetme (C#)


Fırsat Kazanma

            IOrganizationService crmService = CrmManagerStatic.GetCrmServiceCredential(CRMOrganization.CRM);

            Entity OpportunityClose1 = new Entity("opportunityclose");
            OpportunityClose1["opportunityid"] = new EntityReference("opportunity", new Guid("Opportunity GuId "));
            OpportunityClose1["subject"] = "Won the Opportunity";
            crmService.Create(OpportunityClose1);

            WinOpportunityRequest winQuoteRequest = new WinOpportunityRequest()
             {
                 OpportunityClose = OpportunityClose1,
                 Status = new OptionSetValue((int)OpportunityState.Won)
             };
            crmService.Execute(winQuoteRequest);


Fırsat Kaybetme

 IOrganizationService crmService = CrmManagerStatic.GetCrmServiceCredential(CRMOrganization.CRM);

            Entity OpportunityClose1 = new Entity("opportunityclose");
            OpportunityClose1["opportunityid"] = new EntityReference("opportunity", new Guid("Opportunity GuId "));
            OpportunityClose1["subject"] = "Lose the Opportunity";
            crmService.Create(OpportunityClose1);
            LoseOpportunityRequest request = new LoseOpportunityRequest()
              {
                  OpportunityClose = OpportunityClose1,
                  Status = new OptionSetValue((int)OpportunityState.Lost)
              };
            crmService.Execute(request);

Hiç yorum yok:

Yorum Gönder