The CreatorCon Call for Content is officially open! Get started here.

Assignment Group auto populate from CI

joseeduardo
Giga Expert

Hello guys I am trying to do this:

  • Every time the Configuration Item changes on the Incident form, the value of the Assignment group field should default to the value of the Support group from the selected Configuration Item. The change should be reflected immediately on the form allowing the user to change it manually before submitting the form and it needs to be achieved   by using client scripts     .I did this: but I dont get it to work!

Captura.PNG

1 ACCEPTED SOLUTION

Hey Kalaiarasan P thank you very much! I really appreciate a lot your help though I used this!



function onChange(control, oldValue, newValue, isLoading) {  


    if (isLoading)  


          return;  


    var group = g_form.getReference('cmdb_ci', setGroup);  


}  



function setGroup(group) {  


    if (group)  


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


}  



And it worked! but seriously! Thank you very much! you helped me understand!


View solution in original post

5 REPLIES 5

Kalaiarasan Pus
Giga Sage

Remove the third if block and check


Hello Kalaiarasan P, thanks for the answer, and nop! 😕 it still dont work just with the reamaing if like this:




function onChange(control, oldValue, newValue, isLoading) {


  if (isLoading)


  return;



  if (newValue == '') {


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


  return;


  }





  var gr = g_form.getReference('cmdb_ci', setSupportGroup);




  function setSupportGroup(gr) {


  if (gr)


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


  }


}


Replace


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


With


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


Hey Kalaiarasan P thank you very much! I really appreciate a lot your help though I used this!



function onChange(control, oldValue, newValue, isLoading) {  


    if (isLoading)  


          return;  


    var group = g_form.getReference('cmdb_ci', setGroup);  


}  



function setGroup(group) {  


    if (group)  


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


}  



And it worked! but seriously! Thank you very much! you helped me understand!