- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 12:09 PM
Hello,
I'm trying to write a UI Action to perform some operations on multiple records selected in a list. I've created the UI Action and selected 'List Button'.
I'm using this well tried and tested method from SNC Guru, to run a client side script before the server side script, to give the user a confirmation alert message:
//Client-side 'onclick' function
function runClientSide(){
if(confirm('Do you want to continue?') == false){
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'myAction'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if(typeof window == 'undefined')
runBusRuleCode();
//Server-side function
function runBusRuleCode(){
gs.log('The BusRuleCode ran OK.');
}
I am able to get the client side script to run, but can only get the server side script to run if I uncheck the 'Client' box (in which case I lose the alert message).
Presumably the issue is with the getFormElement row (as the form isn't visible in list view).
Can anyone advise how I would modify this code to make it suitable for a List Button UI Action?
Thanks
Jamie.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 03:56 AM
Would it be a issue to convert all the server side code to a script include function ? I don't think g_form.getFormElement() function will work on list layout.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 12:28 PM
Your UI Action must have an action name. There, in myAction goes this action name. Change this and check if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 03:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 03:56 AM
Would it be a issue to convert all the server side code to a script include function ? I don't think g_form.getFormElement() function will work on list layout.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 08:27 AM
Hi Kalai,
Thank you for this.
I can see that a script include function could be the way forward. How would I reference or pass in the records selected in the list (that I want to perform the UI Action on)?
Jamie.