getControl not working in Portal .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 02:27 AM
getControl not working in Portal .
var e=g_form.getControl('fieldname');
Giving Null value in Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 05:50 AM
Service Portal is considered mobile UI and thus follows mobile guidelines.
Mobile platform migration impacts
If going to use Service Portal you should not use getControl as it's considered a deprecated method. It is suggested to use the methods that are found on the developers site:
https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=client
PS - Although getControl is listed there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 08:55 PM
Looks like the service portal and the regular UI have a completely different version of g_form. In a catalog script in the service portal, getControl() does exist but instead of getting a control via the variable name it instead gets a control via the "IO:e2e4d46e683cb1001d6aaa9211a76d73" value. In the Service Portal you will find this as the name value on the HTML form element ie:
<select name="IO:e2e4d46e683cb1001d6aaa9211a76d73" ng-model="fieldValue"
You are getting null because that function in service portal returns null if the name you provide does not match the one I just explained.
I am unsure if the object returned by that function is similar to the regular UI version of g_form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 10:00 PM
Hi Manisha,
Request you to go through the below helpful threads. You can use g_form.hasField instead of g_form.getCOntrol() as it has been deprecated in Portal.
1. g_form.getControl not working in service portal
2. g_form.getControl() not working in Service Portal in Catalog Client Script
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2017 12:54 AM
Hi manishai,
Did you able to have a look at my last response?
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View