- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 02:02 PM
We have implemented Password Reset. Part of the process is to ensure users have entered a secondary email address (custom field) in their profiles. I'm looking to create an email notification that will be sent when:
Password Reset Enrollment Snapshot Status is "Active"
Secondary email is not empty
I initially pointed the notification to the pwd_enrollment_snapshot table and had it run on Update. However, I realized that won't work given that the user's are updating their profiles on the sys_user table.
This "Enrollment Complete" notification should check the user's enrollment status when they add a secondary email address in their profile. How do I do this?
Thanks in advance!
Michael
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 11:39 AM
This helps. While I was testing this, it helped me come up with a different solution by simply placing an Info message under the Secondary email field only if it is empty.
With an onLoad Client Script on the sys_user table:
function onLoad() {
//Type appropriate comment here, and begin script below
var se = g_form.getValue('u_email');
if (se == ''){
g_form.showFieldMsg('u_email', 'ADD YOUR MESSAGE HERE', 'info'); //display info message if secondary email field is empty
} else {
g_form.hideFieldMsg('u_email', 'ADD YOUR MESSAGE HERE', 'info'); //hide info message if secondary email is specified
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2016 11:26 PM
Hi,
Can you please tell me ellaborate. Are both the tables updated when the user adds a secondaryv email address?
Moreover when do you want to send the email when the enrollment status is changed to complete or when the secondary email address id updated?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 12:34 PM
I have a slight modification. Instead of an email notification, I would like to do the following:
When a user enters a secondary email in their profile and clicks Update, I'd like an onSubmit script to query the pwd_enrollment_snapshot table to see if the user is enrolled in Password Reset. If they are, have a 'Success' message display.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 02:08 PM
(Save or Update are Global UI Actions, so make sure you don't change them...)
You could use something like this:
Action name: update_enroll
Onclick: checkEnrollment();
Script:
function checkEnrollment() {
var user = g_form.getUniqueValue();
var secEmail = g_form.getValue('u_secondary_email'); //secondary email field on the user profile page
var enrol = new GlideRecord('u_pwd_enrollment_snapshot');
enrol.addQuery('u_user', user); //u_user is the user field on the enrollment table
enrol.query();
if(enrol.next()) {
if(secEmail != '' && enrol.u_email != secEmail) { //because you only want to update the enrollment table if the secondary email field is not empty and is does not equal to the email field in the users record on the enrollment table
enrol.u_email = secEmail; //to update the user's email field in the enrollment table
enrol.update();
alert('email added successfuly to enrollment table.');
g_form.save();
}
} else if(!enrol.next()) { //if the user is not on the enrollment table
alert('You area not enrolled.');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'update_enrol'); //Call the UI Action and skip the onclick function
}
if (typeof window == 'undefined')
serverUpdate();
//if the user updates a different field in his/her profile, they need to updated too.
function serverUpdate(){
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 09:29 AM
Let me clarify. When they add a secondary email address, I just want the system to query the Enrollment table to know if the user is already enrolled (enrollment_status=active). If they are, then a "success" message. If not, no message needed.