GwtMessage Functionality

Priya Shekar
Tera Guru

Can anyone explain me the functionality of "GwtMessage"?

5 REPLIES 5

Tanushree Maiti
Tera Patron

Hi @Priya Shekar 

 

Check this KB: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB3222107

 

Resolution

## Solutions

**Option A — UI Type: Desktop (quick fix)**
- Change script's UI Type from "All" to "Desktop"
 
**Option B — Rewrite for SP compatibility (lasting fix)**
- Replace `GwtMessage` → `getMessage()` (callback-based)
- Replace `document.getElementById()` → `g_form.getElement()`
- Use feature detection to branch on runtime:
```javascript
if (typeof GwtMessage !== 'undefined') {
// Classic path
} else if (typeof g_form !== 'undefined') {
// Service Portal path
}
```

**Option C — Apply official patch**
- Check for published Update Set from product team