CA Service Management

How to create a custom Activity Notification and link it to a request custom status 

Jan 22, 2019 10:50 AM

What I needed to do:

I wanted an event to only trigger when I get to a specific (custom) status that doesn't have an Activity Notification created. I couldn't handle it with a condition on the event so I created my own AN.

Here's what I did.

 

Create your custom Activity Notification.

Complete the symbol and code fields, and in my case I'll need it for Request tickets so I'm checking the "Requests/Incidents/Problems" option.

Creating Activity Notification

 

Assign it's corresponding events.

Assigning Events

 

Go to your Web Screen Painter's Schema Designer, find the "cr" object and add a custom trigger with the name of the .spl file that we'll create later, and link it to the status that you want to work with. In this case my .spl fille will be called "zActivityNotificationEnConfirmacion" and I'm using a custom status called "FXD".

 

POST_CI zActivityNotificationEnConfirmacion(persistent_id,status,id) 330 FILTER (status {->"FXD"}); 

WSP Trigger

 

Save and publish. 

Run a pdm_publish

 

Now go to your $NX_ROOT/site/mods/majic folder and create a new .spl file with the name you assigned on the Schema Designer.

In my case it's "zActivityNotificationEnConfirmacion.spl"

cr::zActivityNotificationEnConfirmacion(...){


   uuid login_userid;
   send_wait(0, top_object(), "call_attr", "cr", "current_user_id");
   login_userid = msg[0];

   uuid who;
   int msg_i;
   string persid, ticketid;

 

   persid=argv[0];
   ticketid=argv[2];

   send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
   if (msg_error()) {
      who = msg[0];
   }
   send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)who, "alg", NULL, 0,
      "call_req_id", ticketid,
      "time_spent", (duration)0,
      "type", "ENC",
      "analyst", login_userid,
      "description", format("La resolución del ticket se encuentra en confirmación"),
      "action_desc", format("generated by SPEL")
   );
   if (msg_error()) for (msg_i = 0; msg_i < msg_length(); msg_i++) logf(ERROR, "%s > msg[%d]: %s", persid, msg_i, msg[msg_i]);
}

 

Restart Service Desk's service.

Create a ticket and update it to your custom status.

Check your ticket's activity log.

The one we just created is the one called "En confirmación".

 

Hope it helps someone, took a little while for me to figure out how to do it.

Let me know if there's a simplier way to do it, I think mine's alright but the SPEL file might be improved.

Statistics
0 Favorited
10 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.