- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 07:58 PM
Hi,
As per subject I am trying to populate the Caller active status based on the Caller ID field in the Incident form.
I have created a field Caller Status on the Incident form and need the logic to have it auto populate its state based on the Caller ID field.
Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 09:12 PM
Hi @Happy S
You can use an On-Change Client Script. Refer below screenshots and the code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var userRef = g_form.getReference('caller_id', userLookup);
function userLookup(userRef) {
alert(userRef.active.toString());
//You can remove this alert and make use of g_form API to set value of your custom field
g_form.setValue('your_field_name',userRef.active.toString());
}
}
Output:
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 10:40 PM - edited 01-14-2025 11:01 PM
Ok it works..
I added the below code to have it work on both OnLoad and OnChange in the same script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
handleEvent();
} else if (oldValue !== newValue) {
handleEvent();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 11:25 PM
You can refer below links:
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2025 11:15 PM
Hi, @Happy S
As per best practice and better performance will used glideAjax api,
we can achive that with help of following scap.
Client Script: