Resetting/Emptying variable values onSubmit

nomadie
Kilo Expert

I need to do multiple request/order of the same catalog form, using Add to Cart and I need to clear these two fields everytime I click on the add to cart button.

Catalog Client Script doesn't work clearing/resetting/emptying the variables because it affects the RITM/SCtask form too... Would you know other way to fix this? I only need to clear 2 fields out of 5 variables/questions. 

Catalog Client Script
Type: onSubmit
Applies on a Catalog Item view: True
Applies on Requested Items: False
Applies on Catalog Tasks: False
UI Type: All

function onSubmit() {
   //Type appropriate comment here, and begin script below
   g_form.clearValue('install_software');
   g_form.setValue('new_hire_software_justification','');
}
11 REPLIES 11

Vikram Reddy
Giga Guru

HI nomadie,

 

-On Submit runs after submission but not before

-Do you have any conditions for clearing them?

-If not why not hide them from catalog form, however you are clearing them

-If you have any conditions try to clear them from on change client script

 

Thank you,

Vikram

that's correct, i have to clear the field after my first submission of request/order. On my succeeding request/order of the same catalog item, I need to clear these fields for me to fill in.

I do not have any condition.

I played around creating a trigger field on the onChange but didn't made the trick.

Got it, in that case you can make use of run script activity in the catalog item workflow. Access your desired variables with current.variables object

Something like this

current.variables.install_software = '';

current.variables.new_hire_software_justification = '';

 

Thank you,

Vikram

 

No run script on the start of the workflow didn't work too.