UI action visibility based on condition

DeepikaR1661877
Tera Contributor

Hello, 

 I need one requirement, the recruitment is when the "abc" user open the incident record if the user have the read access of the record they won't able to see the cancel UI action button, if the user having the write access of the record  then they can able to see the cancel ui action,,here i have create the one SI but it's not working any one help on this or can we added into Ui action ?

 

showResponseTaskButton: function(current, view, type) {
if (view == 'security_itil')
return false;
else if (view == 'nonit_security')
return false;
else if (view == '' && type == 'link')
return false;
else if (view == '' && type == 'context')
return false;
else if (current.active == true && (gs.hasRole('abc') ||gs.hasRole('xyz') || gs.hasRole('')test))
return true;
return false;
},

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@DeepikaR1661877 

so Cancel should be seen only when the logged in user has WRITE access to the record?

if yes then simply add this in the UI action condition field

Why are you checking role and view etc?

current.canWrite()

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

DeepikaR1661877
Tera Contributor

Hi @Ankur Bawiskar ,

yeah i has add the gs.hasRole('abc')&&current.canWrite() condition even it's not working user who have the both write & read can able see the ui action, if suppose i have write the below code(current.assignment_group.canWrite()😉 it's working ....it's checking the single field when the assignment group is having the write access it's working , having the read access it's not visible .but i need check full record,

@DeepikaR1661877 

if user has write access through your ACL then it's obvious that your ACL will allow read as well

so simply canWrite() should help

Didn't understand your requirement here

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

DeepikaR1661877
Tera Contributor

Hi @Ankur Bawiskar ,

There is simple requirement, if the user having the "abc" role, then they can able to see the Cancle Ui action if they have the write access of the record, for the same user have the read access then they won't able see the Ui action, that's it. initially i have done this one canWrite() , but it's not working.