g_form.getReference returns an undefined value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2015 10:59 PM
I am currently trying to create a child ticket with all the information from the parent in it.
Using the new button on the related list 'Facilities Request->Parent';
the following client script is triggered:
function onLoad() {
if(g_form.isNewRecord()){
var dad = g_form.getValue('parent');
if(dad != ''){
var parentRecord = g_form.getReference('parent');
g_form.setValue('opened for', parentRecord.opened_for);
g_form.setValue('location', parentRecord.location);
jslog("JW-DEBUG: " + parentRecord.opened_for);
jslog("JW-DEBUG: " + parentRecord.location);
}
}
}
function onLoad() {
if(g_form.isNewRecord()){
var dad = g_form.getValue('parent');
if(dad != ''){
var parentRecord = g_form.getReference('parent');
g_form.setValue('opened for', parentRecord.opened_for)
The location field is correctly populated on my child ticket, however, the opened_for is not.
Looking at the javascript log i see the following:
JW-DEBUG: undefined
JW-DEBUG: b466f2800a0a3c7e00b84e0d16c206ae
Both fields are reference fields so I am confused why one works and one does not - any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2018 12:24 AM
Thank you derekculbertson for your reply.
While searching for my requirement, came across this script, which helped me 🙂
Cheers!
Suhas Marathe