Thank you Ram�n,
I have had a look at the documentation in that area and am now starting to
experiment. It looks like that is a good place to be.
I have enclosed a bit of code from what I am now doing. It intends to
delete a trigger if it exists, before creating it. If you (or anyone else)
knows what the error is trying to say I would be grateful.
Many thanks,
Doug Pickering
ClassMethod MakeTriggers(name as %String)
{
Set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(name)
Write "Adding triggers to " _ cdef.Name ,!
Set count = cdef.Triggers.Count()
For i = 1:1:count {
if cdef.Triggers.GetAt(i).Name = "TriggerOnInsert"
{
set oid = cdef.Triggers.GetAt(i).%Id()
write oid,!
set status = ##class(%Dictionary.TriggerDefinition).%Delete(oid)
If $SYSTEM.Status.IsError(status) {
Do DecomposeStatus^%apiOBJ(%objlasterror,.Err)
Write !,Err(Err)
}
}
}
...
When run produces:
Adding triggers to User.Titles
User.Titles||TriggerOnInsert
<LIST>%Delete^%ooDictionary.TriggerDefinition.1