Ticket rule question
Is there a way to reference a field in Assets when creating a ticket rule?
I'd like to create a custom field in Assets that is for the number of repairs a computer has had, and then have a custom ticket rule that fires off an email when that field is modified.
Possible?
Thanks!,
Jesse
I'd like to create a custom field in Assets that is for the number of repairs a computer has had, and then have a custom ticket rule that fires off an email when that field is modified.
Possible?
Thanks!,
Jesse
0 Comments
[ + ] Show comments
Answers (6)
Please log in to answer
Posted by:
GillySpy
13 years ago
Posted by:
JesseLara
13 years ago
Posted by:
JesseLara
13 years ago
So I gave this a shot, and although it works "as advertised", the issue I think I'm going to have is how the reports are delivered. I was hoping to be able to set a field for number of repairs a computer has had, and then have the system email someone to let them know, "this is the 1st repair on this CPU", or "this is the 2nd repair on this CPU", etc.....
Doing it this way limits me to run it on a schedule and I was hoping more for a "on ticket save" kind of action that would generate the email only once and not on a schedule, causing the person getting the emails to get the same email or notification over and over on the schedule.
Jesse
Doing it this way limits me to run it on a schedule and I was hoping more for a "on ticket save" kind of action that would generate the email only once and not on a schedule, causing the person getting the emails to get the same email or notification over and over on the schedule.
Jesse
Posted by:
airwolf
13 years ago
Posted by:
JesseLara
13 years ago
That would be awesome of you, but I don't want to put you through the wringer trying to figure it out for me. I totally appreciate the offer. Although I'm comfortable with my KBOX, I'm not that comfortable with the database and would hate to fudge something up.
For now I could create a field in the ticket that would fire off the email that will do what I'm thinking, I would just hoping to make it a field in assets to better track it.
For now I could create a field in the ticket that would fire off the email that will do what I'm thinking, I would just hoping to make it a field in assets to better track it.
Posted by:
airwolf
13 years ago
Actually, since asset changes aren't tracked in the database (at least changes to the fields themselves) you'll have to check the ASSET_HISTORY table and scan entries for the field name you are monitoring. In other words, you'd want a 15 minute scheduled job to check for changes within the past 15 minutes that have occurred to your field. An OTS rule will not work, because OTS has nothing to do with asset table changes. You would want "On Asset Change" - which unfortunately doesn't exist. Anyway, I digress.
Try this. Setup a job to run every 15 minutes as follows. The only parts you'll have to change are the ASSET_DATA_5 table (to find the correct number, go to your asset type and you'll see the ID in the URL), the %field_name% part, and the email address at the beginning of the select query. Just wrap the field's name in percent symbols (%) - these are wildcards in MySQL. So this rule is basically saying, "find me all assets of this type where a specific field shows up in asset history in the past 15 minutes..." which means the field changed. It will then send an email to the specified address in the query for each result.
Select Query:
Check the box that says, "Send an email for each result row," and make sure you put "EMAIL" without quotes as the email column. You can write whatever subject and body you want. You can use $name as a variable to tell you the asset name in the subject or body of the email.
Try this. Setup a job to run every 15 minutes as follows. The only parts you'll have to change are the ASSET_DATA_5 table (to find the correct number, go to your asset type and you'll see the ID in the URL), the %field_name% part, and the email address at the beginning of the select query. Just wrap the field's name in percent symbols (%) - these are wildcards in MySQL. So this rule is basically saying, "find me all assets of this type where a specific field shows up in asset history in the past 15 minutes..." which means the field changed. It will then send an email to the specified address in the query for each result.
Select Query:
select A.NAME as 'Name', 'user@domain.com' as EMAIL from ASSET A
join ASSET_DATA_5 AD on (AD.ID = A.ASSET_DATA_ID)
join ASSET_HISTORY AH on (AH.ASSET_ID = A.ID)
where AH.DESCRIPTION like '%field_name%' and TIME_TO_SEC(TIMEDIFF(AH.TIME, NOW())) < 900
Check the box that says, "Send an email for each result row," and make sure you put "EMAIL" without quotes as the email column. You can write whatever subject and body you want. You can use $name as a variable to tell you the asset name in the subject or body of the email.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.