Microsoft Dataverse - A Template for Close Opportunities as WON or LOST
Learn how to effectively manage your opportunities by utilizing this template designed for closing opportunities as either won or lost. By leveraging this template, you can accurately handle the close opportunities.
Use the following steps to copy and paste the below template into the COZYROC JavaScript Task/Component.
1 - Drag and Drop the COZYROC JavaScript Task into the Control Flow canvas or the COZYROC JavaScript Component into the Data Flow canvas. Select REST Web Service Request Task from the drop-down list for the option Choose a pre-built script and click on the OK button, as shown in the below screen capture:
2 - Copy the below parameterization template code:
Close Opportunity as LOST
- <?xml version="1.0" encoding="utf-16"?>
- <Parameters>
- <RestConnection>Dataverse</RestConnection>
- <Method>POST</Method>
- <Url>/LoseOpportunity</Url>
- <IsBodyFile>False</IsBodyFile>
- <Body>
- <![CDATA[{
- "OpportunityClose": {
- "opportunityid@odata.bind": "/opportunities([opportunityGuid])",
- "actualrevenue": "provide actual revenue",
- "description": "provide description",
- "statecode": "2"
- },
- "Status": "4 = Cancel, 5 = Out-Sold"
- }
- ]]>
- </Body>
- </Parameters>
Close Opportunity as WON
- <?xml version="1.0" encoding="utf-16"?>
- <Parameters>
- <RestConnection>Dataverse</RestConnection>
- <Method>POST</Method>
- <Url>/WinOpportunity</Url>
- <IsBodyFile>False</IsBodyFile>
- <Body>
- <![CDATA[{
- "OpportunityClose": {
- "opportunityid@odata.bind": "/opportunities([opportunityGuid])",
- "actualrevenue": "provide actual revenue",
- "description": "provide description",
- "statecode": "1"
- },
- "Status": "3"
- }
- ]]>
- </Body>
- </Parameters>
And then click on the Paste button in the COZYROC JavaScript Task/Component, as shown in the below screen capture:
Note: Make sure that the parameter Method is set to POST