- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 08:01 AM
Hi Team,
As image below i'de like to insert this field, "catalog_conditions" using Background Script Table.
I tryed to using this code below but this specific line:
"gr.catalog_conditions = '6f4762f9939f061097e2ff747aba1032' + '=' + 'Op11BOARIBA'"
doesn't work. Anybody help me if this format is correct?
Thank you
var gr= new GlideRecord('catalog_ui_policy');
gr.initialize();
gr.short_description = 'Show additional details when "Others"';
gr.applies_to = 'item'
gr.active = true;
gr.applies_catalog = true
gr.catalog_conditions = '6f4762f9939f061097e2ff747aba1032' + '=' + 'Op11BOARIBA'
gr.catalog_item = '6f4762f9939f061097e2ff747aba1032'; // sys_id of Item Catalog
gr.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2024 10:04 AM
I could find a solution using the sentence like this
IO:0857223d939f061097e2ff747aba1096=Op11BOARIBA^EQ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 08:03 AM
Hi,
Try with encoded query , like below
var gr= new GlideRecord('catalog_ui_policy');
gr.initialize();
gr.short_description = 'Show additional details when "Others"';
gr.applies_to = 'item'
gr.active = true;
gr.applies_catalog = true
gr.catalog_conditions = '6f4762f9939f061097e2ff747aba1032=Op11BOARIBA'
gr.catalog_item = '6f4762f9939f061097e2ff747aba1032'; // sys_id of Item Catalog
gr.insert();
But I'm curious why are you creating a ui policy using script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 08:18 AM - edited ‎07-11-2024 08:19 AM
Hi Anurag,
Thank you for you quikly support. Both fields are distincted and i have two variable for this values.
var a1 = ''6f4762f9939f061097e2ff747aba1032';
var a2 = 'Op11BOARIBA';
when i try something like this, doesn't work
gr.catalog_conditions = a1 + '=' + a2;
Are you know how can i do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 08:20 AM
A condition builder results in an encoded query and takes an encoded query only
Try with a hardcoded query and see of that works. Anything simple.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2024 11:16 AM
i've tryed to insert hardcode but it doesn't work too =(
i had a diferente result when i inserted a "^" and the end of var like:
var completeSentence = 'IO:8457223d939f061097e2ff747aba10a7^=^Op3BOARIBA'
This "IO" is necessary to insert in the beginig of sys_id.
The problem here is, even that the sys_id changed, it's always will select the first option from select box field