We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to call script include in UI Action for task table

Rama26
Tera Contributor

Hi All,

UI Action button i developed on task table. at that time i given some condition to display that button. now i am moving that condition to script include and call script include in ui action. but it's not working properly.

var test = Class.create();
test.prototype = Object.extendsObject(AbstractAjaxProcessor, {

UIAction: function() {

if ((current.request_item.cat_item == '9dce7cf41b2201104c51ed75604bcb69' || current.request_item.cat_item == '90179b371b6201104c51ed75604bcb70') && (current.state == '2' || current.state == '3')) {

}
},


type: 'test'
});

find_real_file.png

1 ACCEPTED SOLUTION

Hi Rama,

 

You need to make three changes to your scripts.

1. In UI Action - condition::  new test().UiAction(current);

2. In Script Include: 

  - line #4-  UiAction: function(current){

  - line #7 - return true;

 

Regards,

Snehangshu Sarkar

 

Please mark my answer as correct if it resolves your query.

View solution in original post

5 REPLIES 5

Hi Rama,

 

You need to make three changes to your scripts.

1. In UI Action - condition::  new test().UiAction(current);

2. In Script Include: 

  - line #4-  UiAction: function(current){

  - line #7 - return true;

 

Regards,

Snehangshu Sarkar

 

Please mark my answer as correct if it resolves your query.