Leveraging the Variables functionality in custom tables

stevejarman
Giga Guru

We are in the process of planning the design of a Finance module to replace the functionality of the deprecated Finance Service Management plugin.

Where I'm coming up short is how to implement the "variables" field on a custom table (call it "finance_request"), so that Record Producers targeting finance_request can leverage the Variables Related List for questions/answers, in the same way as a "normal" Catalog Item, or one of the "real" Service Management plugin Record Producers (i.e. Finance, Legal, Marketing, etc).

I've noticed that when you create a custom table, the "Variables" field type is not available for use, seemingly making it impossible to implement this functionality on a custom table, without knowing some "trick".

Does anyone know what the criteria is for being able to create fields of the "Variables" type? And/or any documentation on this subject that might be helpful?

Examples below of 2 OOB tables that make use of the Variables field type. This seems to be the main missing ingredient for what we're trying to do. Everything else should be relatively straight-forward(ish).

find_real_file.png

 

find_real_file.png

 

find_real_file.png

10 REPLIES 10

Hi there,

sc_item_option & sc_item_option_mtom are not used for record producers! Just standard catalog items.

The variables field type your mentioning is out of the box not available to add for new fields:

find_real_file.png

 

I did a small simulation of what you are trying to achieve. See below, hope this helps.

1) Created a Test Record Producer which could go against your custom table + 1 Variable.

find_real_file.png

2) After submitting the new Record Producer (thru for example the Service Portal), the store variable data is available in the question_answer table. The table sys id being the sys_id of the record created (in this case an incident).

find_real_file.png

3) By default, you will still see nothing on the form of your record. Also out of the box the case with incident. So I added the Variable Editor formatter to the Incident form lay-out.

find_real_file.png

 

4) And the result is here!

find_real_file.png

5) For your new custom table there won't be a UI Formatter. Though, you can easily create this. Just have a look at the out of the box formatters and duplicate one for your custom table.

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Mark - I'll do some experimenting on everything you've mentioned there. REALLY appreciate all your help - thank you very much.

Hi there,

Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution.
Thanks.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

A-N
Tera Expert

Hi Steve,

Here's one way to create the Variables field on any custom table

Before you begin ensure that you have "security_admin" role assigned to you so that you can elevate your role - See link

Once you have your elevated privileges  

  1. Left Navigation > System Definition > Tables
  2. Search for Label starts with Field Class
  3. Open the "Field Class" table/record
  4. Scroll down to the "Access Control" section (you will see 4 operations on the table - write,delete,read,create)
  5. Click on the "sys_glide_object" for write operation
  6. Add your role(Admin?) to the "Requires Role" section and click on "Update"
  7. In the Filter Navigator type sys_glide_object.list
  8. In the list view search for Name contains Variables
  9. Open the Variable record
  10. Check the "Visible" option , click Update
  11. Navigate to your custom table - you will now have the option to create fields of type "Variables"

Once you are done creating the new fields you can choose to disable the "Visible" option and remove the role that was added to enable the write operation

Hope this helps,

 

 

Is this considered a legitimate solution though, or would it be considered "hacky"?