I am trying to restrict closing a RITM or REQ manually unless you have the role of admin

Jon M3
Tera Expert

I am trying to restrict closing a RITM or REQ manually unless you have the role of admin because we have users that will close them and leave tasks in an open state.  Any thought?

4 REPLIES 4

Musab Rasheed
Tera Sage
Tera Sage

Hi Jon M,

First hide 'Closed Complete' buttons for Non admins, second remove 'Closed Complete' option from state dropdownlist for non admins using Onload Client script.

Mark my answer as correct or hit like based on impact.

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Palak Gupta
Tera Guru
Tera Guru

Hi,

You can try any of the below options:

1. You can make state field as read-only for non-admin users.

OR

1. You can also have a check on Request/RITM form that would check if SCTASK is in closed state.

Regards,

Palak

shloke04
Kilo Patron

Hi,

This is not the correct approach to restrict this as RITM and Req should get automatically closed when some one close the catalog task.

But in your case since people are directly closing the RITM and REQ without closing the catalog task, you need to stop them from closing it and check for any open catalog task if any.

So write a Before Update business rule on Requested item table and use the script as below:

This BR will not allow users to complete the RITM and will have to close the task first as you need and is a better approach in this scenario

BR Details:

Table Name: Requested item(sc_req_item)

When: Before Update

Condition: State Change to Closed Complete

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord('sc_task');
	gr.addQuery('request_item',current.sys_id);
gr.addEncodedQuery('stateIN-5,1,2');
	gr.query();
	if(gr.next()){
		gs.addErrorMessage('Catalog task are still open');
		current.setAbortAction(true);
	}

})(current, previous);

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Brian Lancaster
Tera Sage

Do you see a scenario were an admin would need to close a RITM or a REQ. If not I would just do a UI Policy with no conditions to make state read only. Then make sure there is a list edit ACL for state that always returns false.