client side autopopulate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:55 AM
I have written this below client script . I have a checkbox field if that is checked a reference field is becoming visible and mandatory so from that field record it should fetch title and detail and autopopulate in present form. but in title and detail I am getting value as undefined. Please correct my code.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert('hi');
var pickSelected = g_form.getValue('pick_from_library');
if (pickSelected == 'true') {
alert('hlo');
var toDo = g_form.getDisplayBox('to_do').value;
alert(toDo);
if (toDo) {
alert(toDo.title);
g_form.setValue('title', toDo.title);
g_form.setValue('detail', toDo.detail);
} else {
alert('bye');
g_form.clearValue('title');
g_form.clearValue('detail');
}
}
else{
g_form.clearValue('title');
g_form.clearValue('detail');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 02:58 AM
Hello Shivaadapa,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert('hi');
var pickSelected = g_form.getValue('pick_from_library');
if (pickSelected === 'true') {
alert('hello');
var toDo = g_form.getDisplayBox('to_do').value;
if (toDo) {
alert(toDo.title);
g_form.setValue('title', toDo.title);
g_form.setValue('detail', toDo.detail);
} else {
alert('bye');
g_form.clearValue('title');
g_form.clearValue('detail');
}
} else {
g_form.clearValue('title');
g_form.clearValue('detail');
}
}
try this and let me know if it is working for you or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 03:02 AM
Hi @shivaadapa is the title and detail are single line variables? then use autopopulate feature on each variable, no need to script.
Harish