Service Desk Practitioners Forum
cancel

DB rules for history line creation/modification

Highlighted
David Iannucci
Respected Contributor.

DB rules for history line creation/modification

I'd like to be able to write database rules that fire when a history line is created or modified (in a work order in this case, but I'm sure any solution would be cross-item).

I've searched through the admin console and the docs I've got, but nothing's hitting me. We've got 4.5 SP 17.

Thanks,
Dave
Don't believe everything you think.
5 REPLIES
George M. Meneg
Acclaimed Contributor.

Re: DB rules for history line creation/modification

Hello Dave,

You cannot do that by the means of OVSD. To my knowledge there is no way to intercept the creation of a new history line without using a trigger at the table that holds history lines. That rules out db/ui rules.
menes fhtagn
Ruth Porter
Acclaimed Contributor.

Re: DB rules for history line creation/modification

Hi Dave,

As George says, you cannot do this but if you could explain what you are trying to do there might be an alternative way.

For example, have a custom field and set this as to be audited. Then you can use the custom field as the trigger and the audit gets it into history.

Hope this helps

Ruth
http://www.teamultra.net
David Iannucci
Respected Contributor.

Re: DB rules for history line creation/modification

Thanks George and Ruth.

What I'm trying to do is to set up a system in which events in the history of the ticket are stored as History lines, and each time one is added, the people relevant to the present ticket get emails about the new event.

I think maybe I'm catching on to what you said, Ruth: have a custom text field, and when text is entered into the field and saved, a db rule takes the text, creates a history line of it, and also does other actions that may be required, such as sending email. Is that what you're suggesting?

It doesn't seem possible normally to have a rule that creates a history line, but I suppose this could be done with an external command, by running sd_dataform.bat, say? Or if that's not possible, perhaps running a custom written app that uses the web API to do the job?

Dave
Don't believe everything you think.
David Iannucci
Respected Contributor.

Re: DB rules for history line creation/modification

Apparently I meant sd_event, not sd_dataform.

Dave
Don't believe everything you think.
George M. Meneg
Acclaimed Contributor.

Re: DB rules for history line creation/modification

Hello Dave,

Are you sure that you want to send an e-mail every time a history line is added? It would lead to a e-mail flood! Every time an audited field is modified (set on Administrator Console/Security/Audit Rules) a new history line is created! Furthermore you cannot catch the event by the means of OVSD.

However if you want an e-mail to be sent every time an audited field is changed, well it's simple. Create a db rule that will check if any of the audited fields is changed, (yes, you must run this check for every single one of this fields), then send an e-mail. If this is done with only one db rule, you won't be able to tell what field is modified so the notification mail must list them all. The other constraint is that the notification mail cannot be longer than 1000 characters (this is a hard coded limit on the size of the message in the "Send E-Mail message" panel of the DB rules.

However this won't catch history lines added by users. It only catch history lines added by system (the audit rules).

So you have first to decide, in what cases you want to notify for modification. For specified fields, or for all audited fields?
menes fhtagn