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

Snehangshu Sark
Mega Guru

Hi Rama,

 

 

Your condition is correct. The issue is - test() is client callable. Uncheck the 'client callable' box on your script include. It doesn't extend GlideAjax, and the condition field is evaluated on the server-side.

So, make your script include non-client callable and it should work.

 

Regards,

Snehangshu Sarkar

 

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

Hi Sarkar,

below is the script in script include

find_real_file.png

and ui action:

find_real_file.png

still not working

You  need to return either true or false from the function. Condition is evaluating based on the return value of the script include function.

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.