- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi All,
We have a requirement to add a placeholder text to the work notes field in the incident records. It is possible to add a placeholder text to any new record before submitting it. However, unfortunately, in case of already existing incidents the placeholder text flashes for a second and then disappears. Could anyone advice on what could be modified in the below onLoad Client Script?
function onLoad() {
var placeholderText = "This is a placeholder text";
var workNotes = g_form.getControl("work_notes");
var streamNotes = g_form.getControl("activity-stream-work_notes-textarea");
// If this is a *new* incident
if (g_form.isNewRecord()) {
if (workNotes) {
workNotes.placeholder = placeholderText;
}
}
// If this is an *existing* incident
else {
if (streamNotes) {
streamNotes.placeholder = placeholderText;
}
}
}
I would be grateful for any hints, or suggestions!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
by giving timeout of 2 seconds it worked for me in new and existing record both
function onLoad() {
setTimeout(function() {
var placeholderText = "This is a placeholder text";
var workNotes = g_form.getControl("work_notes");
var streamNotes = g_form.getControl("activity-stream-work_notes-textarea");
// If this is a *new* incident
if (g_form.isNewRecord()) {
if (workNotes) {
workNotes.placeholder = placeholderText;
}
}
// If this is an *existing* incident
else {
if (streamNotes) {
streamNotes.placeholder = placeholderText;
}
}
}, 2000);
}
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Ankur,
Works like a charm! Thank you very much for the suggested modification and this gif. Very helpful 😊