CA Service Management

  • 1.  Refuse Reasign Button

    Posted May 19, 2016 07:48 AM

    Hello!

    I need to change a status in an incident but I am facing some dificulties.

    What I need:

    When an incident is reasign to another user, if the reasignation is rejected, I need the incident to go to the previous state it was before the reasignation (before PTE-ACK).

     

    What happens:

    When an incident is reasign to another user, if the reasignation is rejected, the incident always goes to the same state (ACK).

     

    Example:

    An incident is asigned to an user and the incident state is WIP, then, if the incident is pending reasignation, goes from WIP to PTE-ACK (which is pending-reasign) but if the reasingnation is rejected then the state of the incident goes to ACK instead of WIP(which was the state before PTE-ACK).

     

    I've buildt new macros, checked and corrected the spell code but the only thing that works for that button was this line in a form:

    <input type="hidden" name="SET.status" value="ACK">

     

    I've changed the value to 'WIP' and then only goes to WIP. I've commented the line to see if it would follow the macros and spell code but instead it stays always in the same state (PTE-ACK)

    Then I've checked the java script code for the button:

     

    ImgBtnCreate_internal( "btnres", "Rechazar Reasignacion", "refuse_asign()",true, 0, "n/a", -1, "ReAssign", "positive");

     

    and the refuse_asign function:

     

    // LABCA01 - ADDED TO REFUSE ASIGN

    function refuse_asign()

    {

      var query_str = cfgCgi +

            "?SID=" + cfgSID +

            "+FID=" + fid_generator() +

            "+FACTORY=cr" +

            "+PERSID=$args.persistent_id" +

            "+OP=UPDATE" +

            "+EDIT_HTMPL=request_status_change_refuse_asig.htmpl" +

            "+ACTIVITY_LOG_TYPE=ST";

                   

    <PDM_IF "1" == "${args.KEEP.IsPopUp:0}">

                        query_str += "+KEEP.IsPopUp=1";

     

    But I don't really know javascript and I really could use some help!

     

    Thanks in advance!

     

    Best regards.



  • 2.  Re: Refuse Reasign Button

    Posted May 19, 2016 07:54 AM

    Hi,

    look like your main logic will be in the request_status_change_refuse_asig.htmpl form. as you function don't do much here

    can you provide the content from this one too?

    Also what macro/spell code is involved here and have been modified?

    Regards,

    /J



  • 3.  Re: Refuse Reasign Button

    Posted May 19, 2016 10:12 AM

    Hey jmayer,

    this line <input type="hidden" name="SET.status" value="ACK"> is in that form.

    Part of the form:

     

    <PDM_MACRO name=dtlStartRow>

    <PDM_MACRO name=dtlReadonly hdr="Número de $args.type.sym" attr=ref_num>

    <PDM_MACRO name=dtlReadonly hdr="Resumen de $args.type.sym" attr=summary colspan=2>

    <PDM_MACRO name=dtlStartRow>

    <PDM_MACRO name=dtlReadonly hdr="Estado actual" attr=status>

    <PDM_IF "$args.KEEP.DEF_CODE" == "">

    <PDM_IF "$args.type" == "I">

    <PDM_MACRO name=dtlReadonly hdr="Nuevo estado" attr=status_prev>  // here is when a popup appears and it goes to the previous state but only in the pop up!

    <PDM_ELIF "$args.type" == "P">

    <PDM_MACRO name=dtlDropdown hdr="Nuevo estado" attr=status default="!default_trans_sym!" evt="onBlur=\\\"detailSyncEditForms(this)\\\" onChange=\\\"make_desc_required(this)\\\"" factory=crs_pr initial="!default_trans_code!">

    <PDM_ELSE>

    <PDM_MACRO name=dtlDropdown hdr="Nuevo estado" attr=status default="!default_trans_sym!" evt="onBlur=\\\"detailSyncEditForms(this);\\\" onChange=\\\"make_desc_required(this)\\\"" factory=crs_cr initial="!default_trans_code!">

    </PDM_IF>

    <PDM_ELSE>

    <PDM_IF "$args.type" == "I">

    <PDM_MACRO name=dtlDropdown hdr="Nuevo estado" attr=status_prev default="!def_sym!" evt="onBlur=\\\"detailSyncEditForms(this)\\\" onChange=\\\"make_desc_required(this)\\\"" factory=crs_in initial="!def_code!">

    <PDM_ELIF "$args.type" == "P">

    <PDM_MACRO name=dtlDropdown hdr="Nuevo estado" attr=status default="!def_sym!" evt="onBlur=\\\"detailSyncEditForms(this)\\\" onChange=\\\"make_desc_required(this)\\\"" factory=crs_pr initial="!def_code!">

    <PDM_ELSE>

    <PDM_MACRO name=dtlDropdown hdr="Nuevo estado" attr=status default="!def_sym!" evt="onBlur=\\\"detailSyncEditForms(this);\\\" onChange=\\\"make_desc_required(this)\\\"" factory=crs_cr initial="!def_code!">

    </PDM_IF>

    </PDM_IF>

    <PDM_MACRO name=dtlStartRow>

    <PDM_MACRO name=dtlTextbox hdr="Tiempo invertido" attr=alg.time_spent evt="onBlur='validate_duration_ts(this)'" maxlength=100>

    <PDM_MACRO name=dtlDate hdr="Fecha de la actividad" attr=alg.time_stamp>

    <PDM_MACRO name=dtlDateReadonly hdr="Marca de tiempo" attr=alg.system_time>

    <PDM_IF "$prop.view_internal" == "1">

    <PDM_MACRO name=dtlCheckbox hdr="¿Interno?" attr=alg.internal>

    </PDM_IF>

    <PDM_MACRO name=dtlStartRow>

    <PDM_MACRO name=dtlTextbox hdr="Descripción del usuario" attr=alg.description colspan=4 rows=8 size=80 spellchk=yes>

     

     

    make_desc_required();

     

     

    if (resp_ids.length > 1)

    {

    <PDM_MACRO name=dtlStartRow>

    <PDM_IF "$args.type" == "R" || "$args.type" == "">

    <PDM_MACRO name=dtlDropdown hdr="Respuesta personalizada" attr="n/a" evt="onBlur='add_response(selectedIndex)' onChange='reset_resp_on_blur_flag()'" factory=response list_display="$list.sym" rel_attr_name="id" use_list_display=1 whereclause="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND cr_flag=1">

    <PDM_ELIF "$args.type" == "I">

    <PDM_MACRO name=dtlDropdown hdr="Respuesta personalizada" attr="n/a" evt="onBlur='add_response(selectedIndex)' onChange='reset_resp_on_blur_flag()'" factory=response list_display="$list.sym" rel_attr_name="id" use_list_display=1 whereclause="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND in_flag=1">

    <PDM_ELIF "$args.type" == "P">

    <PDM_MACRO name=dtlDropdown hdr="Respuesta personalizada" attr="n/a" evt="onBlur='add_response(selectedIndex)' onChange='reset_resp_on_blur_flag()'" factory=response list_display="$list.sym" rel_attr_name="id" use_list_display=1 whereclause="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND pr_flag=1">

    </PDM_IF>

    }

     

     

    if (typeof document.main_form.elements["KEY.status"] != "undefined")

        set_default_toggle(document.main_form.elements["KEY.status"]);

    else

        set_default_toggle(document.main_form.elements["SET.status"]);

     

     

     

     

    </script>

    <!--<input type="hidden" name="SET.status" value="status_prev"> -->

    <PDM_MACRO name=dtlEnd>

    </PDM_FORM>

    </center>

     

    The Macro that was created for the transition PTE-ACK to WIP with the condition:

     

    if (( !is_null(getval_by_name("type")) && getval_by_name("type") == "I" ) && ( !is_null(getval_by_name("status")) && getval_by_name("status") == "PTE-ACK" ) && ( !is_null(getval_by_name("status_prev")) && getval_by_name("status_prev") == "WIP" ))

    set_return_data(TRUE);

    else

    set_return_data(FALSE);

     

    And the Spell code:

    if(status_old == 'PTE-ACK') {

           if((status_new != status_old) || (group_old != group_new)) {

                if (is_empty(fecha_resolucion_real) || is_null(fecha_resolucion_real)) {

                                  status = status_prev;  // doesn't do anything, before status_prev was 'ACK', I've vreated a no one with a new .mod but doesn't work

                                   assignee = '';

                 }

                 else {

                          status = 'RE';

                          if(group_old != group_new) {

                           assignee = '';

                        }

                    }

              }

      }

     

    Thank you!



  • 4.  Re: Refuse Reasign Button

    Posted May 19, 2016 03:12 PM

    HI,I don't see where do you define status_old,status_new, group_old, group_new

    just want to make sure that all spel I correct there  before moving to the other parts

    /J



  • 5.  Re: Refuse Reasign Button

    Posted May 20, 2016 02:25 AM

    Hey, sorry about that

     

      string status_old, status_new;

      string incident_group;

      string zmsg;

     

      uuid assignee_old, assignee_new;

      uuid group_old, group_new;

     

      status_old = argv[2];

      status_new = argv[3];

      incident_group = "09F86E3D6CA8104A98D6A438F9C6F7E9";

     

     

      assignee_old = argv[5];

      assignee_new = argv[6];

      group_old = argv[8];

      group_new = argv[9];

     

    Thank you!