CA Service Management

  • 1.  Execute SPL Function from a Button

    Posted Oct 19, 2017 02:48 PM

    Hey guys,

     

    Im trying to run a spel code to change the status of all child tickets from detail_cr form.

    Following some instructions from the communities I came to the code below to create the file op_custom.cfg:

     

    Z_CHANGE_STATUS z_change_status MODIFY UPDATE

     

    My spel code is working fine with the .mod trigger, to run thhe spel from a butto i inserted the following code into the request form:

     

    function z_change_status(){
    var url = cfgCgi +
    "?SID=" + cfgSID +
    "+FID=" + fid_generator() +
    "+OP=z_change_status" +
    "+FACTORY=cr" +
    "+PERSID=" + argPersistentID +
    "+POPUP_NAME=" + '$args.KEEP.POPUP_NAME' +
    "+KEEP.POPUP_NAME=" + '$args.KEEP.POPUP_NAME' +
    "+CURRENT_USER=" + "$cst.id";
    "+CALLBACK=null";
    display_new_page(url, ahdframeset.workframe);
    }
    <PDM_MACRO name=button Caption="Aprovar filhos" Func="z_change_status()" hotkey_name="Aprovar filhos[A]" ID=APROVE>

     

    All of these customizations were based on the topic SPEL: Register custom webengine OP , but it is very likely that I am doing something wrong.

     

    When I run the button to change the status the SDM logs inform me that:

     

    config_file.c 546 Unable to find the security value for the operation, z_change_status. Default to NONE (0) freeaccess.spl 14675 Unknown webengine operation "z_change_status"

     

    Can anyone help to understand what am i doing wrong?

     

    Many thanks!!!



  • 2.  Re: Execute SPL Function from a Button

    Broadcom Employee
    Posted Oct 19, 2017 03:03 PM

    Diego, please change

    OP=z_change_status
    to
    OP=Z_CHANGE_STATUS
    and recycle and try again. Thanks _Chi


  • 3.  Re: Execute SPL Function from a Button

    Posted Oct 19, 2017 03:48 PM

    Hi Chi_Chen!!

     

    Many thanks for your reply!

     

    In fact, something changed after I put the name of the function in the upper case.

     

    The problem now is that the page is loading for a few seconds and then gives a slow response from the server message error.

     

    I really can not imagine what it can be!

     

     



  • 4.  Re: Execute SPL Function from a Button

    Posted Oct 19, 2017 03:49 PM

    In the stdlog file theres no error message that justifies server slow response.



  • 5.  Re: Execute SPL Function from a Button
    Best Answer

    Posted Oct 19, 2017 04:34 PM

    Hi Diego,

     

    The problem may be with your callback..  Try updating your z_change_status script to the following.

     

    z_change_status(...)
    {
         long some_id;
         some_id = argv[0];
         logf(SIGNIFICANT, "some_id: %s", some_id);
         object new_obj;
         new_obj = argv[1];
         logf(SIGNIFICANT, "Persid: %s Contact: %s", new_obj.PERSID, new_obj.CURRENT_USER);
         string callback;
         callback = "parent.ahdframe.refreshForm();\n";
         z_change_status_sub_process((uuid)new_obj.CURRENT_USER, (string)new_obj.PERSID);
         send_frame_resp((long)some_id, (object)new_obj, (string)callback);
    }

     

    Now move your code for looping through tickets to an additional script, z_change_status_sub_process.  This is called at the end of the z_change_status script.

     

    z_change_status_sub_process(uuid user, string persid)
    {
    ...insert code here
    }


  • 6.  Re: Execute SPL Function from a Button

    Broadcom Employee
    Posted Oct 20, 2017 09:15 AM

    Diego, did you try the suggestion Grant made here? If after this, you still get problem please attach the detail_cr.htmpl and the spl file here. I will try it out in the lab here and see if I can figure out something. Thanks _Chi



  • 7.  Re: Execute SPL Function from a Button

    Broadcom Employee
    Posted Oct 20, 2017 09:17 AM

    Diego, I forgot one thing...also let us know your SDM version. Thanks _Chi



  • 8.  Re: Execute SPL Function from a Button

    Posted Oct 26, 2017 10:44 AM

    Hi everyone!

     

    Sorry for the delay in reply!

     

    I'm back on my client today and I'm going to test the code suggested by Grant!

     

    In time, the SDM version of this client is at 14.1 hmp-181. T

     

    Thanks again for all the support, as soon as i run the tests i communicate to you!