CA Service Management

  • 1.  Action Macro Code

    Posted Sep 09, 2016 02:05 PM

    Hi all!

     

    I would like to know if, only at the moment of the resolution of the ticket, how can I set the action macro to assume that the assignee is the same user which resolved the ticket? Is it possible?

     

    I've tried to set "assignee = last_mod_by", but I got a "Macro error".

     

    Could you please give me a light with this?

     

    The version of the SDM is 12.9.

     

    Thanks!



  • 2.  Re: Action Macro Code

    Posted Sep 09, 2016 04:55 PM

    Hi Paulo,

    I dont believe this is possible because you cant do a comparison of fields - meaning, you cant say where field1=field2 as that is not supported.  Can you give us a bit more info about specifically what the need is, and the bigger picture of what you are trying to do?  There may be a different way of accomplishing that

    Jon



  • 3.  Re: Action Macro Code

    Posted Sep 09, 2016 05:35 PM

    Hi,

     

    This can be accomplished with a trigger looking for status changing to Resolved and assignee not equal to last_mod_by. This trigger then fires spel code to update assignee.  

     

    As John mentioned this wouldn't be supported by CA and depending on what you're after there may be a better way to accomplish this.  

     

    If you decide you do want to customize for this specific use case then let me know.  I can provide a basic mod/spl script to accomplish this.



  • 4.  Re: Action Macro Code

    Posted Sep 12, 2016 08:37 AM

    Hi, i don't have possibility to test, but it should look like this

     

    uuid who; 
    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id"); 
    who=msg[0]; 
    send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "assignee", format("cnt:%s", who); 



  • 5.  Re: Action Macro Code

    Posted Sep 27, 2016 10:52 AM

    Hi!

     

    Thanks to all the replies!

     

    I tried to use the code above, but still no works for me!

     

    The scenario is: at the moment of ticket's resolution activity (Solution), if the user/analyst who's doing the change of the status, is a member of the L1 group, so the SDM should assume and set the user/analyst as the assignee of the ticket.

     

    Here's the code which I tried to use at the action macro, using the exemple below:

     

    uuid new_assignee;

    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
    new_assignee= current_user_id;
    send_wait(0, top_object(), "call_attr", "api", "update_object_super", new_assignee, persistent_id, 0, "assignee", format("cnt:%s", new_assignee);

     

    Is it right?

     

    Thanks!



  • 6.  Re: Action Macro Code

    Posted Sep 27, 2016 12:49 PM

    Hi,

     

    This code can't be used in an action macro.  You will need to create a .spl file with that code as the contents and then a mod file to trigger the function.

     

     

    Here's an example of how to use this:

     

    1. Create a file named zSetAssignee.spl in nx_root/site/mods/magic with the following contents.

    cr::zSetAssignee(...)
    {
    string Method;
    Method ="zSetAssignee";

    uuid who; 
    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id"); 
    who=msg[0]; 
    send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "assignee", who;
    }

    2. Create a file named zSetAssignee.mod in nx_root/site/mods/magic with the following contents.

    MODIFY cr     POST_VALIDATE zSetAssignee() 4001 FILTER( status{->"RE"} && (assignee != last_mod_by) );

    3. Restart SDM services and test



  • 7.  Re: Action Macro Code

    Posted Sep 27, 2016 04:17 PM

    I think that update_object_super willn't work here because object already checked out via Web Interface, so simple assignment like:

    assignee = (uuid)who;

    or

    send_wait( 0, this, "call_attr", "assignee", "set_val", (uuid)who, "SURE_SET");

    should work well.

     

    Also I think that there is no reason to check "(assignee != last_mod_by)" in filter, if not it will be changed, if yes nothig happens.

     

    And... this can be done using Action Macro attached to specific Activity Log type

    My 2 cents



  • 8.  Re: Action Macro Code

    Posted Sep 27, 2016 04:45 PM

    Hi cdtj,

     

    Thank you for clarifying.  update_object_super will work, I tested it in my dev environment.  The trigger I wrote fires the function on checkin (post_validate).  Good to know you can also do this with a spell macro though, that's a simpler way of accomplishing this.



  • 9.  Re: Action Macro Code

    Posted Sep 27, 2016 06:37 PM

    Thanks for sharing! Sounds like this method could override system lock.

    BTW simpler way, I thought, is to pass hidden input named SET.assigne with value equal to $cst.id on status change form



  • 10.  Re: Action Macro Code

    Posted Oct 11, 2016 10:59 AM

    Hi all!

     

    Thanks for the help of you all!

     

    With your help, I made the modification, following which was expected!

     

    I created the "Action" macro, with the code "assignee = (uuid)last_mod_by;" and I also created a "Site defined condition" macro, to be used as a condition to trigger an event that calls the action macro, and then, I set the event at the "Log Solution" ticket's activity.

     

    Thanks again for the help of your!

     

    Best regards!