Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..
599 views

Notification based on the department defination

Jump to solution

Hello Experts,

I have created field on the department table called email. When I will the select the department on the change management notification must get triggered for that department . I have created link defination also to pass the value.

The below condition is not working.

Arugments:

jscall( "htmlemailtemplates.getMailBody", "ChM Change Open", $L.file, $L.file.save,dept.name in $L.file,email in $L.file).

condition 

true

recepients:

dept.name

 

Best Regards,
Tom
0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Notification based on the department defination

Jump to solution

In the Notification Definition record, the value in the 'recipients' column has to resolve either to an operator ID, a contact name, or an email address, or the notification won't fire.  RAD code in the background automatically looks at the contact table and operator table to grab the email address if the value resolves to a name or ID, but puting a department name value there won't do anything.

Now, you said that the value you had in your recipent column was 'dept.name'.  I'm not sure if you meant 'dept.name in $L.file' or if you really just have 'dept.name'.  If that's the case that _definitely_ won't work, because the system has no idea what that is or what to do with it.

So, here's how I would solve it, if I was in your place.

First, create a new ScriptLibrary script like the following

Script Name: CustomEmailRecipients

function fromDept(deptName){
	/* J.Heubner 2015
	What this script does is search the department table for a matching department name
	and returns the email of that department name.
	returns false if there is no department, or the department has no email.
	*/
	var dept = new SCFile("dept");
	var getDept = dept.doSelect("dept.name=\""+deptName+"\"");
	if (getDept == RC_SUCCESS && dept.email != null){
		return dept.email;
	}
	return false;
}

Then, in your recipients column, enter the following:

jscall("CustomEmailRecipients.fromDept", dept.name in $L.file)

 

And that should do it.  What the script does is query the department table for a matching dept.name value, and returns the value of the 'email' 

View solution in original post

5 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Notification based on the department defination

Jump to solution
 
Best Regards,
Tom
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Notification based on the department defination

Jump to solution

In your jscall you have -  jscall( "htmlemailtemplates.getMailBody", "ChM Change Open", $L.file, $L.file.save,dept.name in $L.file,email in $L.file)

and according to the SL function:

function getMailBody(templateName, $RECORD, $RECORDOLD, recipient, lang)

the last parameter should be the language of the template.  You are passing in email in $L.file, does that resolve to a valid language code like "en"?

Still the code should eventually try to get the English template "en" so theory this should still work.

Do you see any error messages on the screen or in the log?

Steve Hirschfeld

 

 

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Notification based on the department defination

Jump to solution

In the Notification Definition record, the value in the 'recipients' column has to resolve either to an operator ID, a contact name, or an email address, or the notification won't fire.  RAD code in the background automatically looks at the contact table and operator table to grab the email address if the value resolves to a name or ID, but puting a department name value there won't do anything.

Now, you said that the value you had in your recipent column was 'dept.name'.  I'm not sure if you meant 'dept.name in $L.file' or if you really just have 'dept.name'.  If that's the case that _definitely_ won't work, because the system has no idea what that is or what to do with it.

So, here's how I would solve it, if I was in your place.

First, create a new ScriptLibrary script like the following

Script Name: CustomEmailRecipients

function fromDept(deptName){
	/* J.Heubner 2015
	What this script does is search the department table for a matching department name
	and returns the email of that department name.
	returns false if there is no department, or the department has no email.
	*/
	var dept = new SCFile("dept");
	var getDept = dept.doSelect("dept.name=\""+deptName+"\"");
	if (getDept == RC_SUCCESS && dept.email != null){
		return dept.email;
	}
	return false;
}

Then, in your recipients column, enter the following:

jscall("CustomEmailRecipients.fromDept", dept.name in $L.file)

 

And that should do it.  What the script does is query the department table for a matching dept.name value, and returns the value of the 'email' 

View solution in original post

Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Notification based on the department defination

Jump to solution

Hi Jacob,

Thanks for the reply, Notification is triggering only for one department. I have two department defination, Both department should get notified. When the ticket change is created.

Best Regards,
Tom
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Notification based on the department defination

Jump to solution

What's your code look like?  A computer will always follow the instructions its given.  If it's not doing what you want, it didn't understand your instructions.  

So what's your notification definition record look like in the Recipients column for that notification entry?

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.