How to Prevent Users From Moving a Case to a Resolved Status Until the Resolution Has Been Entered in Creatio

In this article I’ll be showing you how to stop a case from being resolved until a user fills out a resolution in Creatio. All it takes is a few steps with adding to the page attributes and methods. The concept is that we’ll store the current case status in an attribute. Then, in a change event for the case status, we’ll check if the status is changing to resolved. If no resolution notes have been added, we’ll set the status back to what it was originally (which is stored in the attribute). Let’s go through the steps to make this work.

First we will need to add a change event for case status and a custom object to the case page attributes. The “StatusChange” attribute is just a normal attribute to wire up the change event. The second attribute is where we will store the current status value. We need this so if the validation fails, we can set it back to what it was before the change. It will look something like this.

attributes: {
	"StatusChange": {
		dependencies: [{
			columns: ["Status"],
			methodName: "onStatusChange"
		}]
	},
	"CurrentStatus": {
		dataValueType: Terrasoft.DataValueType.CUSTOM_OBJECT
	}
}

After that we will then add our functions to the page methods. I’ll explain what the functions are doing below.

methods: {
	onEntityInitialized: function() {
		this.callParent(arguments);

		this.set("CurrentStatus", this.get("Status"));
	},

	onStatusChange: function() {
		var status = this.get("Status");
		var resolution = this.get("Solution");
				
		if (status.displayValue == "Resolved" && !resolution) {
			Terrasoft.showInformation("You must enter a resolution on the Closure and Feedback tab before changing the case to resolved");
			this.set("Status",  this.get("CurrentStatus"));
		}
				
		this.set("CurrentStatus", this.get("Status"));
	}
}

 

We’ll first use the onEntityInitialized function to get the current status of the case and put it’s value in our “CurrentStatus” attribute as soon as the case page is opened (we’ll need that value for later). We then create the “onStatusChange” function. What this is doing is every time the case is moved to resolved we are checking to see if the resolution is filled in or not. If the resolution is not filled in then we’ll display a message on the screen to let the user know they must have a resolution to be able to move the case to resolved and then we’ll move the case back to where it was originally by setting the case status with it’s old value before it was moved (we have the old value saved in our “CurrentStatus” attribute). But if the user does have a resolution then we’ll do nothing but set the “CurrentStatus” attribute with our new status value.

The end result is that if the user clicks “Resolved” on the case workflow bar at the top of the page, and the resolution notes is not yet filled in, they will get the popup message and it will be back on the status it was originally.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!