HPE Service Manager / Service Center Support and News Forum
Showing results for 
Search instead for 
Do you mean 

Save Changes - Cart Item

Occasional Contributor

Save Changes - Cart Item

Hi to All,
I Have a problem.
I added a custom fields in the table svcCartItem.
The same fields have been added in the form: svcCat.disp.item and in the form: svcCat.edit.item.
The input for the fields in svcCat.disp.item is: $Var_Name, the input for the svcCat.edit.item is: Var_Name.
I added a trigger(after Add) for the svcCartItem table the call a this script:
function my_function(record){

var myCartItem = new SCFile("svcCartItem");
var rc = myCartItem.doSelect("cartItemId=\"" + record[0] + "\"");

if(rc == RC_SUCCESS){

var Var_name1 = system.vars.$name1;
var Var_name2 = system.vars.$name2;

myCartItem.name1 = Var_name1;
myCartItem.name2 = Var_name2;



In the svcCat.disp.item when I push "Add to Cart" the item is added to cart successfully; but if I try to edit the item by opening the form svcCat.edit.item, the changes are not made.
Can you help me figure out what to do to modify the item?

Thank you very much.

Esteemed Contributor Esteemed Contributor

Re: Save Changes - Cart Item

I'm currently implementing a similar requirement - adding custom fields to svcCat.disp.item.

I like your approach and am going to try something similar - using triggers to update new fields in svcCartItem. I'll let you know if I get it working.
Esteemed Contributor Esteemed Contributor

Re: Save Changes - Cart Item

I have this working some-what successfully.

1. Added new fields to svcCat.disp.item with input as $field1, $field2

2. Added new fields to dbdict svcCartItem: custom.field1, custom.field2

3. Add new dbdict fields to format svcCat.edit.item

4. Added new trigger on svcCartItem, before add

Trigger runs the following code directly (does not call a script library)

if (system.functions.nullsub(system.vars.$field1,null)!=null)

if (system.functions.nullsub(system.vars.$field2,null)!=null)

After adding an item to my cart the trigger runs an populates the custom fields from the variables. Click "edit item" and I can see the new field values on svcCat.edit.item.

Only issue is that modifying these new fields and clicking 'save' will not save changes to the new fields.
Occasional Visitor

Re: Save Changes - Cart Item

You can use another trigger (before udapte) to save your updates :

Displayoption svcCat.edit.item for the Save (make sure you do these modifications for all your do svcCat.edit.item on save)

$custom.field1=custom.field1 in $L.file

$custom.field2=custom.field2 in $L.file



trigger (we create a trigger on the svcCartItem table) before update

if (system.functions.nullsub(system.vars.$custom_field1,null​)!=null)





if (system.functions.nullsub(system.vars.$custom_field2,null​)!=null)







And everything is working fine


Regular Advisor

Re: Save Changes - Cart Item

Hi michael.gregory
I am facing a similar issue now. I am trying to map fields from svcCat.disp.item to svcCat.edit.item. I indeed suceeded with the methods given here. But, now when I try to add another catalog item (same one) I see the field values already stored and display on the form. ? IS there a way to restrict this ?