How to stop client script after submiting the incident

ronaldanand
Tera Contributor

Hi all ,

I used 2 client scripts for make ready only based on selection

I want the assignment group to be blanked out, forcing the person to click on Find Assignment Group again if any of these are changed on an Incident Ticket:

CI

Business Service/Category/Sub Category

Classification

When 1 of the above combination are selected, the other fields should become grayed out and the assignment group should be blanked out so that it has to be found again by clicking on the Find Assignment Group button. When I am trying to submit the incident assignment group is blanked out.How can i stop this ...

1.jpg

2.jpg

Please help me

1 ACCEPTED SOLUTION

Hi Anand,



1. Inactivate the client script which is assigning the assignment group based on CI slection.


2. comment all the clearValue of assignment group from the above specified scripts.


3.Create a on change client script like below & try for the result.


        var cid = g_form.getValue('cmdb_ci');


        if (cid == ' '){


        g_form.setValue('assignment_group', ' ');


        }


Hope this will help.



Thank You!


View solution in original post

7 REPLIES 7

Patrick Fedigan
Giga Guru

Hello Anand,



Do you have any onSubmit Client Scripts active for Incident?



Cheers,


ronaldanand
Tera Contributor

yes I have following 2 on submit client script



function onSubmit() {


    var action = g_form.getActionName();


    if (action != 'close_incident' && action != 'resolve_incident')


          return;



    // Close notes and Close code must be on the form


    if (!g_form.getControl('close_notes') || !g_form.getControl('close_code'))


          return;



    var state = '6';


    if (action == 'close_incident')


          state = '7';



    g_form.setValue('incident_state', state);


    g_form.setValue('state', state);


    g_form.setDisplay('close_notes', true);


    g_form.setMandatory('close_notes', true);


    g_form.setDisplay('close_code', true);


    g_form.setMandatory('close_code', true);


    if (g_form.getValue('close_notes') == '' || g_form.getValue('close_code') == '')


          return false;


}



--------------------------------------------------------------------------------------



function onSubmit() {    


     


      if (typeof window == 'undefined')


    dowServerReopen();



function dowServerReopen() {


    // Set Incident state to active, update and reload the record


    g_form.setValue('incident_state', '2');


          g_form.addErrorMessage("Reopen Incident");


    action.setRedirectURL(current);


      g_form.clearValue('assigned_to');


      return false;


     


}                   }


ronaldanand
Tera Contributor

while i save the incident assignment going to blanked out based on my onchange client script .How can i stop this or over come this .Please someone help me


Hi Anand,



1. Inactivate the client script which is assigning the assignment group based on CI slection.


2. comment all the clearValue of assignment group from the above specified scripts.


3.Create a on change client script like below & try for the result.


        var cid = g_form.getValue('cmdb_ci');


        if (cid == ' '){


        g_form.setValue('assignment_group', ' ');


        }


Hope this will help.



Thank You!