cancel
Showing results for 
Search instead for 
Did you mean: 

Using VALIDTO to Set Attribute to Expire

Former Member
0 Kudos

I am currently working to set and attribute to expire two days out from the last sync. I have been trying to use standard js code to calculate this date, but it seems IdM does not like that. What I am looking to do is the following:

On the WriteABAPUser pass in the Initial Load job, I would like to use the VALIDTO option on attribute ACCOUNTTEST to be set two days out from the current date.

Does anyone have any suggestions on how I can accomplish this. The ultimate goal is so that when a user has been removed from a system, this attribute with fall off two days later.

Any and all assistance is greatly appreciated. Thanks.

Kevin

Accepted Solutions (1)

Accepted Solutions (1)

former_member192665
Participant
0 Kudos
Former Member
0 Kudos

While link is quite helpful, does not answer the question at hand. I need to cacluate the VALIDTO date to be 2 days out from the current run date. This all has to be completed within the logic of the Initial Load job which we use to sync the data between IdM and our various SAP systems.

I have created a script to use to calculate this, but IdM does not seem to like the use of stand js date calculations. Here is the value I have been trying to use to set the value in the Initial Load job, WriteABAPUsers task:

{VALIDTO=$FUNCTION.cag_makeExpiryDate()$$}%logonuid%

the script contents are as folllows:

function cag_makeExpiryDate(Par){

{

var expiryDate = new Date();

expiryDate = expiryDate.setDate(expiryDate.getDate() +2);

var Year = expiryDate.getFullYear();

var Month = expiryDate.getMonth()+1;

var Day = expiryDate.getDay();

expiryDate = Year + '-' + Month + '-' + Day + ' 23:59:59.000'

return expiryDate

}

}

If fails on the the var Year line (actually line 9 in the script) with the error:

Executing cag_makeExpiryDate() got RuntimeException - undefined: undefined is not a function. HINT: Check line 9 in the script cag_makeExpiryDate

Hope this detail helps.

former_member192665
Participant
0 Kudos

Hi,

getDay

will return the day of week, what you need is the day of the month. Did you try

var Day = expiryDate.getDate();

(I know, this doesn't explain the error message but is worth a shot.)

Cheers,

Kai

Former Member
0 Kudos

Good catch I didn't even see that.

Unfortunately the script doesn't even get that far, for some reason it does not like the use of the getFullYear function.

Back to the drawing board I guess, just really hard to believe that there are not generic date manipulation scripts out of the box.

Thanks.

former_member192665
Participant
0 Kudos

The following line is wrong:

expiryDate = expiryDate.setDate(expiryDate.getDate() +2);

must be

expiryDate.setDate(expiryDate.getDate() +2);

Then it works.

Former Member
0 Kudos

That did it! Thanks so much for your help to idenitify the solution for this one. It can get really tricky using the js in IdM becuase you never know exactly how it might differ slighty.

THANKS!!!!

Answers (0)