How to use field type "Variable Conditions" on custom table?

peter_repan
Tera Guru

Hi all,

I would like to create table with reference to catalog item and with condition builder.

User should be able to build conditions based on catalog item's variables.

My idea was to use the same variable type like defined on field "Catalog Conditions" on Catalog UI Policy - it has type "Variable Conditions".

find_real_file.png

However, this type is not visible when creating new field on my custom table. (I assume it's not allowed for standard use)

Does anyone have idea how to use condition builder for variables on custom table, please?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Peter,



From what I can tell, there isn't a variable type that allows for conditions as there is with a standard field type. It would be a nice idea, especially if you could get at the variables...



I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


View solution in original post

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Peter,



From what I can tell, there isn't a variable type that allows for conditions as there is with a standard field type. It would be a nice idea, especially if you could get at the variables...



I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


Hi Chuck,



thank you for reply. Seems I have to find another workaround.



For my case it might be enough to reuse the "Catalog UI Policy" record and create a new view where I will display the Catalog Conditions field.



However, when inserting new record and trying to get in client-side javascript the value of Catalog Conditions field, it's returning empty string.



Seems the g_form.getValue('catalog_conditions') method is retrieving only value from database, not from the form.



Do you know how to get the actual value of Catalog Conditions field in client-side script?




find_real_file.png


Hi Peter,



I may have misunderstood the requirement. I thought you were looking to make a variable of condition type.



If you want to learn more about how Conditions fields work, take look at episode 12 of TechNow.



TechNow Episode List



The conditions field is evaluated from the server side. You COULD save the answer of what records match the condition in the g_scratchpad and pass that to the client script (episode 5). Haven't tried it, don't know if it will work in your use, but give it a try anyway and let me know.


Hi Chuck,



sorry for confusing. My original question was about "Variable conditions" field type.



But based on your answer I understand it's not not possible.



So in order to achieve my goal I've tried another solution and I'm facing another issue I mentioned above.



Sorry that I'm asking something different, I was only wondering if you can help in this thread, so I don't need to raise another question