Visibility of the button as per state

NishaB
Tera Expert

Hi,

 

For the Update button in the incident form, I want a task to be done. When the state of the incident record is New, In progress, On hold, Resolved the update button should be visible. For the closed and cancelled state, it has to be hidden. How it can be done? I want this to be implemented in both native view and SOW?

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@NishaB 

there is already OOB incident.None WRITE ACL that allows write if INC is not closed

You can create a new table.None WRITE ACL with condition as State NOT IN Cancelled

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

I apologize for the confusion, Nisha. A better way to access these UI Actions and their settings is by navigating to System Definition -> Tables -> Incident. Once in the table's file, use the header menu and navigate to Configure -> UI Actions. Every UI action you're hoping to edit will be in this list. The twist is that some of these Actions are pulled from other tables, such as [sys_db_object].

This is why @Ankur Bawiskar is suggesting an edit to ACL's instead, as editing these buttons will affect other tables that utilize them.

 

A more complicated solution would be to create new UI actions on the Incident table specifically, giving them the same properties as the ones currently used and implementing the visibility script discussed earlier. After creating these new buttons, you could disable the buttons pulled from other tables so that they are unaffected by your changes.

Best practices aside, implement the solution that best fits your situation. Just be aware of potential unwanted side effects, and take advantage of the 'Revert to Previous Version' function liberally.

Did this answer your question?



If I've at all helped, please return the favor by clicking the thumb next to my post. Thanks!

View solution in original post

6 REPLIES 6

I apologize for the confusion, Nisha. A better way to access these UI Actions and their settings is by navigating to System Definition -> Tables -> Incident. Once in the table's file, use the header menu and navigate to Configure -> UI Actions. Every UI action you're hoping to edit will be in this list. The twist is that some of these Actions are pulled from other tables, such as [sys_db_object].

This is why @Ankur Bawiskar is suggesting an edit to ACL's instead, as editing these buttons will affect other tables that utilize them.

 

A more complicated solution would be to create new UI actions on the Incident table specifically, giving them the same properties as the ones currently used and implementing the visibility script discussed earlier. After creating these new buttons, you could disable the buttons pulled from other tables so that they are unaffected by your changes.

Best practices aside, implement the solution that best fits your situation. Just be aware of potential unwanted side effects, and take advantage of the 'Revert to Previous Version' function liberally.

Did this answer your question?



If I've at all helped, please return the favor by clicking the thumb next to my post. Thanks!

PritamG
Mega Guru

you can achieve this by using UI Actions for the native view and client scripts for ServiceNow SOW (Service Operations Workspace).
for native view:

go to ui action and search for update button and modify it.
add a condition script like

 

 

!(current.state == 7 || current.state == 😎 // 7 = Closed, 8 = Canceled

 

 

for service operation workspace

create new client script

 

 

function onLoad() {
    if (gForm.getValue('state') == 7 || gForm.getValue('state') == 😎 {
        gForm.setVisible('update', false);
    }
}

 

 

This ensures the update button is hidden for Closed & Canceled states in both views.