Comments on: Adding a UI Macro to a Non-reference Field https://servicenowguru.com/ui-macros/add-macro-non-reference-field/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:38:57 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Mark Stanger https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6811 Wed, 22 Mar 2017 21:27:06 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6811 In reply to Gia.

Take a look at this post for the correct setup for making this work with a catalog item. Towards the bottom you’ll find an example.
https://servicenowguru.com/system-ui/ui-macros/add-me-ui-macro-user-group-fields/

]]>
By: Gia https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6810 Wed, 22 Mar 2017 21:07:11 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6810 This is really helpful! I was able to add an icon-add to a non referenced field through this script for the service catalog.

My question is how come the icon is placed under the field and not actually beside it.

]]>
By: Simon https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6809 Tue, 10 May 2016 15:58:19 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6809 In reply to Kevin Clark.

Kevin, would you be able to share how you accomplished the UI Macro/Formatter combination to add the image?

My end goal is to have a specific choice on a choice list show an image next to it, that is a button that would bring up a GlideWindow creating a new record on another table. The issue is that everything involved is in a scoped app, and the script at the top keeps catching an error.

]]>
By: Kevin Clark https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6808 Thu, 24 Sep 2015 22:36:22 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6808 Hi Mark,

That’s a really useful tip! We’ve managed to work around the problem using UI Macros and Formatters instead of a client script. I got the image back that I wanted, now I just need to figure out how to make the Jelly code reference the current record.

Cheers,
Kevin

]]>
By: Mark Stanger https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6807 Thu, 24 Sep 2015 11:57:54 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6807 In reply to Kevin Clark.

Welcome to the wild world of scoped apps! :) I’ve found out that in general, they’re not all they’re cracked up to be. I try to avoid them wherever possible. For this situation, there is a workaround. Fuji restricts certain client-side script calls but allows you an app-by-app override if you want. To opt out of this setting create the following property in your application scope and set it to false.
glide.script.block.client.globals

]]>
By: Kevin Clark https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6806 Thu, 24 Sep 2015 07:06:10 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6806 Hi Mark,

Relatively new to scripting in ServiceNow, so hopefully this isn’t a dumb question… We’ve been trying to adapt this method to bring back some images in a scoped application that we’ve created post-Fuji – we’re finding that the code works in the core Incident module as a client script, but that for some reason it doesn’t work in the scoped application. We’re not entirely sure why they should work differently, except that some scripting resources aren’t available in scoped apps. We can’t se a specific reason why your code shouldn’t work in the scoped app.

Any thoughts would be appreciated!
Kevin

]]>
By: David Martin https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6805 Fri, 14 Nov 2014 12:17:01 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6805 In reply to Mark Stanger.

Thanks Mark, was reasonably easy in the end.

]]>
By: Mark Stanger https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6804 Thu, 13 Nov 2014 15:27:14 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6804 In reply to David Martin.

You can, but that’s really just client-side javascript if you’ve got your macro already in place. You would just need to update the ‘src’ attribute on your image tag. If you’ve created your macro, just make sure your image tag has an ID you can target, then you can use a client script to change the image on change of something else.

]]>
By: David Martin https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6803 Thu, 13 Nov 2014 15:22:38 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6803 Just wondering whether you could do something similar but insert the image from macro into an HTML field? No need for onclick or anything. Just the image into 1 field, what I’m trying to do in a wizard, if a variable changes to X then show an image, if it changes to Y show a different image.

I can use macro’s in a wizard and can get the images to hide/show using UI Policies but formatting in the panel screen for 15/20 images to be hidden is not good. So just want to try and use 1 field and populate that field with an image dependent on the previous being selected.

Thanks

]]>
By: Josh https://servicenowguru.com/ui-macros/add-macro-non-reference-field/#comment-6802 Mon, 15 Apr 2013 18:54:59 +0000 https://servicenowguru.wpengine.com/?p=942#comment-6802 In reply to Josh.

I figured it out for the record producer variables.

Change line to:

var field = ‘IO:sysID’; // where sysID is the sysid of the catalog variable which can be found by inspecting the element.
example: var field = ‘IO:7ba2f43d49ac8d00502a8447d8a49ab0’;

and remove the line:

field = g_form.tableName + ‘.’ + field;

]]>