Help with a UI ACTION SCRIPT

Matthew20
Tera Contributor

I am attempting to repurpose a script I found to provide a prompt/confirmation before another function as youll see in the script below. The goal is to have the user confirm the state change before it happens. I would appreciate any help anyone could provide. I believe the issue is in the part "gsftSubmit(null,g_form.getFormElement(),'sys_update_value');" but i dont know why? I also dont understand the "sys_update_value" or what I would modify there. Thank you in advance for the help!!!

 

function KMMScancel(){
var answer = confirm("Are you sure you would like to CANCEL this KMMS record?");
if(answer == true){
gsftSubmit(null,g_form.getFormElement(),'sys_update_value');
}else{
return false;
}
 
}
(function executeRule(current, previous /*null when async*/) {
 
// Add your code her
current.state = 4;
current.setWorkflow(false);
current.update();
 
})(current, previous);
1 ACCEPTED SOLUTION

Under your current.update() put this line

action.setRedirectURL(current);

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

3 REPLIES 3

Zach Koch
Giga Sage
Giga Sage

Take a look at this thread, it breaks down info about UI actions that contain server side script

Client-Side and Server-Side Code in ONE UI Action using gsftSubmit() 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

THANK YOU. I figured it out. But now im left with a problem, when it executes it seems to leave the record and go to another. Are you able to tell me why?

Under your current.update() put this line

action.setRedirectURL(current);

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!