Is there a way to get the cart item id in portal

venkatiyer1
Giga Guru

Hi all,

in the normal view of a service catalog item, if you were to try executing g_form.getParameter("sysparm_item_guid")   you would get the cart item id in advance before the item gets submitted.

Is there a way where i can get the cart item id of the item getting submitted in service portal?

1 ACCEPTED SOLUTION

Ahh, yes now I understand.



Unfortunately it is not possible in serviceportal. The serviceportal uses the cart API and therefore does not pre-generate any IDs as it just passes the catalog item details along when you add an item to the cart.



Maybe you can describe your business logic for this, and I might be able to give you some alternative suggestions?


View solution in original post

10 REPLIES 10

larstange
Mega Sage

Hi



Yes you can use g_form.getSysId() instead


HI Lars,



Thanks for the reply but that is giving me the sys id of the catalog item which can be obtained by the getUniqueValue as well. In desktop, you can get the cart item id ahead of time.


Ok, sorry I thought that was what you where after.



What do you mean about "cart item id" - which ID are we talking about here?


venkatiyer1
Giga Guru

Hi Lars,



once we add an item to the cart it adds that record to the sc_cart_item table. On checkout we create the requested item. cart item id is the sys id of sc_cart_item record. In desktop, we can retrieve the sys id of the sc_cart_item even before it is inserted as it stored in the sysparm_item_guid. I was meaning to do the same in service portal as well as i wanted to dynamically edit the cart.