Please help with UI Action script.

Jessica28
Tera Guru

Hello,

I am using UI action function to call server side code to update records (Only for test purposes).

Is it possible to use the "else" statement to call different server side code. If not, please provide suggestions.

Thank you

 

Here is the example code:

function confirmUpdate() {
    var answer = confirm('This will update all records! Are you sure?');
        if (answer) {
            gsftSumit(null, g_from.getFormElement(), 'updateConfirm');
        } else {
            //Need to trigger other server side code

        }
    }
    if (typeof window == 'undefined') {
        current.work_notes = "All records updated";
        current.update();
        action.setRediirectURL(current);
    }
14 REPLIES 14

Arun_Manoj
Mega Sage

Hi @Jessica28 

shyamkumar VK
Kilo Patron

@Jessica28 , You need to Call Another Function to Initiate Server Code , Below is the Corrected Code 

 

function confirmUpdate() {
    var answer = confirm('This will update all records! Are you sure?');
        if (answer) {
            gsftSumit(null, g_from.getFormElement(), 'updateConfirm');
        } 
 return false;
    }

//server side script 
    if (typeof window == 'undefined') 

updatedetails();
function updatedetails(){
        current.work_notes = "All records updated";
        current.update();
        action.setRediirectURL(current);
    }

 

 

Regards,

Shyamkumar

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

@Jessica28  , If this Helped can you Accept the Solution , So this Moves to Answered Queue

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Hi @shyamkumar VK 

Thank you for help.  Could you please let me know how to call a business rule from an UI Action.  

For example in the else statement.  This is for my learning purposes.  

 

Jessica28_0-1711003074681.png