Jump to content
netseer

Resolved: Log Comment Notification

Recommended Posts

Hi,

I was asked to implement a functionality for this:

When a Log Comment is made on a Request or Incident, a notification needs to be sent as follows:

If the ticket is Unassigned, the whole Group needs to be get the notification (I have this working OK).

If the ticket is Assigned and the person adding the Log Comment is NOT the Assignee, the Assignee needs to get the notification.

I can send the notification to the Assignee when the ticket is Assigned, but I am having troubles validating that the "Log Comment Analyst" is different to the "Assignee".

I tried a Condition Macro with the following code:

if (!is_null(call_req_id.assignee) && analyst != call_req_id.assignee) {
   set_return_data(TRUE);
} else {
   set_return_data(FALSE);
}

I am getting the following error in log:

Spell interp failed at Ticket is Assigned and Log Analyst is different:2::get_attr on call_req_id.assignee failed: AHD03066:Unknown name call_req_id

If I remove the first part and leave it like:

if (analyst != call_req_id.assignee) {
   set_return_data(TRUE);
} else {
   set_return_data(FALSE);
}

I get the error as: Spell interp failed at Ticket is Assigned and Log Analyst is different:2:: get_attr on analyst failed: AHD03066:Unknown name analyst

My idea is to do it without adding triggers and SPLs (if possible).

Thanks in advance for your help.

Edited by netseer

Share this post


Link to post
Share on other sites

What kind of macro are you using, meaning, in which context is this macro executed? I guess, it's executed in the context of the request/incident and not in the context of the log comment. Therefore neither "call_req_id" nor "analyst" are known attributes.

But the current analyst of the log comment is equal to the logged in user, right?

So you could compare the actual logged in user against the assignee of the ticket. Something like

send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
if ( !is_null(assignee) && assignee != msg[0] ) {
   set_return_data(TRUE);
} else {
   set_return_data(FALSE);
}

Share this post


Link to post
Share on other sites
What kind of macro are you using, meaning, in which context is this macro executed? I guess, it's executed in the context of the request/incident and not in the context of the log comment. Therefore neither "call_req_id" nor "analyst" are known attributes.

But the current analyst of the log comment is equal to the logged in user, right?

So you could compare the actual logged in user against the assignee of the ticket. Something like

send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
if ( !is_null(assignee) && assignee != msg[0] ) {
   set_return_data(TRUE);
} else {
   set_return_data(FALSE);
}

Yes, I knew it was not working because it was running at the cr level and not the alg level, but I did not know how to validate it. I tried your solution and I have the functionality working with the expected results.

Thanks a lot for all your help!!!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...