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)

Prevent case resolution if activities are in draft/open status

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am aware that when resolving a case with open activities, the user gets a warning to say there are still open/draft e-mail activities on the case. They are given the option 'Confirm' and 'Cancel'. I want to prevent the user being able to click 'Confirm. In other words, I want to prevent case resolution if an open activity exists (and give the user no option but to close the activities).

Is there a way this can be done - especially without a plugin would be great.

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    "Is there a way this can be done - especially without a plugin would be great."

    your only way is a plugin (or build your own case resolution form hiding the standard button)

  • Verified answer
    MilindP Profile Picture
    1,019 on at

    Customize the Resolve button by using ribbon workbench and change the command to run below JavaScript the function as below 

    function btnResolve(){
           if(CanResolve())
            {
                //calling the native function
                Mscrm.CommandBarActions.resolve();
             }

    }

    Create a CanResolve function which is checking the open the activities, i am using XrmServiceToolkit for rest calls

    function CanResolve(){

       var ArrActivities = new Array();
       var CaseId = Xrm.Page.data.entity.getId();


        XrmServiceToolkit.Rest.RetrieveMultiple(
        "IncidentSet",
        "?      $select=incident_activity_parties/ActivityId,Incident_ActivityPointers/ActivityTypeCode,Incident_ActivityPointers/StateCode,Incident_ActivityPointers/StatusCode&$expand=incident_activity_parties,Incident_ActivityPointers&$filter=IncidentId eq guid' " + CaseId +"'",
    function (results) {
    for (var i = 0; i < results.length; i++) {
    ArrActivities.push(results[i]);

    }
    },
    function (error) {
    alert(error.message);
    },
    function () {
    //On Complete - Do Something
    },
    false
    );

    if (ArrActivities.length > 0) {
         //Check if any activity with status Open
         var ActivityItems = ArrActivities[0].Incident_ActivityPointers.results;

         for (i = 0; i < ActivityItems.length; i++)

                {
                    if (ActivityItems[i].StateCode.Value == 0) {
                       return false;

                         }
                 }
     }
    return true;

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    A way to do the resolution in a custom resolution Dialog and avoid JS is as follows.

    Create a CaseID variable to get the Case

    Query.jpg

    For some reason to pass the Case to itself you need to add the following Assign step

    1447.a.jpg

    Add the following CRM Query Step

    752512.1.jpg

    Click the "Modify Query Tab" so you can pass in the current CaseID

    Query.jpg

    Then add a check that the result of the query is greater than 0 (here is the full Dialog)

    dialog.jpg

     There are many other posts that explain how to link up a Dialog using the Ribbon Workbench

  • venkatsr Profile Picture
    User Group Leader on at

    1) Write an  rules for enable /disable confirm.

    2) javascript api call to get activities active for attached case, if >1 then return true. Disable Confirm button.

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 April 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