How to make Group as a required field on the Insert Workflow Task form on Requests, without having to enforce it on the Schema?

Document ID : KB000010651
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

Making a field as a Required field can be achieved in couple of ways. Normally enforcing it to be a Required field on the Service Desk Manager schema is one option, while the other one is to make such a field with is_required attribute set on the form level.

Background:

Service Desk supports required field validation for some common detail forms (example: detail_cr.htmpl) which have Save buttons. This specific form, insert_cr_wf.htmpl, is not a detail form and so would not come inherent with form validation support which is seen in other detail forms.

 

So, even if you were to change the form source code from:

detailLookup("Group","wf_ins_grp","grp",
1,20, "0","$args.wf_ins_grp.persistent_id","$args.wf_ins_grp",
"yes","combo_name",
'$args.wf_ins_grp_combo_name',
"$args.SEARCH_STATUS_wf_ins_grp","$args.SEARCH_RESULTS_wf_ins_grp","yes","");
detailEndRow();

 

to:


detailLookup("Group","wf_ins_grp","grp",
1,20, "1","$args.wf_ins_grp.persistent_id","$args.wf_ins_grp",
"yes","combo_name",
'$args.wf_ins_grp_combo_name',
"$args.SEARCH_STATUS_wf_ins_grp","$args.SEARCH_RESULTS_wf_ins_grp","yes","");
detailEndRow();

 

The group field shows as required on the form level (has an asterisk next to the group field). However, you can still click on Add and insert a new workflow without populating the group field. The same issue persists with Assignee field too.

Instructions:

1) In insert_wf.htmpl, identify the line:

<PDM_MACRO name=dtlForm button=false factory=chg>

2) Change it to look like: 

<PDM_MACRO name=dtlForm button=false factory=chg onsubmit="if(detailValidate()) return false;">

3) The above change is to add a form level validation, which will call an existing function: detailValidate().

 

4) Save and pdm_webcache or restart SDM to take care of the changes.

 

This function takes care of the validations to be done on the form.

Additional Information:

As mentioned in the summary, this customization is out of scope of CA Support and is supported as is.