Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
460 views

Add message to log file for some action

Jump to solution

How can i add some message for some action (add/update/delete)

For example when somebody delete CI - save to log:  when, who and what was delete.

I make trigger for device table with triggers type =5 (before delete) and just one line there - print();

but this message is not added to the log file.

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Add message to log file for some action

Jump to solution

Since you mentioned you're using a trigger, something like this should work:

var ret = new SCDatum();
var message = "CI " + record.id + " (" + record.logical_name + ") was deleted by operator " + vars.$lo_contact_name;

var log = system.functions.rtecall("log",ret,msg);

View solution in original post

4 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Add message to log file for some action

Jump to solution

From the programming guide:

Function
rtecall("log")

Format
$L.success.flg=rtecall($L.fnc.name,$L.return.code,$L.message)

Example
$L.success.flg=rtecall("log",$L.return.code,"This is a new message")

Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Add message to log file for some action

Jump to solution

And if i need save message wich contains: text and variable.

For example:

"text 1 - id, text2 - logical.name, text3: operator.name"

after substitution of the values:

Was deleted CI - CI34323423 (PC-035); by operator: Jhon Smith

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Add message to log file for some action

Jump to solution

Since you mentioned you're using a trigger, something like this should work:

var ret = new SCDatum();
var message = "CI " + record.id + " (" + record.logical_name + ") was deleted by operator " + vars.$lo_contact_name;

var log = system.functions.rtecall("log",ret,msg);

View solution in original post

Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Add message to log file for some action

Jump to solution
var ret = new SCDatum();
var message = "CI " + record.id + " (" + record.logical_name + ") was deleted by operator " + vars.$lo_contact_name;

var log = system.functions.rtecall("log",ret,msg);

I think it must be same name.

 and perhaps there is no need to create a new variable "log":

var ret = new SCDatum();
var msg= "CI " + record.id + " (" + record.logical_name + ") was deleted by operator " + vars.$lo_contact_name;
system.functions.rtecall("log",ret,msg);

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.