CA Service Management

 View Only
Expand all | Collapse all

Edit in List - User Description

  • 1.  Edit in List - User Description

    Posted May 01, 2013 06:32 PM
    We all know you can update the status of a ticket by using Activities...Update Status... and have a text box (User Description) to indicate why you are updating this status.

    We also know you can update the status of a list of tickets using the "Edit in List" function but there is no facility (OOTB) to put in a User Description.

    Has anyone attempted this customization and is willing to share the solution?


  • 2.  Re: Edit in List - User Description

    Posted May 13, 2016 05:06 AM

    Any update on this?

     

    I have same requirement now.

     

    Please help on this.



  • 3.  Re: Edit in List - User Description

    Posted May 13, 2016 06:34 AM

    Hi,

    you can use solution provided here:

    https://communities.ca.com/message/241868124#comment-241868124

    but you need to publish 2 attributes: trigger attr and trigger comment.

     

    Regards,

    cdtj



  • 4.  Re: Edit in List - User Description

    Posted May 13, 2016 08:42 AM

    Hi CDTJ,

     

    My requirement is to update a log comment for each ticket from Edit In List.

     

    If it is not possible by OOTB function, how to achieve this by creating a new field on CR then copy its content and add a log comment by spel.

     

    Can you please help with that spel code and trigger

     

    Thanks



  • 5.  Re: Edit in List - User Description

    Posted May 14, 2016 04:35 AM

    functionality that you are asking for are described in linked thread,

    in your situation you need to publish 2 attributes: z_trigger (string(16)) and z_trigger_comment (string(512)).

    both attributes should be available in list edit,

    you need to specify "trigger word" and use it in z_trigger attribute to perform decided action, for example word could be : LOG,

    then you need to update macro:

    if (z_trigger == "LOG") {

    <here some procedure to log comment where z_trigger_comment will be used>

    }

    you can use generic_activity_log for this purposes.

     

    on the end dont forget to clear z_trigger and z_trigger_comment.

     

    Regards,

    cdtj



  • 6.  Re: Edit in List - User Description

    Posted May 16, 2016 08:04 AM

    Hi CDTJ,

     

    User is not happy to enter values in two textbox in Edit List as per above idea. I want below customizations:

    1. How to hide the zComment column on list_cr.htmpl page keeping that filed in Edit in List

    2. How to add the value of zComment into activity log of the ticket once it is added from Edit In List.

     

    Note: zComment is on Cr (String 4000)

     

     

    Please help on this

     

    Thanks



  • 7.  Re: Edit in List - User Description

    Posted May 16, 2016 08:21 AM

    Hi,

    you can keep only 1 input if you need only log comment functionality, 2 controls are good to have universal tool to perform any batch activities.

    - you can add lsCol and make it hidden (check lsCol's params): <lscol .... hidden="yes" export="no">

    - you can use generic_activity_log for this purposes, trigger described in previous topic.



  • 8.  Re: Edit in List - User Description

    Posted May 16, 2016 09:56 AM

    Hi CDTJ,

    Thank you. <hidden=yes, export=no> is working as expected.

    My Spel:

     

    Trigger: POST_VALIDATE z_set_logcomment(zComment) 1337 FILTER(zComment{});

    Spel:

    --------------------------------------------------------

    cr::z_set_logcomment()

    {

    uuid who; 

    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id"); 

    who=msg[0]; 

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, "persistent_id", "zComment", "LOG", 0, 0); 

    if (msg_error()) { 

      logf(ERROR,"Error %s",msg[0]); 

    }

    }

    ----------------------------------------------------------

    I am getting error:

    Database checkin failed: INVALID zSetComment.spl:cr::z_set_logcomment

    Stdlog:

    05/16 09:43:56.83 SW-SDM01     spelsrvr             2144 ERROR        pcexec.c              1389 Too many args in function cr::z_set_logcomment (...) zSetComment.spl; expecting 0 but got 4

    05/16 09:43:56.83 SW-SDM01     spelsrvr             2144 ERROR        pcexec.c              6403 Spell interp failed at zSetComment.spl:cr::z_set_logcomment

    05/16 09:44:21.63 SW-SDM01     spelsrvr             2144 ERROR        pcexec.c              1389 Too many args in function cr::z_set_logcomment (...) zSetComment.spl; expecting 0 but got 4

    05/16 09:44:21.63 SW-SDM01     spelsrvr             2144 ERROR        pcexec.c              6403 Spell interp failed at zSetComment.spl:cr::z_set_logcomment

     

     

    Please help on this.

     

    Thanks



  • 9.  Re: Edit in List - User Description

    Posted May 17, 2016 02:45 AM

    Hi,

    when you're creating trigger from attribute (not from factory) or passing attribute directly to function (like you did in your code), function receive followed params:

    argv[0] - amount of attributes;

    ...

    argv[1] - attribute1;

    argv[2] - attr1 prev value;

    argv[3] - attr1 new value;

    ...

    argv[4] - attribute2;

    argv[5] - attr2 prev value;

    argv[6] - attr2 new value;

    ...

    etc

     

    So you need to enable incoming params in your function (add triple dot):

    cr::z_set_logcomment(...) {

    you can check what attributes are received by function to understand it better, using this code:

    for (i=0;i<argc;i++) {

    logf(SIGNIFICANT, "argv[%d] : %s", i, argv[i]);

    }

     

    And this codepart:

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, "persistent_id", "zComment", "LOG", 0, 0);

    this will try create log activity with static description "zComment", if you want to use zComment as variable, code will be :

     

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);

     

     

    Regards,

    cdtj



  • 10.  Re: Edit in List - User Description

    Posted May 17, 2016 08:32 AM

    Hi CDTJ,

     

    I have modified the spel as below:

    ---------------------------------

    cr::z_set_logcomment(...)

    {

    uuid who; 

    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id"); 

    who=msg[0]; 

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);

    for (i=0;i<argc;i++) {

    logf(SIGNIFICANT, "argv[%d] : %s", i, argv[i]);

    }

    }

    --------------------------------------

     

    But could not login to SDM. Domsrvr down. Stdlog says:

     

    05/17 08:28:17.40 SW-SDMQA01     domsrvr               756 ERROR        domdict.c             1898 No response to trigger acctyp::init_wsp (4 time) after 240 seconds; waiting another 480 seconds

    05/17 08:28:17.55 SW-SDMQA01     domsrvr               756 ERROR        domdict.c             1898 No response to trigger acctyp::init_wsp (4 time) after 240 seconds; waiting another 480 seconds

    05/17 08:28:17.55 SW-SDMQA01     domsrvr               756 ERROR        domdict.c             1898 No response to trigger acctyp::init_wsp (4 time) after 240 seconds; waiting another 480 seconds

    05/17 08:28:17.55 SW-SDMQA01     domsrvr               756 ERROR        domdict.c             1898 No response to trigger acctyp::init_wsp (4 time) after 240 seconds; waiting another 480 seconds

     

    Please help on this.

     

    Thanks



  • 11.  Re: Edit in List - User Description

    Posted May 17, 2016 08:41 AM

    you haven't initiated i as integer.

    this code should work well:

    cr::z_set_logcomment(...) {
        uuid who;
        int msg_i;
        send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
        if (msg_error()) {
            logf(ERROR, "Unable to get current user:");
            for (msg_i=0;msg_i<msg_length();msg_i++) {
                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
            }
        } else {
            who = msg[0];
        }
        send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);
        if (msg_error()) {
            logf(ERROR, "Unable to log comment for [%s]:", persistent_id);
            for (msg_i=0;msg_i<msg_length();msg_i++) {
                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
            }
        }
        send_wait(0, this, "call_attr", "zComment", "set_val", "", "SURE_SET");
        if (msg_error()) {
            logf(ERROR, "Unable to wipe comment for [%s]:", persistent_id);
            for (msg_i=0;msg_i<msg_length();msg_i++) {
                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
            }
        }
    }
    


  • 12.  Re: Edit in List - User Description

    Posted May 17, 2016 09:10 AM

    Sorry CDTJ. It gives Stglog as:

     

    05/17 09:08:11.62 SW-SDMQA01     spelsrvr             9012 ERROR        api.spl               5393 Object cr:1164598 checked out by someone else

    05/17 09:08:11.62 SW-SDMQA01     spelsrvr             9012 ERROR        zSetComment.spl         15 Unable to log comment for [cr:1164598]:

    05/17 09:08:11.62 SW-SDMQA01     spelsrvr             9012 ERROR        zSetComment.spl         17 msg[0] : Object cr:1164598 checked out by someone else



  • 13.  Re: Edit in List - User Description

    Posted May 17, 2016 09:16 AM

    here is the same problem: Object checked out by someone else

    try to modify trigger to run spel as ON_POST_VAL



  • 14.  Re: Edit in List - User Description

    Posted May 17, 2016 09:49 AM

    Hi CDTJ,

     

    zSetCommentTrigger.maj:

    ------------------------------------

    OBJECT cr { 

      ATTRIBUTES Call_Req { 

      zComment STRING{ 

      ON_POST_VAL z_set_logcomment() 62175 ; 

      }; 

      }; 

    };

    ------------------------------------

    zSetComment.spl:

    ------------------------------------------

    cr.zComment::z_set_logcomment(...) { 

        uuid who;

        int msg_i;

        send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");

        if (msg_error()) {

            logf(ERROR, "Unable to get current user:");

            for (msg_i=0;msg_i<msg_length();msg_i++) {

                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);

            }

        } else {

            who = msg[0];

        }

        send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);

        if (msg_error()) {

            logf(ERROR, "Unable to log comment for [%s]:", persistent_id);

            for (msg_i=0;msg_i<msg_length();msg_i++) {

                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);

            }

        }

        send_wait(0, this, "call_attr", "zComment", "set_val", "", "SURE_SET");

        if (msg_error()) {

            logf(ERROR, "Unable to wipe comment for [%s]:", persistent_id);

            for (msg_i=0;msg_i<msg_length();msg_i++) {

                logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);

            }

        }

    }

    ----------------------------------

     

    But it gives errors as below:

    05/17 09:48:09.01 SW-SDMQA01     spelsrvr             3932 ERROR        api.spl               5393 Object cr:1164598 checked out by someone else

    05/17 09:48:09.01 SW-SDMQA01     spelsrvr             3932 ERROR        zSetComment.spl         15 Unable to log comment for [cr:1164598]:

    05/17 09:48:09.01 SW-SDMQA01     spelsrvr             3932 ERROR        zSetComment.spl         17 msg[0] : Object cr:1164598 checked out by someone else

    05/17 09:48:09.02 SW-SDMQA01     domsrvr              6672 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 09:48:09.02 SW-SDMQA01     domsrvr              6672 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (3 time) after 120 seconds; waiting another 240 seconds

    05/17 09:48:09.02 SW-SDMQA01     domsrvr              6672 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (3 time) after 120 seconds; waiting another 240 seconds

     

     

    Please help on this

     

    Thanks



  • 15.  Re: Edit in List - User Description

    Posted May 17, 2016 09:56 AM

    okay, try to replace:

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);

    with:

    send_wait(0, top_object(), "call_attr", "api", "insert_object", who, "alg", NULL, 0, "call_req_id", persistent_id, "type", "LOG", "description", zComment, "time_spent", (duration)0);



  • 16.  Re: Edit in List - User Description

    Posted May 17, 2016 10:09 AM

    Stdlog is growing with:

     

    05/17 10:07:47.69 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.73 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.74 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.77 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.80 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.83 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.87 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.90 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.93 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds

    05/17 10:07:47.94 SW-SDMQA01     domsrvr              8852 ERROR        attr.c                5627 No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds



  • 17.  Re: Edit in List - User Description

    Posted May 17, 2016 10:12 AM

    there should be errors caused by SPL before, could you check for it?



  • 18.  Re: Edit in List - User Description

    Posted May 17, 2016 10:18 AM

    No error lines related to that spl before that CDTJ.



  • 19.  Re: Edit in List - User Description

    Posted May 17, 2016 11:15 AM

    Please help on this



  • 20.  Re: Edit in List - User Description

    Posted May 18, 2016 02:08 AM

    Sorry, but I have explained all my ideas, seems that I need to implement something like this in my test env to get it work.

    ---

    Regards,

    cdtj



  • 21.  Re: Edit in List - User Description

    Posted May 18, 2016 02:47 AM

    Thank you CDTJ.

    If you do so, that would be great help for me and to this community as a fulfillment of this thread.

     

    Thanks again



  • 22.  Re: Edit in List - User Description

    Posted May 18, 2016 04:29 AM

    Hi,

    look like form the logs that those corresponding object are still lock.

    Can you share here the trigger you used to fire your code?

    Regards,

    /J



  • 23.  Re: Edit in List - User Description

    Posted May 18, 2016 04:40 AM

    Trigger:

    zSetCommentTrigger.maj:

    ------------------------------------

    OBJECT cr {

      ATTRIBUTES Call_Req {

      zComment STRING{

      ON_POST_VAL z_set_logcomment() 62175 ;

      };

      };

    };



  • 24.  Re: Edit in List - User Description

    Posted May 18, 2016 04:47 AM

    Stdlog is growing with:

     

    05/18 04:45:45.59 SW-SDMQA01     spelsrvr             4684 ERROR        api.spl               5393 Object cr:1177917 checked out by someone else

    05/18 04:45:45.59 SW-SDMQA01     spelsrvr             4684 ERROR        zSetComment.spl         15 Unable to log comment for [cr:1177917]:

    05/18 04:45:45.59 SW-SDMQA01     spelsrvr             4684 ERROR        zSetComment.spl         17 msg[0] : Object cr:1177917 checked out by someone else



  • 25.  Re: Edit in List - User Description

    Posted May 18, 2016 09:41 AM

    Any update on this?

     

     

    Thanks



  • 26.  Re: Edit in List - User Description

    Posted May 18, 2016 01:03 PM

    I'm no expert on spel but based off what I've seen modifying your zSetCommentTrigger.maj file with the below code may help.  Test that and let us know if it works, if not then I would wait for cdtj or jmayer to comment.

     

     

    OBJECT cr {

      ATTRIBUTES Call_Req {

      zComment STRING

        };

      TRIGGERS {

      POST_VALIDATE z_set_logcomment() 62175 FILTER( zComment{});

      };

    };



  • 27.  Re: Edit in List - User Description

    Posted May 19, 2016 04:30 AM

    It is working with below .mod file

     

    MODIFY cr POST_VALIDATE z_set_logcomment() 62175 FILTER(zLogComment{});

     

    Thank you all.



  • 28.  RE: Re: Edit in List - User Description

    Posted Aug 14, 2020 01:50 AM
    Edited by Radek Mihalik Aug 20, 2020 12:56 AM
    Hi guys, 

    I went through this thread and tried to do the same like Anon Anon did.
    But Im not able to get the successful result - i'm not sure what is the final solution by Anon Anon attempt, because I see several solutions in the thread. Is there somebody, who use the solution and can advise me, what I have wrong?

    My approach:

    1. create new zComment filed using WSP (string 4000)
    2. add the field to formular list_cr (list section + Edit in List section)
    3. new spel file (located in site/mods/majic) - zSetComment.spl
    4. new maj file (located in site/mods/majic) - zSetCommentTrigger.maj
    5. new mod file (located in site/mods/majic) - zSetComment.mod

    Errors i get:
    after SDM restart is see in std log 2 Errors:
    Ignoring duplicate definition of attribute zComment in object cr
    Use MODIFY statement to modify previously-defined items

    when I try to add zComment in "Edit in List", I get the timeout errors like:
    No response to trigger cr.zComment::z_set_logcomment (3 time) after 120 seconds; waiting another 240 seconds
    No response to trigger cr.zComment::z_set_logcomment (1 time) after 30 seconds; waiting another 60 seconds


    zSetComment.spl

    cr.zComment::z_set_logcomment(...) {
    uuid who;
    int msg_i;
    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
    if (msg_error()) {
    logf(ERROR, "Unable to get current user:");
    for (msg_i=0;msg_i<msg_length();msg_i++) {
    logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
    }
    } else {

    who = msg[0];
    }

    send_wait(0, top_object(), "call_attr", "api", "generic_activity_log", who, persistent_id, zComment, "LOG", 0, 0);

    if (msg_error()) {
    logf(ERROR, "Unable to log comment for [%s]:", persistent_id);
    for (msg_i=0;msg_i<msg_length();msg_i++) {
    logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
    }
    }

    send_wait(0, this, "call_attr", "zComment", "set_val", "", "SURE_SET");
    if (msg_error()) {
    logf(ERROR, "Unable to wipe comment for [%s]:", persistent_id);
    for (msg_i=0;msg_i<msg_length();msg_i++) {
    logf(ERROR, "\tmsg[%d] : %s", msg_i, msg[msg_i]);
    }
    }
    }

    ---------------------------------------------------------------------------------------------------
    zSetCommentTrigger.maj

    OBJECT cr {
    ATTRIBUTES Call_Req {
    zComment STRING{
    ON_POST_VAL z_set_logcomment() 62175 ;
    };
    };
    };

    ---------------------------------------------------------------------------------------------------
    zSetComment.mod

    MODIFY cr POST_VALIDATE z_set_logcomment() 62175 FILTER(zComment{});

    ------------------------------
    Radek Mihalik
    CZ
    ------------------------------



  • 29.  RE: Re: Edit in List - User Description

    Posted Aug 21, 2020 03:00 AM
    Hi guys...somebody who tried replicate my unsuccessful attempt?
    RM

    ------------------------------
    Radek Mihalik
    CZ
    ------------------------------



  • 30.  RE: Re: Edit in List - User Description

    Posted Aug 22, 2020 11:01 PM
    Edited by James Campbell Aug 23, 2020 05:52 AM
    Hi Radek,
    From a quick look you seem to be launching 'z_set_logComment' twice - once through a field-level ON_POST_VAL trigger in 'zSetCommentTrigger.maj' and once through a post-validate trigger against the 'cr' object in 'zSetComment.mod'.  That is likely to result in a deadlock - and you also specify the same firing order (62175) for both of them which probably doesn't help.  I would delete 'zSetCommentTrigger.maj' (or change its extension to '.txt') and restart.  I would also try commenting out the code in 'zSetComment.spl' that blanks the zComment field, until you get the activity log record successfully being created - in my experience it helps to approach these issues incrementally as otherwise it can be difficult to see what exactly is going wrong.  It's also worth adding some 'logf(SIGNIFICANT...' statements to trace the progress.
    Hope that helps!
    Regards,
    James


  • 31.  RE: Re: Edit in List - User Description

    Posted Aug 23, 2020 11:08 AM
    Hi Radek.
    From what I can see, You have an attribute trigger, which gets fired when the value of the attribute changes.
    Unfortunately,  you set this attribute again inside your trigger code. This will trigger your code again, and again  and again, and again.....
    I assume this is the reason the first trigger never ends, hence the messages in the logs.
    I suggest, set the attribute in your trigger only if it is needed.
    Anyway, as James mentioned,  you declared an object trigger additionaly. But you did not provide any code for this trigger. So, This will fail as soon your first trigger will work, I assume.
    Regards.
    ....Michael

    ------------------------------
    Principal Services Consultant
    HCL Enterprise Studio
    Germany
    ------------------------------