CA Service Management

 View Only
  • 1.  Button to flip Request to Incident and vice versa - Not Working in Chrome

    Posted Jun 16, 2016 04:07 PM

    SDM 14.1.02

    Need to allow analysts to change a Request to Incident and vice versa as customers currently create Requests initially and then the decision of which type is made at Tier 1.

    The following legacy code works in IE and Firefox but not Chrome.

    IE:  version 11

    Firefox ESR 45

    Chrome: Version 51

    /////////////////////////////////////////////////////////////

    detail_cr.htmpl

    In the existing button row:

     

     

    <PDM_IF "$args.id" != "0" && "$prop.form_name_3" == "edit" && "$args.status" != "CL"&& "$args.status" != "CAN">

    <PDM_MACRO name=button Caption="Change To Incident" Func="document.main_form.elements('SET.type').value='I'; detailSave();" hotkey_name="Change To Incident(I)" ID="ITIL_REQUEST">

    </PDM_IF>

    ...and added the necessary hidden element to capture the existing type:

     

     

    <PDM_MACRO name=dtlStart scroll=true>
    <PDM_IF "$prop.form_name_3" == "edit">
    </script>
    .....
    <input type="hidden" name="SET.type" value="$args.type">
    <script type="text/javascript">

     

    //////////////////////////////////////////////////

    What should I look for that Chrome handles differently?

     

    thanks,

    J.W.



  • 2.  Re: Button to flip Request to Incident and vice versa - Not Working in Chrome
    Best Answer

    Posted Jun 16, 2016 06:26 PM

    RESOLVED:

    Change the button code to:

     

    <PDM_IF "$args.id" != "0" && "$prop.form_name_3" == "edit" && "$args.status" != "CL"&& "$args.status" != "CAN">
    <PDM_MACRO name=button Caption="Change To Incident" Func="document.getElementById('flip').value='I'; detailSave();" hotkey_name="Change To Incident(I)" ID="ITIL_REQUEST">
    </PDM_IF>

     

    and the hidden input to:

     

    <input type="hidden" name="SET.type" id="flip" value="$args.type">

     

    Apparently, "document.getElementById" is still supported while "document.main_form.elements" is deprecated?.  I couldn't find a specific reference to the supported versions,

    J.W.



  • 3.  Re: Button to flip Request to Incident and vice versa - Not Working in Chrome

    Posted Dec 29, 2016 10:50 AM

    hi,It is possible that they send me the source code of the form detail_cr, I am trying to replicate what they indicate in the post but it is not working

     

    thanks



  • 4.  Re: Button to flip Request to Incident and vice versa - Not Working in Chrome

    Posted Dec 29, 2016 11:06 AM

    JonathanM

     

    Here are my cheatsheet instructions for this mod:

     

    1. Add the following to the button row of the detail_cr.htmpl - in the section where buttons are enabled for EDIT mode:

     

    ////////////////////////////////////////
    <PDM_IF "$args.id" != "0" && "$prop.form_name_3" == "edit" && "$args.status" != "CL"&& "$args.status" != "CAN">
    <PDM_MACRO name=button Caption="Change To Incident" Func="document.getElementById('flip').value='I'; detailSave();" hotkey_name="Change To Incident(I)" ID="ITIL_REQUEST">
    </PDM_IF>
    ////////////////////////////////////////////

    (When adding to detail_in - change the values to R and "Change to Request")

     

    2. Add the following to the list of HIDDEN variables in the section of the FORM when it in EDIT Mode

     

    ////////////////////////////////////////////
    <input type="hidden" name="SET.type" id="flip" value="$args.type">
    /////////////////////////////////////////////

     

    Example:

    detail_cr.htmpl excerpt

    ///////////////////

    ......

     

    <script type="text/javascript">
    <PDM_IF "$prop.form_name_3" != "edit">
    if ( typeof parent.createIncident == "boolean" &&
         parent.createIncident ) {
      if (typeof ahdframeset.workframe == "object")
        ahdframeset.workframe.SkipInitialFocus = "1";
    <PDM_IF "$prop.MultiTenancy" != "on">
      create_new('cr',0,0,0,'PRESET=type:I','INITFROM=frm002');
    <PDM_ELSE>
      create_new('cr',0,0,0,'PRESET=type:I@@tenant:'+argTenantId,'INITFROM=frm002');
    </PDM_IF>
    }
    </PDM_IF>
    parent.createIncident = void(0);

     

    <PDM_MACRO name=dtlForm factory=cr>
    <PDM_IF "$prop.form_name_3" == "edit">
    if ( cfgUserAuth \> 1 && ahdtop.cfgNX_KT == "Yes" && ahdtop.cfgEBRVersion == "SEARCH_ENGINE" ) {
        //Add the find similar button
          
    <PDM_MACRO name=button Caption="Find Similar" Func="find_similar_tickets('cr')" hotkey_name="Find Similar" ID=FIND_SIMILAR Tooltip="Find Similar">
    }
          
    <PDM_MACRO name=button Caption="Quick Profile[Q]" Disabled=yes Func="if ( document.main_form['SET.customer'].value != '' ) edit_profile_browser('id', document.main_form['SET.customer'].value); else edit_profile_browser('combo_name', document.main_form['customer_combo_name'].value)" hotkey_name="Quick Profile[Q]" ID=PROFILE_BROWSER>
    <PDM_IF 0>  J.W. - 16 Jun 16 - Add Change To Incident button when in Edit mode and not Closed or Cancelled</PDM_IF>
    <PDM_IF "$args.id" != "0" && "$prop.form_name_3" == "edit" && "$args.status" != "CL"&& "$args.status" != "CAN">
    <PDM_MACRO name=button Caption="Change To Incident" Func="document.getElementById('flip').value='I'; detailSave();" hotkey_name="Change To Incident(I)" ID="ITIL_REQUEST">
    </PDM_IF>
    <PDM_IF $args.id == 0>
    <PDM_MACRO name=button Caption="Use Template[*Q]" Func="apply_template('frm001', 'SET.customer', 'cr')" hotkey_name="Use Template[*Q]" ID=btn010>
    </PDM_IF>
    <PDM_ELSE>
    <PDM_IF "$args.category" != "" >
    <PDM_IF "$args.category.auto_assign" == "1" || "$args.category.auto_assign" == "2">
    <PDM_MACRO name=button Caption="Re Auto Assign" Func="re_auto_assign('$args.assignee','$args.group','$args.customer','$args.category','$args.auto_assign','$args.persistent_id','$args.affected_resource','$args.category.auto_assign')" hotkey_name="Re Auto Assign" ID=btn010>
    </PDM_IF>
    </PDM_IF>
    <PDM_IF $ACCESS.FAC_chg == 2 && "$args.change" == "">
       if ( cfgUserAuth > 1 ) {
          
    <PDM_MACRO name=button Caption="Create Change Order[!ea]" Func="detailSave('NEW_CHANGE')" hotkey_name="Create Change Order[!ea]" ID=btnchg Tooltip="Save and Create Change Order">
       }
    </PDM_IF>
       if ( cfgUserAuth > 1 ) {
    <PDM_IF "$prop.MultiTenancy" != "on">
    <PDM_MACRO name=button Caption="Create Incident[!eaI]" Func="create_new('cr',0,0,0,'PRESET=type:I','INITFROM=frm002')" hotkey_name="Create Incident[!eaI]" ID=ITIL_INCIDENT>
    <PDM_ELSE>
    <PDM_MACRO name=button Caption="Create Incident[!eaI]" Func="create_new('cr',0,0,0,'PRESET=type:I@@tenant:'+argTenantId,'INITFROM=frm002')" hotkey_name="Create Incident[!eaI]" ID=ITIL_INCIDENT>
    </PDM_IF>
    }
    if ( cfgUserAuth \> 1 && ahdtop.cfgNX_KT == "Yes" && ahdtop.cfgEBRVersion == "SEARCH_ENGINE" ) {
        //Add the find similar button
          
    <PDM_MACRO name=button Caption="Find Similar" Func="find_similar_tickets('cr')" hotkey_name="Find Similar" ID=FIND_SIMILAR Tooltip="Find Similar">
    }           
    <PDM_MACRO name=button Caption="Quick Profile[Q]" Func="profile_browser('$args.customer.persistent_id',void(0),void(0),'$args.persistent_id')" hotkey_name="Quick Profile[Q]" ID=PROFILE_BROWSER>
    </PDM_IF>
    <PDM_IF "${args.extern_ref:}" != "">
     var extern_token = "$args.extern_token";
     var extern_ref = "$args.extern_ref";

     

     if ( extern_token.indexOf("http://") != -1) {
         if ( extern_ref.indexOf("msgtext") == -1) {
             
    <PDM_MACRO name=button Caption="$args.extern_ref" Func="popupWithURL('$args.extern_token',1)" hotkey_name="$args.extern_ref" ID=btnextlaunch>
        }
        else {
            ImgBtnCreate("btnextlaunch","$args.extern_ref" , "popupWithURL('$args.extern_token',1)", true, 0);
        }
      }
     
    </PDM_IF>
    <PDM_MACRO name=dtlStart scroll=true>
    <PDM_IF "$prop.form_name_3" == "edit">
    </script>
    <input type="hidden" name="change_category" value="0">
    <input type="hidden" name="SET.call_back_flag" value="$args.call_back_flag" id="SET.call_back_flag">
    <input type="hidden" name="NEW_ATTMNTS" id="NEW_ATTMNTS">
    <PDM_IF 0>  J.W. - 16 Jun 16 -Added hidden input for type to allow change of type </PDM_IF>
    <input type="hidden" name="SET.type" id="flip" value="$args.type">
    <script type="text/javascript">

     

    ......

    (form continues)

    /////////////////////////////////////////////////////

     

    Regards,

    J.W.



  • 5.  Re: Button to flip Request to Incident and vice versa - Not Working in Chrome

    Posted Dec 30, 2016 03:51 PM

    Thanks @J_W I apply the changes in both ways, but I leave no trace in the activity log and for the purposes it would be good to press the button to identify if it was a registration error of the user or the technician perhaps putting a dropdown or a checkbox so proactively we would have How to identify which area should be strengthened or empowered.

     

    thanks