CA Service Management

Expand all | Collapse all

Update Status Using a Custom Button

Jump to Best Answer
  • 1.  Update Status Using a Custom Button

    Posted 01-03-2018 09:39 AM

    Hello!, Can I perform an update status action of a change order using a custom button? in fact I need to validate certain conditions and then change the status. the fast way that I see is that the button execute an action macro. is this posible?  maibe using a function like update_status, or I need to create a .htmpl and call using a new url?

     

    Example:

     

    var popupURLreintopccce = '$cgi?SID=$SESSION.SID+FID=' +  fid_generator() + 
         '+FACTORY=chg+PERSID=$args.persistent_id+KEEP.argCrearCCCE=1+HTMPL=chg_action_gtt.htmpl' +
         '+OP=UPDATE+ACTIVITY_LOG_TYPE=GTTOPCCC';
    <PDM_MACRO name=button Caption="Abrir CCCE" Func="popupActivityWithURL(popupURLreintopccce, 'chg')" hotkey_name="Abrir CCCE" ID=btn_opccce>

     

     

    on the new ,HTMPL

     

    <PDM_IF "$args.KEEP.argCons" == "1" >
         form_title = "Consulta de Afectacion de Servicios Cambio TTP $args.chg_ref_num";
         <PDM_SET args.ztx_status="PE_OCCCA">     
         <PDM_SET args.zflag_consult="1">     
    <PDM_ELIF "$args.KEEP.argCrearCCCA" == "1">
         form_title = "Solicitar Crear CCC Modo Agendamiento Cambio TTP $args.chg_ref_num";
         <PDM_SET args.ztx_status="PE_OCCCA">     
         <PDM_SET args.zflag_opccca="1">
    <PDM_ELIF "$args.KEEP.argCrearCCCE" == "1">
         form_title = "Solicitar Crear CCC Modo Ejecucion Cambio TTP $args.chg_ref_num";
         <PDM_SET args.ztx_status="PE_OCCCE">     
         <PDM_SET args.zflag_opccce="1">
    <PDM_ELIF "$args.KEEP.argRegIndis" == "1">
         form_title = "Registrar Indisponibilidad Cambio TTP $args.chg_ref_num";
         <PDM_SET args.zflag_indis="1">
    <PDM_ELIF "$args.KEEP.argCerrarCCC" == "1">
         form_title = "Solicitar Cerrar CCC Cambio TTP $args.chg_ref_num";
         <PDM_SET args.ztx_status="PE_CLCCC">     
         <PDM_SET args.zflag_clccc="1">
         <PDM_SET args.active="1">
    </PDM_IF>

     

    Thanks



  • 2.  Re: Update Status Using a Custom Button

    Broadcom Employee
    Posted 01-03-2018 10:13 AM

    Hello,

     

    This depends greatly on the status update in question.  What specifically are you trying to do with this function?  Is this button meant to render the status of Closed (ticket would need to be inactivated, all required fields for closure need to be satisfied).  



  • 3.  Re: Update Status Using a Custom Button

    Posted 01-03-2018 10:42 AM

    Hello David, 

     

    Actually I have a condition macro when the status of the change order pass from "Abierto" to "Aprobacion en Progreso"

     

     

    This is the code of the condition macro

     

     

    string wheretask;
    object wf_list, wf;

    wheretask=format("id=%d AND chgtype = 200",this.id);
    send_wait(0, top_object(), "call_attr", "chg", "sync_fetch", "STATIC", wheretask, -1, 0);

    if (msg_error())
    {
    logf(ERROR, "Error determinando el tipo del cambio: %s", msg[0]);
    set_return_data(FALSE);
    return;
    }
    else
    {
    int count;
    object obList;
    count = msg[1];
    obList = msg[0];
    if(count<=0)
    {
    logf(SIGNIFICANT, "Orden de Cambio: %s no es de tipo Normal", this.chg_ref_num);
    set_return_data(TRUE);
    return;
    }
    else
    {
    logf(SIGNIFICANT, "Orden de Cambio: %s es de tipo Normal", this.chg_ref_num);

    wheretask=format("chg=%d AND ((status = 'PEND' or status = 'WAIT' or status = 'WF-APENP' ) or assignee is NULL)",this.id);
    send_wait(0, top_object(), "call_attr", "wf", "sync_fetch", "STATIC", wheretask, -1, 0);


    if (msg_error())
    {
    logf(ERROR, "Error buscando tareas de workflow: %s", msg[0]);
    set_return_data(FALSE);
    return;
    }
    else
    {

    count = msg[1];
    obList = msg[0];
    logf(SIGNIFICANT, "Orden de Cambio: %s Transicion invalidada a estado Aprobacion en progreso tareas sin asignado: %s", this.chg_ref_num, msg[1]);

    if(count>0)
    {
    set_return_data(FALSE);
    return;
    }
    else
    {
    set_return_data(TRUE);
    return;
    }
    }


    }
    }

     

    then if the condition is true the change order pass to "Aprobacion en Progreso" and a evento is execute.... 

     

    the event execute an action macro to change the assigned and group.

     

     

    I want to do this using a button. It is possible or does not have any sense?



  • 4.  Re: Update Status Using a Custom Button

    Posted 01-03-2018 04:47 PM

    Hi Walter,

     

    I have not looked into this heavily but, we have an out of the box way to add buttons to the employee forms. Assuming you want to add this to analyst forms, I would see if you can reverse engineer the button after implementing it for employees and see if you can implement it on the analyst forms. This should work but, has not been tested. To see how to add a custom button for employees look at:

     

    Define Transition Types - CA Service Management - 14.1 - CA Technologies Documentation 

     

    You would create a transition type and select it in the Status Transition. Once that is done, a button should appear on employee forms. From there you would need to reverse engineer it.



  • 5.  Re: Update Status Using a Custom Button
    Best Answer

    Posted 01-16-2018 11:02 AM

    Thanks for you Answer, I implemented a solution less intrusive. I have just simple open an activity update status page from the button.

     

    the code

     

    Button

     

    <PDM_MACRO name=button caption="Enviar al CAB" func="enviarCAB();" hotkey_name="Enviar al CAB" id=btn501>

     

     

    Function

     

    function enviarCAB()
    {
    var htmpl_str = "+HTMPL=";
    htmpl_str += "order_status_change.htmpl";
    var query_str = cfgCgi + "?SID=" + cfgSID + "+FID=" + fid_generator() + "+FACTORY=" + "chg" + "+PERSID=chg:" + $args.id;
    var query_str1 = query_str + "+OP=UPDATE+ACTIVITY_LOG_TYPE=";
    //alert(cfgCgi);
    //alert(query_str1);
    var url= '\"' + query_str1 + '\"ST\"' + htmpl_str +'\"';
    var url2=  query_str1 + 'ST' + htmpl_str ;
    //popupActivityWithURL('\" + query_str1 + \"ST\" + htmpl_str +\"','status');
    popupActivityWithURL(url2);
    //document.location.href=query_str+"KEEP.IsPopUp=1";
    }