- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 05:11 AM
HI All,
I need to know that Where maintain item or record producer variables are stored initially?
If anybody knows the answer kindly share with me.
Thanks in advance,
SNOW
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 07:29 AM
Hi,
As per the script you are asking about the Catalog Item and not record producer. Please find the below script:
var mandatoryFieldCheck = new GlideRecord('item_option_new');
mandatoryFieldCheck.addQuery('cat_item','sys_id of catalog item');
mandatoryFieldCheck.addQuery('active',true);
mandatoryFieldCheck.query();
while(mandatoryFieldCheck.next()){
if(mandatoryFieldCheck.mandatory == true)
gs.print(mandatoryFieldCheck.question_text);
else
gs.print('Not mandatory');
}
Regards,
Ram M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 07:00 AM
Hi
Yes
But my aim is to get particular service catalog item's variable.
How to get that variables.
I have tried the below script in fix script and got all variable names.
var mandatoryFieldCheck = new GlideRecord('question');
mandatoryFieldCheck.addQuery('cat_item','Apple iPad 3');
mandatoryFieldCheck.addQuery('active',true);
mandatoryFieldCheck.query();
while(mandatoryFieldCheck.next()){
if(mandatoryFieldCheck.mandatory == true)
gs.print(mandatoryFieldCheck.question_text);
else
gs.print('Not mandatory');
}
Because the catalog item visibility missing in question table
Is there any alternative way to get that variables.
Kindly help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 07:29 AM
Hi,
As per the script you are asking about the Catalog Item and not record producer. Please find the below script:
var mandatoryFieldCheck = new GlideRecord('item_option_new');
mandatoryFieldCheck.addQuery('cat_item','sys_id of catalog item');
mandatoryFieldCheck.addQuery('active',true);
mandatoryFieldCheck.query();
while(mandatoryFieldCheck.next()){
if(mandatoryFieldCheck.mandatory == true)
gs.print(mandatoryFieldCheck.question_text);
else
gs.print('Not mandatory');
}
Regards,
Ram M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2018 04:36 AM
Hi
I have one more query here like I want to check that the mandatory field has value or not.
Because, I have created addToCart button on each catalog item on service portal. But the issue is my button allowing user to place the order without filling the mandatory field value.
So if you know how to check the catalog item mandatory field has value or not then kindly share with me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2018 04:58 AM
Hi,
Need to create an onSubmit script on each catalog item and check if those mandatory fields have value or not if there is no value then add the alert statement and then return false.
Regards,
Ram M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2018 05:53 AM
Hi,
Thanks for your valuable time.
I want to write code in service portal widget. Writing code in catalog client script may not help me.
Is there any way to get that question and answers field. So that I can check that table for the mandatory value.