Incident should submit only attachment is available
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 11:33 AM - edited 03-01-2024 11:35 AM
Could you please help me on below
My requirement is incident should not be submitted with out attachment.
Below is the onsubmit client script and it is not working. Please have a look on it
function onSubmit() {
//Type appropriate comment here, and begin script below
var attachmentField = g_form.getControl('attachment');
var attachment = attachmentField.getAttachmentList();
if (attachment.length == 0) {
g_form.addErrorMessage('Incient should not submit without attachment');
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 12:01 PM - edited 03-01-2024 12:02 PM
Hi @kpkumar2k9,
Is this for a record producer? If so, there is a 'Mandatory Attachment' field which you can set to true to mandate an attachment.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 12:04 PM
No @James Chun -- It is incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 04:27 PM
Hi @kpkumar2k9 ,
You can create a Before insert business rule
Table: Incident
advanced: checked
If you need this to trigger based on some condition you can configure that in Filter Condition
inside script:
(function executeRule(current, previous /*null when async*/ ) {
if (current.hasAttachments() != true) {
gs.addInfoMessage("PLease add an attachment before creating the incident");
current.setAbortAction(true);
}
})(current, previous);
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 09:49 PM
Hi @kpkumar2k9 ,
Refer below link
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand