- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:41 AM
Hello!
Im working on a functionality that will allow to change the status of a record when a button is clicked.
I have an UI Action (client) so that when the button is clicked 'reason for reject' shows up and is set to mandatory:
I want the approver to be obliged to provide 'reject reason' to be able to change the status to 'rejected'.
Here is my UI action:
is it possible to call Script Include that will handle the logic of the record update? (changing the field value to 'rejected' and adding the 'reject reason').
Thank you in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 08:14 AM
I corrected this in my reply above, see this
if( g_form.getValue('u_activity')== ''){ // this if was wrong
return false; //Abort submission
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:45 AM
Hi,
You can use a ui action that can run client and server code both, like below
function runClientCode(){
if( == false){
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), ''); //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(){
current. = ;
current.update();
gs.addInfoMessage('You did it!');
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:52 AM
Please correct me if i am wrong: I have to create another server side UI action that will handle the record update logic and then in the client UI action I have to add the name of it:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:56 AM - edited 01-09-2024 07:57 AM
No this is the same ui action that you have, the client side one, you can just modify it to run server side script also
function onClick(){
if( == false){
return false; //Abort submission
}
//Do the client side things here, making field mandatory and all that
gsftSubmit(null, g_form.getFormElement(), '<add the action name of the this client siode ui ction here>');
}
if(typeof window == 'undefined')
runServerCode();
//Server-side function
function runServerCode(){
//Do the server side things here
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 07:58 AM
So what the field "Action Name" is for?