CA Service Management

 View Only
  • 1.  ACT Macro

    Posted Mar 23, 2018 08:05 AM

    I am using this code found here: How to skip request workflow task automatically  when I do the pdm_load as "Inactive" and look at it, it appears to be exactly how I need it. However, when I select "Save" (either as Active or keeping it Inactive) only the set_return_data(TRUE); shows in the code, no errors. I thought maybe it was truncating it, but when I do a pdm_extract of the table, that is all it shows for that macro. I am certain I am missing something but would appreciate any assistance in identifying it, here is what it looks like in Service Desk after the pdm_load:

       FTBWF10APP Macro Detail - CA Service Desk Manager

    string method; method="FTBWF10APP";
    string theChg;
    theChg = this.chg;
    //
    // Look up task 100 from the chg id.
    //
    send_wait(0, top_object(), "call_attr", "wf", "sync_fetch",
    "RLIST_DYNAMIC", format("chg=%d and sequence=10 and status='APP'", theChg), -1, 0);
    if (msg_error())
    {
    logf(ERROR, "%s: Error on sync_fetch for %s WFs: '%s'", method, theChg, msg[0]);
    return;
    }
    object wf_list;
    int wf_count;
    wf_list = msg[0];
    wf_count = msg[1];
    logf(TRACE, "%s - %d recs found for chg %d", method, wf_count, theChg);
    if (wf_count > 0)
    {
    // Have at least one task 10 with status APP (in reality of course there can only be one)
    set_return_data(TRUE);
    }
    else
    {
    set_return_data(FALSE);
    }

    but after I save it:

    set_return_data(TRUE);



  • 2.  Re: ACT Macro

    Broadcom Employee
    Posted Mar 23, 2018 10:00 AM

    Jessie, what if you change "

    if (wf_count > 0)
    {
    // Have at least one task 10 with status APP (in reality of course there can only be one)
    set_return_data(TRUE);
    }
    else
    {
    set_return_data(FALSE);
    }

    "

    to "

    if (wf_count > 0) {
    // Have at least one task 10 with status APP (in reality of course there can only be one)
    set_return_data(TRUE);
    } else {
    set_return_data(FALSE);
    }

    "

    Thanks _Chi



  • 3.  Re: ACT Macro

    Posted Mar 23, 2018 10:25 AM

    Thank you, I tried it again and got the same error. I am able to save the code as a condition but not a site-defined condition. Is that because the object is the Change Workflow Task? Will it perform the same function as a condition for transition as if it were a site-defined condition?



  • 4.  Re: ACT Macro

    Broadcom Employee
    Posted Mar 23, 2018 10:42 AM

    Jessie, that is strange...you can save it as condition but not site-defined condition...I would think the opposite. Save as condition anyway as you will be able to use it in status transitions. Thanks _Chi



  • 5.  Re: ACT Macro
    Best Answer

    Posted Mar 25, 2018 11:01 PM

    When you edit a site-defined condition, the edit page builds the code from the 'atomic conditions' that you would select when you construct the condition.  So when you edit and save a hand-coded site-defined condition macro, the code gets re-assembled from the atomic conditions - and since there aren't any, the code disappears.  That will be why you can save it as type COND but not as type COND_SITE.

     

    Apart from that, I hope you've 'spotted the deliberate mistake' :-) - the code I posted was appropriate for a 'wf' rather than a 'cr_wf', so you will need to substitute 'cr' for 'chg' wherever 'chg' or 'Chg' appears...

     

    Regards,

    James



  • 6.  Re: ACT Macro

    Broadcom Employee
    Posted Mar 27, 2018 12:00 PM

    Jessie.........

     

    Are you still having issues with this topic?