can someone help me to userstand UI action how its working client and server side together with example ..?

s_kumar
Mega Contributor

Request

1 ACCEPTED SOLUTION

zica
Giga Guru

Okay perfect,



Here is a screenshot that shows the parameters of the UI action, Please do the same


Do not forget to put the action name, check client to true, and put the function name on Onclick()


Capture d



HEre is the script :



function reopenIncidentTest(){


     


      if (g_form.getValue('comments') == '') {


              //Remove any existing field message, set comments mandatory, and show a new field message


              try {


                    g_form.hideFieldMsg('comments');


              } catch(e) {}


                    g_form.setMandatory('comments', true);


                    g_form.showFieldMsg('comments','Reason is required when reopening an incident','error');


                      return false;   //Abort submission


        }


      //Call the UI Action and skip the 'onclick' function


      gsftSubmit(null, g_form.getFormElement(), 'incident_reopen_test'); //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')


      serverReject();



function serverReject(){


      current.state = 2;


      current.update();


}


View solution in original post

31 REPLIES 31

zica
Giga Guru

In my instance, it does not redirect me to a new incident :


Here is an active incident, I resolve it :


Capture d



once resolved, i reopened it :


Capture d


s_kumar
Mega Contributor

yes i have admin role..



i have sent you my full code and screenshot where i am doing wrong in that now ..can you please tell me in that ..




i am using my personal instance ...Helsinki Version ,....


if you comment out the action.setRedirect(), does it still open a new incident?


s_kumar
Mega Contributor

Heyyyy thanks you so much Zic....:)



Its working now ....



mistake was in calling that function ..


i was passing wrong name ....



i didnt know it will give error on case sensitive.



thanks you so much once again ..!!!1


zica
Giga Guru

Haha well done, you are welcome