CA Service Management

Expand all | Collapse all

Macro action if a user is member group X

  • 1.  Macro action if a user is member group X

    Posted Jan 23, 2018 07:14 AM

    Hello community, 

     

    I have a question. I need to do a action macro, type workflow change order, with the next action:

       - The action macro check if the user creator change order (log_agent) is member group that group assignee workflow task, it's member, the workflow task is aproved 'APP'.

     

    is it possible to check with action macro if a user (log_agent, affected_contact, etc...) is member that a group?

    how?

     

    Sorry, I don't control the spell language.

     

    Thank you very much.

     

    Regards.



  • 2.  Re: Macro action if a user is member group X
    Best Answer

    Posted Jan 23, 2018 07:46 AM

    Hi,

    constraint is simple:

    send_wait(0, top_object(), "call_attr", "grpmem", "sync_fetch", "DYNAMIC", format("member = U'%s' AND group = U'%s'", chg.log_agent.id, group.id), -1, 0);
    if (msg_error()) {
         logf(ERROR, "%s > sync_fetch failed", persistent_id);
    } else {
         if (msg[1] > 0) {
              logf(SIGNIFICANT, "%s > [%s] is member of [%s]", persistent_id, chg.log_agent.combo_name, group.last_name);
              // INSERT YOUR CODE HERE //
         }
    }

    All you need is to search over group membership table (grpmem) for desired member and group, matching data means that contact is a part of group.

     

    Regards,

    Timur Alimov



  • 3.  Re: Macro action if a user is member group X

    Posted Jan 23, 2018 08:14 AM

    Thank for your fast response cdtj, 

     

    I will test your code and I will report the results.

     

    Best Regards



  • 4.  Re: Macro action if a user is member group X

    Posted Jan 24, 2018 05:50 AM

    Thank cdtj, Tested and working.

     

    Best Regards.