Condition Help

yoli1
Tera Contributor

 

 

 

 

 

 

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@yoli1 

I already replied to your earlier question but it seems you deleted that.

you can use script include and handle this

What did you try so far and what didn't work?

 

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

Hi @Ankur Bawiskar i just cant seem to add my condition to the condition field because it is long what is you suggestion? thank you!!

@yoli1 

to make it short you can use hasRole with multiple roles passed at once

!ListProperties.isRelatedList() && !ListProperties.isRefList() && (ListProperties.getTable() != "sys_user" || ListProperties.getTable() != " u_user_account " || ListProperties.getTable() != " u_application_user_group" || ListProperties.getTable() != " u_m2m_appl_user_account_to_group " ||gs.hasRole("admin","user_admin","user_editor"))

To add further condition if it's not possible you can create a script include and add that condition there and call it

 

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

@Ankur Bawiskar should my script include be like this ?

var ListPropertiesCondition = Class.create();
ListPropertiesCondition.prototype = {
    initialize: function () {},

    isConditionMet: function (listProperties) {
        return (
            !listProperties.isRelatedList() &&
            !listProperties.isRefList() &&
            (listProperties.getTable() != "sys_user" ||
            listProperties.getTable() != "u_user_account" ||
            listProperties.getTable() != "u_application_user_group" ||
            listProperties.getTable() != "u_m2m_appl_user_account_to_group" ||
            gs.hasRole("admin") ||
            gs.hasRole("user_admin") ||
            gs.hasRole("user_editor"))
        );
    },
};