cancel
Showing results for 
Search instead for 
Did you mean: 

Job to send all user their initial password by e-mail (one for the pros)

Former Member
0 Kudos

Hello,

(IDM 7.2 with MSSQL)

I try to create a job that sends all user their "IDM-PASSWORD" via email.

In the first step, I generate a random password for all user. This password should now be sent to each user so they can log in to IDM-UI.

This is my approach:

1. Step

Define the source

A Job with a to generic pass:

SOURCE:

SELECT DISTINCT mskey FROM idmv_vallink_basic_active WHERE mcidstore=1 AND
((mskey IN (SELECT mcmskey FROM idmv_vallink_basic_active WHERE mcattrname='MX_ENTRYTYPE' AND mcsearchvalue = 'MX_PERSON')))

Destination:

MSKEYVALUE = %MSKEYVALUE%

JOB CONSTANTS:


         MAIL_SMTP_HOST = Host
         MAIL_SMTP_PORT = Port
         MAILATTRIBUTE   = MX_MAIL_PRIMARY
         MAILFROM         = MAIL....com
         NOTIFICATION     = blabla 
         POSTTEXT         = </FONT><br><br>
         PRETEXT         = <FONT SIZE=5> blabla

Script for mailing:

function blödesMailding(Par){

var userList = Par.get("MSKEYVALUE"); 
 
var user = new java.util.Vector(); 
user = uSplitString (userList, "|");
 
var i = 0; 
var result; 
var emailAddress = ""; 
var idStore = uGetIDStore(); 
var emailAttribute = "%$MAILATTRIBUTE%";


for (i=0; i < user.size(); i++) {
	
	emailAddress = uIS_GetValue(user.get(i), idStore, emailAttribute);
	
	result = UserFunc.uSendSMTPMessage("%$MAILFROM%", emailAddress, "%$NOTIFICATION% ", "%$PRETEXT% " + "%$POSTTEXT%", "%$MAIL_SMTP_HOST%", "%$MAIL_SMTP_PORT%", 1);
	if (result.length > 0) {
		UserFunc.uErrMsg(2, result + ":Mail to:" + emailAddress);
	}
}
return "";
}

And here is the error message^^:

Warning Constant MAIL_SMTP_HOST was not defined in the repository (-1)
 
Warning Constant MAIL_SMTP_PORT was not defined in the repository (-1)
 
Warning Constant MAIL_ORIGINATOR was not defined in the repository (-1)
 
Warning Constant MAIL_DEBUG was not defined in the repository (-1)
 
Warning Constant MAIL_DEBUG_RECIPIENTS was not defined in the repository (-1)
}

I set all of these constats in the GLOBAL CONTANTS form ID store!

and here he also complains:

 Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect
 
Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect
 
Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect
 
Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect
 
Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect
 
Warning Could not send SMTP message to !ERROR:Entry does not exist using SMTP host mail.mymhp.net

java.net.ConnectException: Connection refused: connect

 ...

Maybe I made a mistake, or my solution doesn't work at all.

I would be very glad if someone had an idea, or a better solution for this problem.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

When your in a script you cant just write %$CONSTANT_NAME% to get a job constant that dosen't work. istead you'll need to use the uGetConstant function which is a buildin function i JScript. That should give you the job constants.

For more information on the uGetConstant functionallity check out the help index!

Hope it helps

//Jesper

former_member2987
Active Contributor
0 Kudos

Gerhard,

It looks like your task is calling for a repository. Either remove the repository link or move your contents to the specified repository.

This is usually true if you are using a task or pass copied from the framework. Also, don't forget that the password is encrypted and must be decrypted before sending (MX_ENCRYPEDPASSWORD) and that MX_PASSWORD is hashed and cannot be reversed!

Matt

Former Member
0 Kudos

Hi Matt,

Thank you for your response. I just tried to create a script like in the documentation "How to Create Approval tasks in SAP NetWeaver Identity Management 7.1" described that handles the mail delivery. Perhaps this can not be done in the "Job Folder". Because there is no reference to the global constants?

Former Member
0 Kudos

Hi Gerhard,

did you try to telnet your mail host:port on the IdM-System? Does using the IP make any difference?

It feels like "Connection refused: Connect" indicates something like hostname unknown, no route to host, port blocked, firewall enabled etc... not an IdM-problem.

Else: What happens if you "hard-code" the constant-values into the JScript?

maybe it helps

Michael

Edited by: Michael Schüßler on Jan 10, 2012 7:19 PM

former_member2987
Active Contributor
0 Kudos

Gerhard,

From the Job Folder you can access global constants, but I don't think you can access repository constants. Re-work the script so it uses globals (making sure to set up the globals) and you should be fine.

Matt

Former Member
0 Kudos

> From the Job Folder you can access global constants, but I don't think you can access repository constants. Re-work the script so it uses globals (making sure to set up the globals) and you should be fine.

Both repository constants and global constants work in jobs, just study your initial loads to see the use of repository constants.

Gerhard, do you have your correct repository defined in your pass/job? If you copy/pasted the pass the original repository might be still in the pass (done this a few times

You should be able to access your global constants in scripts with notation like (without any built-in functions):

var idStore = "%$glb.SAP_MASTER_IDS_ID%";

Edited by: Tero Virta on Jan 13, 2012 9:40 AM