Display Info message only on list layout

G Balaji
Kilo Guru

Hello,

I have a " before query" business rule that displays info message.

Before query business rule configuration is,

When:                            Display Query

Advanced tab:

 

var c='Use * to search';
gs.addInfoMessage(c);

 

The issue is the info message has to be limited only to list view and not to the form view and this message has to be displayed only for a particular table's list view. How do I implement this?

 

 

Regards,

Balaji

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Balaji,

In the script section take the URL of the page and check whether it is form view or list view

script:

var index = gs.action.getGlideURI().toString().indexOf('u_sample_table_list');

if(index == -1){

// it means it is form

}

else{

// it means it is list

}

the above will tell whether the url is for list or form since for list view it would be tablename_list

also I believe you must have written this query business rule on particular table; if not then in script you can check table name also

similarly using the indexOf

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Balaji,

In the script section take the URL of the page and check whether it is form view or list view

script:

var index = gs.action.getGlideURI().toString().indexOf('u_sample_table_list');

if(index == -1){

// it means it is form

}

else{

// it means it is list

}

the above will tell whether the url is for list or form since for list view it would be tablename_list

also I believe you must have written this query business rule on particular table; if not then in script you can check table name also

similarly using the indexOf

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

G Balaji
Kilo Guru

That resolved my issue. Thanks for the tip, Ankur.