Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Need to Restrict the usage of "Closed" state for incidents in List view (only closed state)

PavithraDeB
Tera Contributor

Please do help me to clarify below concerns.

Requirements: Need to Restrict the usage of "Closed" state for incidents in List view (only closed state)

Through a client script i can achieve it in legacy view but the ame doesnot applies to Service operation workspace

function onCellEdit(sysIDs, table, oldValues, newValue, callback){
var saveAndClose = true;
if(newValue == 7)
alert("You cannot change the State value to 'Closed' from a list view");
saveAndClose = false;
callback(saveAndClose);

}
while exploring, i could notifce that the oncell edit will not work in SOW (Not sure , may be there is a way)


Any help would be greatly appreciated.
PavithraDeB_0-1773848101831.png

 


PavithraDeB_1-1773848101814.png

i wanted this restriction only for closed state in LIST EDIT and not in form level.
Thank you 

3 REPLIES 3

Tanushree Maiti
Tera Sage

Hi @PavithraDeB 

 

To restrict updating incident states to "Closed" state from the List View in Servicenow, use 

 

1. Create a list edit ACLon incident

    • Type:list_edit 
    • Operation: list_edit
    • Table: Incident 
    • Field: State

sample screen shot:

TanushreeMaiti_0-1773850826981.png

 

2. Using OnCellEdit Client Script .

TanushreeMaiti_1-1773850889685.png

 

refer: https://www.servicenow.com/community/itsm-forum/edit-in-list-view-allowing-users-to-close-incident/t...

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

@Tanushree Maiti 

the question is for SOW and not for native.

I could see in my PDI the onCell Edit and list_edit ACL approach doesn't work in SOW list.

It would be nice if you could share working screenshots as well for your points which worked for you.

This will help members reach answer quickly

 

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@PavithraDeB 

Few Approaches

Approach 1

you can use before update BR on that table and stop the update using current.setAbortAction(true) if state Changes to Closed

Output: BR is stopping the update, enhance the condition

before update BR to stop list edit on incident state.gif

Note:

-> list_edit ACL won't be stopping editing field in SOW List

-> on cell edit doesn't work in SOW list

Approach 2 -> Another way is disable list editing for all fields at the UX List level

-> go to this table "sys_ux_list" and search your list

-> check the checkbox for "Hide Inline Editing"

check this link as well which talks about SOW

How to enable Inline Editing for this list? 

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader