Making Attachment Mandatory in Table Form and workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2024 01:07 PM - edited ‎07-04-2024 01:10 PM
Hi guys, Can you help me out with this? I am working on the CSM workspace and we know that the workspace UI is a table form and if we make changes in the form it should reflect in the workspace. My requirement is to make attachment mandatory if the document field is 'Yes' in the workspace but I can't find a way to do it. I have seen tutorials but they are not working. Even the business rule is not a good option to use in fact it gives an ugly error (Invalid Insert) which is probably caused by using SetAbortAction. I just need a solution using Clientscript and scriptinclude or what ever you suggest the best way.
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 07:51 AM
Take a look at option 5 here:
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 12:47 PM
I don't want to apply this on the catalog item but on the form. Take incident form as an example, if the category is selected to software then attachment should be mandatory. I have code written lemme show you. The problem is its all working fine except one thing, and that is when the attachment is attached then the form does not submit.
Client side:
and this is server side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 10:51 AM - edited ‎07-05-2024 10:56 AM
HI @MYousaf111 Create onSubmit Client Script and use below code. I have tested and it's working fine
function onSubmit() {
if ((g_form.getValue('u_document') == 'true') || (this.document.getElementsByClassName('get-attachment').length > 0)) {
g_form.addErrorMessage(getMessage('Attachment is required when the field is set to True.'));
return false;
}
}
Please mark my response Correct/Helpful
Regards,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 12:49 PM
It does show an error when submitted without an attachment but when the attachment is attached the form does not get submitted.