Assigning high priority for "Emergency change request" by default.

sifynm
Tera Expert

How do we make all Emergency change risks to be in high priority by default when the option "Change Request > Emergency: Unplanned changes necessary to restore service. These changes require CAB authorization only." is clicked.

1 ACCEPTED SOLUTION

okay.



Step 1. you need to edit the change module as mentioned step 1 above.


Regards
Harish

View solution in original post

37 REPLIES 37

Dear Mr.Harishkumar,



                Please find below mentioned code which is saved in the UI page by name "render_gadget_emergency_changes". The reference type which I found says "chg.addQuery('type','emergency');", kindly let me know if there is any script being called or any modification in the code.



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <g2:evaluate var="jvar_chg">


      var chg = new GlideRecord('change_request');


      chg.addActiveQuery();


      chg.addQuery('type','emergency');


      chg.setCategory('homepage');


      chg.query();


  </g2:evaluate>




  <g2:scrollable_area height="100px">


      <table border="0" cellspacing="2" cellpadding="0" width="100%">


          <j2:while test="$[chg.next()]">


              <j2:set var="jvar_chg_link" value="change_request.do?sys_id=$[chg.sys_id]"/>


              <j2:set var="jvar_chg_list_link" value="change_request_list.do?sysparm_query=active=true"/>


  <tr>


    <td>


                      <a href="$[jvar_chg_link]">


                          <span style="padding-right:10px;"><IMG SRC="images/icons/changes.gifx"/></span>


                      </a>


                      <a href="$[jvar_chg_link]" class="linked" style="padding-right:10px;">$[chg.number]</a>


                  </td>


                  <td>$[chg.short_description]</td>


              </tr>


          </j2:while>


          <tr>


              <td align="center" colspan="2"><a href="$[jvar_chg_list_link]" class="linked">${gs.getMessage("View all active Change Requests")}</a></td>


          </tr>


      </table>


  </g2:scrollable_area>


</j:jelly>


Dear Mr.Harsihkumar,



              Can we do this? As we click on "Change request" and then "New" we get the following three options:



Normal: Changes without predefined plans that require approval and CAB authorization.


Standard: Select from available pre-approved change templates. These changes do not require approval.


Emergency: Unplanned changes necessary to restore service. These changes require CAB authorization only.



On selecting the "Emergency" change request



function onLoad() {


  //Type appropriate comment here, and begin script below


g_form.addOption('u_priority', '1', '1-Critical','1'); // 1 will put this value in 1st drop down in the drop down list for priority.


g_form.addOption('u_risk', '1', 'Very High','1'); //1 will put this value in 1st drop down in the drop down list for risk.


g_form.addOption('u_impact', '1', '1-High','1'); //1 will put this value in 1st drop down in the drop down list for impact.



                  I am just reiterating what you helped me with here Javascript for updating dropdown values in form design . In addition, I would like to disable all other options. Kindly let me know if the code is correct and if this is how we need to achieve it.


Try that if it doesnot work,



follow these steps


step1: edit create new module and go to link type and follow step2


step 2: remove interceptor(paste below link in arguments as mentioned in screen shot)


url: change_request.do?sys_id=-1&sysparm_query=active=true&sysparm_stack=change_request.do?sysparm_query=active=true



find_real_file.png



Then write onChange client script on Type.


so when your type is "emergency"



//your code will work



//instead of addoption use setValue


Regards
Harish

Here you go



find_real_file.png



Client script:


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


    if (isLoading || newValue === '') {


          return;


    }


  var chg = g_form.getValue('type');


  alert(chg);


  if(chg=='emergency')


  {


  alert('inside');


  g_form.setValue('priority', 1);


  g_form.setValue('risk',1);


  g_form.setValue('impact',1);



  }


    }


find_real_file.png


Regards
Harish

Harish,


                I tried doing what you have mentioned, but for some reason it is not working for me. I am also not sure what is going wrong in my case and how I can rectify it. Please help if possible. Let me know if you what data you require to verify whether what I have done is correct.