Tuesday, June 2, 2020

How to Won, Lost or Reopen opportunity in Dynamic CRM using Web API


First here is a list of default value for Status and Status Reason for opportunity entity

State
Status Reason
0 : Open

1 : In Progress
2 : On Hold
1 : Won
3 : Won
2 : Lost
4 : Canceled
5 : Out-Sold



JSON Data for WinOpportunity

{
  "OpportunityClose": {
                                                // Replace Opportunity ID here
    "opportunityid@odata.bind": "/opportunities(346e5406-cea3-ea11-a812-000d3a3be645)",
    "actualend": "07/12/2020",
    "actualrevenue": 100,
    "description": "Your description here"
  },
  "Status": 3
}



JSON Data for LoseOpportunity

{
  "OpportunityClose": {
    "opportunityid@odata.bind": "/opportunities(346e5406-cea3-ea11-a812-000d3a3be645)",
    "actualend": "07/12/2020",
    "description": "Your description here"
  },
  "Status": 5
}

Re_Open 

Note the request method is Patch (Update) and not POST

Only one field to reopen again

{
  "statecode": 0
}


**Appointment in Dynamic CRM using Web API


No comments: