Activate Order button is not working on Order Entity in UCI | CloudFronts

Activate Order button is not working on Order Entity in UCI

Introduction:

This blog explains an alternative approach to Activate an Order in UCI.

Scenario:

We are using Prospect to Cash solution to integrate Sales Order from Sales to Operations (CRM To Operations). In UCI Activate Order button is not working which is used for Order Integration. In this blog we will see an alternative approach to achieve this.

Pre-Requisites:

  •    D365 Sales
  •    Microsoft Flow

Steps to be followed:

Dynamics 365 –

1. Create Custom “Activate Order” button in UCI.

2. Add below JavaScript code which will trigger on Click of “Activate Order” Button.

(This code will take the Order Guid and pass it to the http post request)

Refer this blog to understand more about HTTP Post Request using Microsoft Flows: https://www.cloudfronts.com/http-post-requests-using-microsoft-flows/

// JavaScript source code
CallMSFlowsToActivateOrder: function () {
    var entityGuid = Xrm.Page.data.entity.getId();
    entityGuid = entityGuid.replace("{", "").replace("}", "");

    var data = JSON.stringify({
        "OrderID": entityGuid
    });

    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
        if (this.readyState === 4) {
            console.log(this.responseText);
        }
    });

    var xhr = new XMLHttpRequest();
    xhr.open("POST", "URL Created From MS Flow", true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(JSON.stringify({
        "OrderID": entityGuid
    }));
} 

Microsoft Flow:

1. Create Flow from Blank.

2. Select the Http request is received trigger.

3. Add below in Request body JSON Schema

4. Add Get Record Trigger of Dynamics 365. In Item identifier pass the OrderId from the Dynamic Content.

5. List all related Sales Order Product of that Order.

6. Add apply to each control and update the value of Order is Active field.

7. Update the Processing state field of Order entity.

Overall Flow:


Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close