Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Credential password update using schedule job

udaykumarko
Tera Contributor

Hi All,

I have a requirement where a credential in All → Credentials should have its password updated automatically every month in a specific format (for example: Doraemon@MMYY like Doreamon@0526, Doreamon@0626 ....).

I created a scheduled job script in my PDI, and it shows that the password is getting updated. However, I want to confirm whether the password is actually updated in the same format as defined in my script.

Is there any way to check or verify the updated password value through a script or by setting up an email notification to see the password?

I have attached a screenshot for reference.

1. Credential Name:

udaykumarko_0-1776711938946.png

2. Credential Updated:

udaykumarko_1-1776711983661.png

3. Schedule Job script:

(function() {

//Password generate (Reports@MMYY)
var now = new GlideDateTime();
var month = now.getMonthUTC() + 1;
var year = now.getYearUTC().toString().slice(-2);

if (month < 10) {
month = '0' + month;
}

var newPassword = 'Doraemon@' + month + year;

//Credential record fetch
var gr = new GlideRecord('discovery_credentials'); // <-- table 
gr.addQuery('user_name', 'Reports@1234.com');
gr.query();

if (gr.next()) {

//Password update
gr.setDisplayValue('password', newPassword);
gr.update();

gs.info("Password updated: " + newPassword);

} else {
gs.error("Credential not found");
}

})();

 

0 REPLIES 0