ui macro not rendered in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2016 09:20 AM
Hi,
I have some ui macro variables in my service catalog item, basically this ui macro displays some text. However, when i am trying to view the item in the service portal, the form does not show the ui macro at all. Is this a constaint in Helsinki or am i missing something.
Regards,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 06:04 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2016 07:15 AM
Jamie, did you get any resolution to this issue? I'm in the same boat. In Service Portal, Catalog Items Catalog Client Scripts don't seem to fire (perhaps not even present). The UI Type for all my scripts is set to Both. My scripts are simply used for client-side input validation and adding placeholder text (Re: Support for HTML 5 placeholder attribute ).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2016 09:07 AM
Seth,
The 'g_form.getControl' function is not supported in Mobile Client, thus not supported in Service Portal:
Mobile Client GlideForm (g form) Scripting - ServiceNow Wiki
So, to my understanding, the UI script used for the placeholder attribute will not run. I had to modify a client script I used to switch a field label so it followed the mobile compatible version of the script API. It was using the 'getControl' method to modify the field label (setLabelOf does not work in Service Catalog), and I ended up using the 'setLabel' function, as it works on mobile. There is some good info found here:
documentation/client_scripting.md at master · service-portal/documentation · GitHub
Definitely will have to change some things when migrating to SP from CMS.
Cheers,
Tim

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2016 07:33 PM
Thanks Tim. I'm not sure why I'm having such a mental block on this process. My Catalog Item's availability is set to "Desktop and Mobile" and I have updated my Catalog Client Script to:
function onLoad() {
g_form.setFieldPlaceholder('move1_number_transfer','Phone Number');
}
But it still doesn't show up in ServicePortal.
Should it be put in a widget instead and then reference the widget for the variable? If this is the process, I guess I'll be creating a widget for every variable? It would be great if you could create a reuseable widget that could be like: g_form.setFieldPlaceholder(this-one,this-one.description).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 06:12 AM
That might work if you added a function to the 'client controller' script field of the 'form' widget. However, catalog client scripts and Catalog UI policies should work in SP; most of mine do.
Does the script work in the native UI, just not in Service Portal? I am not familiar with the 'g_form.setFieldPlaceholder()' function. Is that part of the g_form API?
Cheers,
Tim