
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 06:09 AM - edited 11-28-2024 06:10 AM
Hi everyone.
Have you, or do you know of anyone who did, done a performance comparison of:
- Auto-populating a field via a client script that uses a callback VS
- Out of the box auto-populate on a field
Something like this code for the client script (I anonymized the field/variable names).
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.clearValue('field');
return;
}
//Type appropriate comment here, and begin script below
var userInfo = new GlideRecord("sys_user");
userInfo.addQuery("sys_id", g_form.getValue('field'));
userInfo.query(userCallBack);
function userCallBack(userInfo) {
if (userInfo.next()) {
g_form.setValue('field',userInfo.field);
}
}
}
I would love to move to the out of the box auto-populate, but the only pro argument I have is making it easier across the team not having to deal with code they don't understand.
Which is faster? Or are there other considerations that make one better to use than the other?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 06:17 AM
Definitely, the fastest one is
- Out of the box auto-populate on a field
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 06:17 AM
Definitely, the fastest one is
- Out of the box auto-populate on a field
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************