Custom validation script to prevent submit unless a file is attached.

51 views
Skip to first unread message

Jev Björsell

unread,
Mar 7, 2014, 5:05:38 PM3/7/14
to erpnext-dev...@googlegroups.com
Hi,

I want to write a custom script that checks if the number of attached files is greater than xero. If there are no files attached, I want to raise a validation error.

I do recall seeing an example script that does exactly this job, but I can't find it any more. Can some one please offer some guidance on how to get a list of attachments for a given DocType record.


Thank you,
-Jev

rushabh

unread,
Mar 10, 2014, 2:52:37 AM3/10/14
to erpnext-dev...@googlegroups.com
Check this property to see number of attachments:

keys(cur_frm.attachments.get_attachments()).length;
Reply all
Reply to author
Forward
0 new messages