Show UI Action button from Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2017 07:10 AM
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
Can someone tell me the right way to include the UI Action inside the Client script code?
Thanks,
Angela !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2017 09:01 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2017 11:43 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2018 01:46 PM
UI Actions aren't dynamic in that way. The condition is only checked onLoad, I believe. You would have to save the form first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2018 05:10 PM
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)
3) In the Script tab write the below script as shown below in the screenshot:
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:
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.
Regards,
Shloke