- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:21 AM
I just want to pass assigned to information from server side to client script so that when i change incident assigned to value description should take the value as shown in below pictures but its showing undefined.
what went wrong? where modification should happen? any suggestions!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:42 AM
I think the time display BR ran, assigned to field was not populated and that may be the reason to have undefined value in short description you are setting from client script.
For this case you may not need display BR and setting the value from scratch pad variable, you can do it just using onChange() client script.
Modify the your existing onChange() client script and deactivate display BR.
Script to add in onChange() client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue != oldValue) {
var getDetail = g_form.getReference('assigned_to',currentUser1);
return;
}
}
function currentUser1(getDetail){
g_form.setValue('short_description','Assigned to Title is '+getDetail.title+' email is '+getDetail.email);
}
//Type appropriate comment here, and begin script below
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:37 AM - edited 07-19-2023 11:39 AM
Hi Mani
Instead of g_scratch pad use call back function in client script itself
var assigned = g_form.getReference('assigned_to', callback);
function callback(assigned) {
var email=assigned.email;
var title = assigned.title;
g_form.setValue('short_description',"Assigned to Title:"+title+"and email is:"+email);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:40 AM
i have made a small correction in the script
var assigned = g_form.getReference('assigned_to', callback);
function callback(assigned) {
var email=assigned.email;
var title = assigned.title;
g_form.setValue('short_description',"Assigned to Title:"+title+"and email is:"+email);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:42 AM
I think the time display BR ran, assigned to field was not populated and that may be the reason to have undefined value in short description you are setting from client script.
For this case you may not need display BR and setting the value from scratch pad variable, you can do it just using onChange() client script.
Modify the your existing onChange() client script and deactivate display BR.
Script to add in onChange() client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue != oldValue) {
var getDetail = g_form.getReference('assigned_to',currentUser1);
return;
}
}
function currentUser1(getDetail){
g_form.setValue('short_description','Assigned to Title is '+getDetail.title+' email is '+getDetail.email);
}
//Type appropriate comment here, and begin script below
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 12:03 PM
I want to do this through BR only. Yes! you are right as you said display business rule is not triggering when we change the value of field as by default display br will trigger whenever display the info through form.
Any how thanks for the inputs.