The CreatorCon Call for Content is officially open! Get started here.

Possible to Create a Custom Dictionary Attribute?

scwillson
Mega Guru

Is it possible to create/define my own custom built dictionary attribute that would be called in the attributes field?

I thought they were maybe script includes, but I can't seem to find where they are defined.

Reasoning

This is mainly out of my own curiosity, but there are some date fields in the Catalog that a client needs to not allow past dates, and nothing further than a year out. So I was just going to apply OnChange scripts to the appropriate fields. However, I thought it'd be cool if I was able to create my own attribute to apply.

3 REPLIES 3

JamesEcoStratus
Mega Guru

HI Simon,



Take a look at this post and let me know if it helps.



Create new Dictionary attribute



If not - lets find out what would help.



James


No, that didn't help. It looks like Neil Holdenhad a similar request in that he also wanted to know how to create a custom attribute. However, since his end goal was different from my own, and he ended up just implementing a UI Macro without adding a custom attribute it is irrelevant to me.


This is old but I was wondering about this too and just happened to come across this post.

 

In my case I needed to track a custom dictionary attribute back to where it was stored.

There was a button that a vendor plugin inserted next to a field and I needed to figure out what it was doing and how it was doing it.
I examined the dictionary page for the field where the button showed up and the dictionary attributes list contained an identifier that clearly came from the plugin's namespace.

I then used that to track it back to a UI Macro API name (sys_ui_macro.scoped_name) and the code in question.


This is pretty much what is explained in the servicenowguru link from the other thread:
https://servicenowguru.com/ui-macros/add-me-ui-macro-user-group-fields/

(The community thread in question now resides at https://www.servicenow.com/community/itsm-forum/create-new-dictionary-attribute/m-p/727658/page/2 ... to avoid link rot)

So the answer then seems to be, create a UI Macro and the API name can be used as a custom dictionary attribute.

 

As far as how to use that knowledge to create what the OP was asking for (date value validation basically) you'd have to get creative with the Jelly to accomplish that... my Jelly is extremely rusty so I'll leave that as an exercise for someone else.

 

Honestly though, I think onChange scripts are much more clear. Getting too clever just makes it painful for whoever else has to come along and figure out what you did.