- 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-02-2016 08:41 AM
This should give the sys id's of the record that have been selected
g_list.getChecked().toString()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 08:13 AM
Thank you Kalai,
I've rewritten the UI Action and I'm able to pass across the list to the script include using 'g_list.getChecked().toString()', where I can then do anything I need to server side.
Jamie.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:07 AM
I agree with Kalaiarasan.
I copied your button code and simulated it on my personal instance. Although the confim message appears, the g_form does not seems to work on list/
This is the error message:
Uncaught ReferenceError: g_form is not defined
Anything that you are trying the achieve that has to be done specifically from the list and that needs the g_form function?