Resetting/Emptying variable values onSubmit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:11 AM
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','');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:53 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 05:58 AM
No run script on the start of the workflow didn't work too.