/build/static/layout/Breadcrumb_cap_w.png

Rule reports found row and appending comment on all saves

I am testing a new rule that runs on save.  Every time a ticket is saved the result says it found  1 row and even says it applied the comment which I have added to the rule by checking the "append comment to ticket" option.  The thing is, that it is working as designed, it only actually appends the comment when all of the "where" statement is true.  I dont like this from a troubleshooting stand point.    Why would kace say it applied the rule when it didnt. I tried putting parents around the entire statement with no change.    

Anyone know why this is happening? This is KACE SMA 11.1.  This is in our dev server and the date is wrong fyi..  We dont allow external access so it cant fix the clock.


WHERE

HD_TICKET.HD_QUEUE_ID = '1' 

/* and C.DESCRIPTION LIKE '%Closed%' */

and (SERVICE.ID = 21 or SERVICE.ID = 31) /* Employee onboard */

and ST.ORDINAL = 3 /* Stage 3 */

and  (CAT.NAME like "%Groups and Access%" ) 

and (HD_STATUS.STATE = 'closed')



10/13/2021 04:47:23> Starting: 10/13/2021 04:47:23 10/13/2021 04:47:23> Executing Select Query... 10/13/2021 04:47:23> selected 1 rows 10/13/2021 04:47:23> Adding ticket comments... 10/13/2021 04:47:23> updated 1 tickets 10/13/2021 04:47:23> Ending: 10/13/2021 04:47:23
Here is the rest of the script for what it is worth.

SELECT      -- ticket fields      HD_TICKET.ID, -- $id      HD_TICKET.ID AS TICKNUM, -- $ticknum      HD_TICKET.TITLE, -- $title      DATE_FORMAT(HD_TICKET.CREATED,'%b %d %Y %I:%i:%s %p') AS CREATED, -- $created      DATE_FORMAT(HD_TICKET.MODIFIED,'%b %d %Y %I:%i:%s %p') AS MODIFIED, -- $modified      -- change fields      C.COMMENT, -- $comment      C.DESCRIPTION, -- $description      GROUP_CONCAT(CONCAT('----- Change by ', UPDATER.EMAIL,' at ',H.TIMESTAMP,' -----\n',       H.DESCRIPTION,'\n',H.COMMENT,'\n\nPlease see your ticket at http://help.eastdilsecured.com/adminui/ticket.php?ID=',H.HD_TICKET_ID,'\n')       ORDER BY H.ID DESC SEPARATOR '\n') HISTORY, -- $history      -- about the updater      UPDATER.USER_NAME AS UPDATER_UNAME, -- $updater_uname      UPDATER.FULL_NAME AS UPDATER_FNAME, -- $updater_fname      UPDATER.EMAIL AS UPDATER_EMAIL,     -- $updater_email      IF(UPDATER.FULL_NAME='',UPDATER.USER_NAME,UPDATER.FULL_NAME) AS UPDATER_CONDITIONAL, -- $updater_conditional      -- about the owner      OWNER.USER_NAME AS OWNER_UNAME, -- $owner_uname      OWNER.FULL_NAME AS OWNER_FNAME, -- $owner_fname      OWNER.EMAIL AS OWNER_EMAIL,     -- $owner_email      IFNULL(OWNER.USER_NAME,'Unassigned') OWNER_USER, -- $owner_user      -- about the submitter      SUBMITTER.USER_NAME AS SUBMITTER_UNAME, -- $submitter_uname      SUBMITTER.FULL_NAME AS SUBMITTER_FNAME, -- $submitter_fname      SUBMITTER.EMAIL AS SUBMITTER_EMAIL,     -- $submitter_email      -- about priority      P.NAME AS PRIORITY, -- $priority      -- about status      S.NAME AS STATUS,   -- $status      -- about impact      I.NAME AS IMPACT,   -- $impact      -- about category      CAT.NAME AS CATEGORY, -- $category      -- -- example of static distribution list"email@email.com" AS NEWTICKETEMAIL -- $newticketemail
    FROM HD_TICKET     /* latest change ***/ JOIN HD_TICKET_CHANGE C ON C.HD_TICKET_ID = HD_TICKET.ID AND C.ID=<CHANGE_ID>     /* complete history*/ JOIN HD_TICKET_CHANGE H ON H.HD_TICKET_ID = HD_TICKET.ID     /* priority ********/ JOIN HD_PRIORITY P ON P.ID=HD_PRIORITY_ID     /* status **********/ JOIN HD_STATUS S ON S.ID=HD_STATUS_ID     /* impact-severity */ JOIN HD_IMPACT I ON I.ID=HD_IMPACT_ID     /* category ********/ JOIN HD_CATEGORY CAT ON CAT.ID=HD_CATEGORY_ID     /* owner ***********/ LEFT JOIN USER OWNER ON OWNER.ID = HD_TICKET.OWNER_ID     /* submitter *******/ LEFT JOIN USER SUBMITTER ON SUBMITTER.ID = HD_TICKET.SUBMITTER_ID     /* updater *********/ LEFT JOIN USER UPDATER ON UPDATER.ID = C.USER_IDInner Join ORG1.HD_STATUS On ORG1.HD_STATUS.ID = ORG1.HD_TICKET.HD_STATUS_IDjoin HD_SERVICE_TICKET ST on HD_TICKET.SERVICE_TICKET_ID = ST.IDjoin HD_SERVICE SERVICE on ST.HD_SERVICE_ID = SERVICE.ID/* queue */JOIN HD_QUEUE ON HD_TICKET.HD_QUEUE_ID = HD_QUEUE.ID

0 Comments   [ + ] Show comments

Answers (1)

Posted by: Hobbsy 1 month ago
Red Belt
0

Try adding to your SELECT statement HD_TICKET.* 


SELECT

HD_TICKET.*,


HD_TICKET.ID, -- $id     

HD_TICKET.ID AS TICKNUM, -- $ticknum     

HD_TICKET.TITLE, -- $title

Etc etc and see if that works

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ