how to fetch catalog item variable values from 'sc_cart_item' table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 04:33 AM
I have a requirement where HR team imports an excel sheet with a 'Department' column. They do this through a Catalog Item. On the catalog item they select a 'department' variable. Now the requirement is that excel sheet Column and the Variable selected should be SAME. If not, the RITM should not get created.
I tried to achieve this using Before insert Business Rule on sc_cart_item. But I'm unable to fetch variable value from this table.
var deptList = current.variables.department.getDisplayValue(); // not working
this is not helping.
Would be great if I could get some suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 04:40 AM
(function execute(inputs, outputs) {
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.get(inputs.sysId);
outputs.variableValue = ritmRec.variables.variableName;
})(inputs, outputs);
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 04:40 AM
so basically you want to parse the excel and check if the excel column matches the variable?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 04:49 AM
@Ankur Bawiskar Exactly !
But I'm unable to fetch the variable itself. And I don't want to use RITM table to fetch variable value as I want to abort the action if the validation fails.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 05:39 AM
If it's a record producer then it should be possible but difficult for catalog item.
I had done similar validation in the past but it was with record producer
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader