We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

how to fetch catalog item variable values from 'sc_cart_item' table

Lovely Butola
Tera Contributor

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.

7 REPLIES 7

Not applicable

@Lovely Butola 

 

(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

Ankur Bawiskar
Tera Patron

@Lovely Butola 

so basically you want to parse the excel and check if the excel column matches the variable?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Lovely Butola
Tera Contributor

@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.

@Lovely Butola 

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

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader