Show UI Action button from Client Script

angelascelza
Kilo Explorer

Hi,

I have write a UI Action

Name: Reload form

Action Name: reload.prompt.form

Now I want to show the UI Action button inside a Client Script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

    if (isLoading || newValue === '') {

          return;

    }

$('reload.prompt.form').show();

}

But I received this error on the form

find_real_file.png

Can someone tell me the right way to include the UI Action inside the Client script code?

Thanks,

Angela !

4 REPLIES 4

mike_allgire
Giga Guru

Can you tell more about what you are attempting to do? What is the reason to try and dynamically show the UI Action after a form UI change? Additionally, what do you want the UI Action to be able to do?


Hi Mike,



I want to show a button called "Reload form" only when the state of the incident changed to assigned, but not saved.



So I intercept the change of the state with the client script and want to call tha action name of the UI Action to show the button.



I hope this is clear!!


Thanks


UI Actions aren't dynamic in that way. The condition is only checked onLoad, I believe. You would have to save the form first.


shloke04
Kilo Patron

Hi,



You can do this on a client side by using the UI Policy. Consider the below scenario mentioned and Please follow the below steps in order to do so:



1) For Example on a Demand form we have a button named "Defer" which I want to hide based on any field change on a form say for example when the state field value changes to "Qualified" value.


2) Now Create a New UI Policy with conditions as "State is Qualified".(Replace your condition accordingly as required)



find_real_file.png



3) In the Script tab write the below script as shown below in the screenshot:



find_real_file.png



Class Name as mentioned in Line Number 2 can be found by inspecting the button element in the Browser. Right click on the form and click on the Inspect options. Now select the cursor and click over the button for which you want the class name. For an example the similar behavior has been shown below:



find_real_file.png



Below is a great post from Goran which talks about this in details:



How to hide/show an UI action on field changes



Hope this helps.Mark the answer as correct/helpful based on impact.


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke