How to add condition builder on UI Page?

gratziela
Tera Contributor

Hi,

I created an UI page and I wanted to add the condition builder on it.

I read this article Condition Builder   and added these lines of code to my UI page:

Test 1:

<g:ui_element table="sys_script" field="collection" id="0e66a301dd2003003399d83d70be0205"></g:ui_element>  

<g:ui_element table="sys_script" field="filter_condition" id="8a66a301dd2003003399d83d70be0211"></g:ui_element>

Test 2:

<g:ui_element table="x_doitw_msteams_ih_condition_builder" field="collection" id="c3a5264e4f13030009fdb5e18110c795"></g:ui_element>  

<g:ui_element table="x_doitw_msteams_ih_condition_builder" field="condition" id="6b65a24e4f13030009fdb5e18110c717"></g:ui_element>

As you see, I tested it both with sys_script table and my custom scoped table (called x_doitw_msteams_ih_condition_builder) and in the first case it works, but in the second one - it doesn't.

My custom table is in a scoped application. It has a field of type "conditions" called "condition" and a field of type "table name" called "parent_table".

The condition field uses as a dependent field "parent_table" field.

I also want to make the table static. I don't want the user to be able to change different table. I just want he/she to be able to create a filter for my specific table.

That is why I added as a default value of "parent_table" field the name of my table.

I don't know is there a way not to use the first (table selection) input from the condition builder. For example, to autopopulate it and hide it or just to remove it (see on the picture).

Thanks in advance. If somebody has an advice, I will be glad to try it.

13 REPLIES 13

Hey David,

Thank you so much for the reply, it works. However the <g:ui_element> isn't showing for some users. Do you happen to know why? Is there specific role for it?

Thanks again. 🙂

 

Don't bother it. I got it fixed. It turns out that users need read and write permissions on these fields.

All good. Thanks

I believe a client script with the following example should work:

createCondFilter("incident.s2id_sys_script.collection", "", "s2id_sys_script.collection");

The above code is similar to the call made when a Table Name field is updated. In the above scenario, for the "s2id_sys_script.collection" we would lookup the incident table.

You can try straight away from the browser's console the above code and see if the filter gets updated.

JosephW1
Tera Guru

Could anyone please provide an updated link to the Condition Builder article that the original question mentioned or, if it was scrubbed, an archived version of it? Thanks!