How do i call an onSubmit client script on a catalog task for only certain variables

abcmh
Giga Contributor

I have a catalog item where i am creating 2 catalog tasks in the workflow.

When i close the first catalog task in the workflow, it opens another catalog task.

There are about 6 or 7 check box variables that are only visible on the the first catalog task and these are mandatory. The mandatory check for the checkbox variables

is being called on the OnSubmit event. IT works great on the first task.

However these checkbox variables are not available on the 2nd task and don't need to be checked for mandatory. But since my script runs on the OnSubmit it is triggered

for all the catalog tasks.

How do i make this script run only on the first task. Is there a way to check if the check box variables exist on a task before calling the OnSubmit?

Any input is appreciated.

Thanks.

7 REPLIES 7

abcmh
Giga Contributor

This worked perfectly. Exactly what i was looking for. Thank you so much for your input. appreciate it.


alexchansuthus
Kilo Contributor

In similar situation, I've done g_form.getValue('short_description').   Then, based on the name of the short description, determine which fields to set as mandatory and what is not.   Though, I do not recommend using mandatory for checkboxes (since what you really mean is to make that checkbox always checked).   Instead, set default value as true, then set read-only is true on an onLoad script instead.


So , where do i check for the task short description ? In the catalog client script that only applies to the task?