document.getElementById("item_title").innerHTML is not working in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:05 AM
Currently we are using the following script to change the item title and description based on the options selected by user.
var accessType = g_form.getValue('access_type');
if (newValue == 'add') {
if (accessType == 'name') {
document.getElementById("item_title").innerHTML = 'SOME TEXT';
document.getElementById("item_title").style.fontSize = 'medium';
document.getElementById("item_title").style.fontWeight = 'bold';
document.getElementById("item_desc").innerHTML = 'SOME TEXT';
document.getElementById("item_desc").style.textAlign = 'justify';
}
It is not working in service portal.
I think document.getElementById and innerHTML are not supports in Poratl.
Can some one please help me for the replacement of above.
Thanks
Prasad K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 02:00 PM
Hi Prasad
You're right. Unfortunately as shown in this document documentation/client_scripting.md at master · service-portal/documentation · GitHub (a similar version can be found in the official service now wiki)
The following globals and APIs are unavailable in service portal client script:
- window
- document
- $
- jQuery
- $$
- $j
- angular
This means that if you are rendering a form in the service portal and you need to manipulate the look and feel of the form can be done on the ServicePortal side
- using a local CSS
- probably trying to work on the controller to have something similar to this
html - alternative of 'getElementById' in angularjs - Stack Overflow
For sure you can't relay on a client script created for the back end
I hope this will help
Cheers
R0b0