UI Action Condition from Script Include

jrottman
Giga Contributor

I'm trying to get a UI Action to appear based on a function in a script include.

My script include contents:

function myCustomShowUIButton() {

  return false;

}

The condition line of my UI action:

myCustomShowUIButton()

I would expect the UI action button to not appear because the function returns false.   However this does not appear to work.   Any ideas?

Jason

1 ACCEPTED SOLUTION

jrottman
Giga Contributor

You are correct about UI actions being executed on the client side, but incorrect regarding the condition and visibility.   If the condition on a UI action is not met, the html and java-script is not even sent to the browser, so the button never appears at all (not even briefly).   If using a client script to hide a button, the html and javascript must first be sent to the browser, and it is displayed.   Once the client scripts then catch up, the button disappears, but this can take about 1 second so the button appears briefly.



Sadly I do not think a function from a Script Include (whether a simple function or using a class) can be used on the condition line of a UI Action.



Jason


View solution in original post

7 REPLIES 7

zica
Giga Guru

It will be the same because UI action has to be executed on client side and also server side. Same for script include which is server side and ui action with its client side script.


If I were you, i will go through the easiest way to achieve that.


What do you mean by 'if a record appears in a different unrelated table' ?


jrottman
Giga Contributor

You are correct about UI actions being executed on the client side, but incorrect regarding the condition and visibility.   If the condition on a UI action is not met, the html and java-script is not even sent to the browser, so the button never appears at all (not even briefly).   If using a client script to hide a button, the html and javascript must first be sent to the browser, and it is displayed.   Once the client scripts then catch up, the button disappears, but this can take about 1 second so the button appears briefly.



Sadly I do not think a function from a Script Include (whether a simple function or using a class) can be used on the condition line of a UI Action.



Jason


vant
Tera Expert

Make sure the function name is the exact name as the Script Include name. Hope that helps.