Conditions "IF" in Variables or record Producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 07:02 AM
Hi,
I have a problem with adding a conditions to Variables.
Look I have a couple fields like these:
and I created a custom tables for data which are inside of those fields.
Now I want to see for example something like:
If field division will be "cloating" then in field "group" you can see only record which have u_division_type like "cloating" these parameters I added to Table as a value in fields to recognize values.
How to prepare those part of code and
Where I can put script like this?
Right now I tried to use
but it's not dependent of division field...
- Labels:
-
Incident Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 08:13 AM
Since group appears to be a List Collector type variable, be sure to add a Variable attribute
ref_qual_elements=division
where division is the name of the variable. This will ensure the list is updated when the division variable changes.
Your reference qualifier should look more like this:
javascript:"u_type=Group^u_division_typeIN" + current.variables.division
since division appears to be a list collector as well. This is assuming 'Group' is the correct value stored in the table, not 'group', and your u_division_type field needs to be a reference to the table used by the division variable as that variable will be storing the sys_id(s) of the selected division records. In case this editor still replaces text, the reference qualifier starts with javascript followed by a colon symbol then the quote.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 01:55 AM
Unfortunately, still not working... 😞
Look Here is a table with full data:
and for now I have a fields on Service Portal in type as "List Collector" cause I want to get data from table from previous screen and then look for data based on conditions.
so first we have a field "division"
where we have only to choices:
Here is a division variable
and if we will choose "cloathing" then I want to see in a group field only record which have u_division_type as 'cloathing' (technical name from table)
and similar for the second choice of division
Then I want to create something close like this for the choices of "Group" field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 01:59 AM
Also I added Attributes about which you wrote and same situation I can see full data in a field "Group"
like even records which have different u_type:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:29 AM
The value stored in the division List Collector variable will be a comma-separated list of sys_ids of the aClothing and bGeneral Merchandise table records (that have the u_type=Division) so a reference qualifier attempting to show only records in this table with that/those division types will only work if the u_division_type field on the table is a reference to the same table. You can add a reference qualifier to this table field so that you can only choose Division type records. Then the reference qualifier that I provided will show you only the Group type records which have a division type = to one of the selected divisions - also making sure to include the variable attribute on the group list collector variable and replace : with the colon symbol.