Is it possible to add flash and to set focus to a journal input field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 03:59 AM
Hi,
Trying the following in a client script:
g_form.flash('incident.work_notes', "#FFFACD", -4);
g_form.getControl('incident.work_notes').focus();
This perfectly works on non journal input fields, but i can't get it to work on journal input fields like work notes and/or additional comments.
Is this at all possible, or am I missing something?
Regards
Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 04:36 AM
Not validated (my PDI won't wake up), but check if this works:
function onLoad() {
// Use setTimeout to ensure the DOM is fully loaded
setTimeout(function() {
var workNotesField = gel('activity-stream-work_notes-textarea'); // The ID of the work_notes field
if (workNotesField) {
workNotesField.focus(); // Set focus to the work_notes field
}
}, 100); // Adjust the timeout as needed
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 06:21 AM
Hi Mark,
Thnx for your swift response.
It will be in an on change client script. In our case, when one changes the priority, they need to supply a reason by adding a work note. Hence, we want to flash the work note field and set focus to it.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 07:12 AM
Tried your code Mark. No luck! Looks like Vancouver doesn't work with 'gel' any more, getting "onChange script error: TypeError: gel is not a function function() { [native code] }".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 08:16 AM
I also faced the same issue. Looks like `flash` does not support a journal input field. Unfortunately it looks like ServiceNow forgot to mention it in their documentation: no mention in the GlideForm API
@Jan Post2 did you come up with any workaround? I'm just curious.