Service Manager / Service Center Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

How to send notification

Go to Solution
Regular Advisor

How to send notification

I have a weekly running scheduler, which queries all the expired docs. I need to send them as tabular format in an email


something like


KM Documents Expired                              Expiration Date


KM10011                                                         09/01/2013

KM10012                                                         09/02/2013


Any thoughts ?


Re: How to send notification

Instead of a report schedule records that runs once per record found, you can
make a schedule record that calls some javscript that does the whole job.

schedule record:
class: problem
expiration: next date/time to run
scheduled class: problem
name: a nice name
status: rescheduled
repeat interval: the one you want
description: a useful description

but replace bchAJRTest with the name of your ScriptLibrary

in the bchAJRTest ScriptLibrary is the following code:


/ the to has to be contact name in the operator file with a valid email
function SendMailOne(subject, body, to)
var rteReturnValue = new SCDatum();
var argNames = new SCDatum();
var argVals = new SCDatum();
var temp = new SCDatum();

	argVals.setType( 8 );  // 8 is array
	argNames.setType( 8 );
	system.functions.rtecall( "callrad", rteReturnValue, "macro.mail1", argNames, argVals, false );

//SendMailOne("test subject", "test body\r\nline2\r\n;line with tab\taftertab\r\nast line", "alrussel");

function SearchAndEmail()
var file=new SCFile("probsummary");  // pick the file you want to search here
var query;
var body;

	query="number # \"IM000404\"";  // put in the real query here
	if ( file.doSelect(query) == RC_SUCCESS )
		body="The first line of this email\r\n\r\n"; // \r = CR \n = new line \t = tab
			body+="Number: " + file.number + "\t\tCategory: " + file.category + "\r\n";
		while ( file.getNext() == RC_SUCCESS );
		body+="The last line\r\n";
		SendMailOne("Test email subject line", body, "alrussel"); // alrussel is a valid contact name in the contacts file


Regular Advisor

Re: How to send notification



Thanks for the reply, small question


what does javascript:  mean ?

are you calling lib.bchAJRTest.SearchAndEmail(); from the javascript tabof scheduler ? Do we need to mention anything in the application field, like 'script.execute' ?


Re: How to send notification

javascript&colon is the web interface replacing a : with the word &colon.


You just have to put the valid javascript in the javscript tab, no application is required for the schedule record. yor javascript lilbrary will likely not be called bchAJRTest, just repalce that with your library name.


the line




is just telling javascript to run the function. lib is where all the javscript libraries are. libname is the name of one particular lilbrary that you wrote or updated, and functioname is a function in libname.

Regular Advisor

Re: How to send notification

Hell0 Alex

i need a small help on fixing alignment of this email

My email body is pretty much good, but i have a column called subcategory, because values of subcategory is dynamic( some are long and some are short) my aligment is not working

KM DOC Date Subcat KM doc expiring Date Subcat

KM10000669 11/30/13 00:00:00 AAAAAAAAAAAA KM10000669 11/30/13 00:00:00 BBBBBBBBBBB
KM10000669 11/30/13 00:00:00 AAAA KM10000669 11/30/13 00:00:00 BBBBBBBBBBB
KM10000669 11/30/13 00:00:00 CCCCCCCCCCCCCCCCCCCC KM10000669 11/30/13 00:00:00 BBBBBBBBBBB

Because the subcategory column is having different length, alignment is not working, please help me fix this