web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Activity panel stays stuck in loading state after call custom action through Web API

(0) ShareShare
ReportReport
Posted on by 75

Hello everyone!

I'm facing this issue:

I modified the Resolve and Cancel case buttons in the incident ribbon to show custom modal window, where the users have to select a reason and write a description for the action (resolve or cancel) they're doing. I'm using Xrm.Internal.openDialog to open the modal window.

For the cancel action, I've created a custom activity for showing it in the activity panel of the incident form. Also, I've created a custom action to create this activity and change the incident state to cancelled. I call this action, and the 'CloseIncident' action (for resolving the case), within js script as follows:

For cancel:

function cancelIncident(closeParams) {
    var incidentId = Xrm.Page.data.entity.getId();
    incidentId = incidentId.replace(/[{}]/g, "");

    var parameters = {
        subject: closeParams.reasonText,
        description: closeParams.description
    };

    var req = new XMLHttpRequest();
    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents(" + incidentId + ")/Microsoft.Dynamics.CRM.uit_cancelIncident", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 204) {
                Xrm.Page.ui.refreshRibbon();
                Xrm.Page.data.refresh();
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send(JSON.stringify(parameters));
}

For resolve:

function resolveIncident(closeParams) {
    var incidentId = Xrm.Page.data.entity.getId();
    incidentId = incidentId.replace(/[{}]/g, "");
    var incidentresolution = {
        "subject": closeParams.reasonText,
        "incidentid@odata.bind": "/incidents(" + incidentId + ")",
        "timespent": 0,
        "description": closeParams.description
    };

    var parameters = {
        "IncidentResolution": incidentresolution,
        "Status": 5
    };

    var req = new XMLHttpRequest();
    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/CloseIncident", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 204) {
                Xrm.Page.ui.refreshRibbon();
                Xrm.Page.data.refresh();
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send(JSON.stringify(parameters));
}

As you can see, I call the actions via WEB API, and refresh the ribbon and data as success actions. Everythings works good, but when I want to see the actitivies created by these to actions (in the Activity tab of the social pane), says 'Loading...' and stays stuck. The following image shows what I've said (it's in spanish):

5037.2.PNG

If I refresh the browser, or click at 'Order by' icon on the activity tab, shows the activities. 

Anyone has experienced this?

The CRM version is Dynamics 365 8.2.2 On Premise.

Thanks in advance!

*This post is locked for comments

I have the same question (0)
  • Hugo G. Morillo Profile Picture
    75 on at

    Any ideas?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans