ui action redirecting it to previous page

tghadage124
Tera Contributor
function onredirect(){
    g_form.setMandatory('u_close_code',true);
    g_form.setMandatory('u_percentage_complete',true);
    g_form.setMandatory('u_is_this_request_completed',true);
    action.setRedirectURL(current);
 
here I have set it to current but still its taking me to the previous page where I need to stay it on the same page. 
Please guide !!
8 REPLIES 8

Aditya02
Tera Guru

Hi @tghadage124 ,

 

Can you elaborate more about what you are trying to do.. so that i can help you with..

Here , There is UI action button request closure when its clicked three fields will be mandatory as mentioned below.

u_close_code , u_percentage_complete, u_is_this_request_completed.  

 

for that code is :

function onredirect(){
    g_form.setMandatory('u_close_code',true);
    g_form.setMandatory('u_percentage_complete',true);
    g_form.setMandatory('u_is_this_request_completed',true);
    action.setRedirectURL(current);
}  
here its redirecting me to the previous page when i mentioned  'action.setRedirectURL(current);' here 
i need to stay it same page when the UI action button is clicked and these fields will be mandatory.

Not applicable

Hi @tghadage124 

 

try this:

function onredirect(){
    g_form.setMandatory('u_close_code',true);
    g_form.setMandatory('u_percentage_complete',true);
    g_form.setMandatory('u_is_this_request_completed',true);
   gsftSubmit(null, g_form.getFormElement(), 'current_page');  // current_page should be your action name on the ui actin
} 

// Server side code
if (typeof window === 'undefined') {
   current.update();
   action.setRedirectURL(current);
}

 

HemanthM1_0-1724750263470.png

 

Hope this helps!!!

 

Have tried your code its still the same error coming in , its taking me back to previous page.

 

thanks!!