
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 06:55 AM
I have a small form in this Catalog item. When one of the checkboxes is ticked, I need the attachment to be mandatory. If it is not checked it must not be mandatory.
I have read a ton of articles on how to do this, all different. Can I use a UI policy to change the OOTB 'Mandatory attachment' variable? That would seem easiest to me.
Most articles seem to work around it with a UI script
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 08:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 07:12 AM
Hi,
You cant use "Mandatory attachment" field or UI Policy. "Mandatory attachment" field make the attachment mandatory for the catalog item. You can't apply using condition. You have to use client script. Refer below thread:
Palani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 07:16 AM
I'm going to try that one out, thanks for the clear answer about UI policy!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 08:07 AM
I created a Catalog Client Script, added it to the catalog item that I want it to run on, with the following code. What am I missing? I dont get the error message at all.
The variable 'afstemming_met_stakeholders' is a checkbox in the form. the UI type is set to Mobile/Service Portal. Type is onSubmit and applies on Catalog Item view.
function onSubmit() {
//Type appropriate comment here, and begin script below
var condition= g_form.getValue('afstemming_met_stakeholders');
if(condition==true)
{
if (this.document.getElementsByClassName('get-attachment').length == 0)
{
g_form.addErrorMessage('Please Attach a file');
return false;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2021 08:12 AM
Solved, condition==true had to be condition=='true'