how to Call UI action in client script

Shruthi2
Kilo Contributor

Hi,

I have to hide a Ui action on the change form on change of the configuration item. How do I refer to the UI action in the on change client script of the configuration item field.Please help me out

 

Thanks,

Shruthi.

1 ACCEPTED SOLUTION

Hi Shruthi,

Did you set this field to false?

Isolate Script -  false

  • This field is not on form but from list you can make it false
  • by default it is true
  • If that is true DOM won't work

find_real_file.png

Regards
Ankur

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

View solution in original post

17 REPLIES 17

Nitin_NOW
Tera Guru

Hello 

You don't have to call the UI action into Client Script. This can be done directly from the UI action.

In the Condition field of the button use this - current.<field name>.changes()

Please hit correct if this resolves your issue.

Thanks

Nitin

Gaurav Shirsat
Mega Sage

Hi 

Place a function in an onload script (only works in global scope)

  1. Client Script function onLoad() { } // You can call this in UI Actions // Only works in global scope (does not work in scoped apps) // Will only work for UI Action of the same table function yourFunctionHere() { // Code here }
  2. UI Action yourFunctionHere();
 

Client Script

function onLoad() {

 

}

 

 

// You can call this in UI Actions

// Only works in global scope (does not work in scoped apps)

// Will only work for UI Action of the same table

function yourFunctionHere() {

// Code here

}

UI Action

yourFunctionHere();

2) Write a UI Script

UI Script yourFunctionHere

// This will be callable from all client scripts form any table

// If global is not ticked, you must use ScriptLoader API

 

function yourFunctionHere() {

// Code here

}

UI Action

//If global is not ticked on UI Script

getScripts("yourFunctionHere", runScripts)

 

function runScripts() {

 

yourFunctionHere();

 

}

 

//If global is ticked on UI Script

yourFunctionHere();

Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

Is it possible to make a call from catalog client script [OnSubmit] to Flow designer action ?