How to pass custom parameter in cart checkout into request?

Felix20
Mega Guru

Hi everybody,

I want to pass an own ID while checking out my cart. That ID should be saved in my request table.

I have an customer asset, that is shown on a page in serviceportal. I have an inventory action on that customer asset -> for example "Retire". So I click on that button on my asset detail page and are forwarded to an intermediate page where i can see all information of that inventory action -> for example what it means to retire that customer asset. When the user checks out, an Retire catalog item is added to my cart and when i checkout that cart, i want to save the customer asset id in my request table so that i know -> its an retire catalog item but which customer asset should be retired. 

I have already copied and extended the catalog checkout form widget. And i see that there are additionalparameter which are passed to "spScUtil.orderNow". I added an addtional column to request table "u_ca" which should be used to save that customer asset id. So i also added u_ca: "12312312" to that additionalparameter array but it is not save while ...ordnerNow is executed. 

Where do i need to map that parameter from ...spScUtil.orderNow to my request table? The other additionalparameter 'like special_instructions' are also saved on my request.

Best regards,

1 ACCEPTED SOLUTION

This should help you

https://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/

View solution in original post

10 REPLIES 10

Use the workflow/business rule and copy the variable to RITM field/request field.

 

Ex: Copying to RITM field

current.fieldname = current.variables.variablename;

OK, thank you, that would be something possible.

May I just ask one last question regarding the mapping and storage of the "additionalParms" object in widget "sc-checkout" to request table?

find_real_file.png

I do not have much knowledge with service portal. So that is something that I do not think I can help you with.

May you help me shortly with pseudo code how to do that variable adding in catalog client script? I will need tondo that for all catalog item with specifig channel type. There will be multiple catalog items which will be used to do actions on assets. One catalog client script for all catalog items having channel = "actions" would be the best solution

This should help you

https://www.servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/