- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 12:39 AM
Hi SN Guru's
Hope you can help with this request. Using the "getReference" call, I'm trying to take a users email address value (from the user referenced table) on the Change Request form and insert the email address value of a selected user straight into another field (new field) on the form using g_form.getReference method and object.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 08:03 PM
To verify, are you wanting to copy the email of the requested_by to the description when the requested_by is changed? Does this work for you, made a couple tweaks:
var refemail = g_form.getReference('requested_by', setDesc);
function setDesc(refemail) {
g_form.setValue('description', refemail.email);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 06:05 PM
Thanks for the responses guys,
These answers all are good but point to a new (not existing) field from the reference table using dot walking to get there. While this is almost correct, what I'm actually trying to do is onChange of the requested_by field , is to take the email value and inserted automatically to the description field on the change request form.
I have created a script like this and its not working:
var refemail = g_form.getReference('sys_user', setDesc);
function setDesc(refemail) {
if (requested_by)
g_form.setValue('email', description);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 08:03 PM
To verify, are you wanting to copy the email of the requested_by to the description when the requested_by is changed? Does this work for you, made a couple tweaks:
var refemail = g_form.getReference('requested_by', setDesc);
function setDesc(refemail) {
g_form.setValue('description', refemail.email);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 09:14 PM
In that case, you can use the below code in the script:-
var email=g_form.getReference('<your reference field>').email;//substitute the field that refers to sys_user whose email id you need.
g_form.setValue('description',email);
Thanks & Regards,
Hari