Ram_n Botelho
Tera Contributor

Easy peasy resume of how to call a SCRIPT INCLUDE in UI ACTION - Client side:

Script include: > Client callable TRUE

var BotaoDeletar = Class.create();
BotaoDeletar.prototype = Object.extendsObject(AbstractAjaxProcessor, {
testing: function(){return 25;}, // just for testing purpose
type: 'BotaoDeletar'
});

UI Action - Client side

var foo = new GlideAjax('global.BotaoDeletar'); // "scope"."script include name"
foo.addParam('sysparm_name', 'testing'); // obligatory, to call the function by its name
foo.getXMLAnswer(function(tobeused) { // "tobeused"- name a variable to catch the response
alert('SCRIPT INCLUDE RETURN IS ' + tobeused); // alert opens a pop-up
});

Comments
Sandro Calado
Tera Contributor

How can I use the coding in UI Action condition?

 

I created an Include Script what return true or false, then the UI Action button only showed and executed if the answer is true.

Ram_n Botelho
Tera Contributor

Hi, Sandro Calado.

UI Action condition field is server side. It means you can use the script include directly like "new global.BotaoDeletar().testing()" - you still can use the "current" if needed, like "new global.BotaoDeletar().testing(current)".

Sandro Calado
Tera Contributor

Hi Ram_n Botelho, thanks for your answer it's very functional and solve my doubt.

Version history
Last update:
‎10-12-2020 01:00 PM
Updated by: