レコードプロデューサーでSubmit時に添付ファイル数をチェックする方法
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
こんにちは。
レコードプロデューサーのSubmit時に以下の標準の添付欄に添付されているファイル数を取得して、不足していれば警告を出すスクリプトを組みたいです。
どうやっても添付ファイル数が取得できず…
皆様からアドバイスをいただきたいです。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
Hi @恵那白
You can use GlideAjax + Script include to retrieve the count of Attachments using GlideSysAttachment Class and block submit if file is missing.
try at your end and let us know when you stuck on code.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
昨日
if you are planning to run your code only in portal then this onSubmit catalog client script will give you the count of files
Note: This code will work only in portal and not native
function onSubmit() {
var count = getRPAttachmentCount();
if (count != 3) {
g_form.addErrorMessage('You must add 3 attachments before submitting this request.');
return false;
}
}
function getRPAttachmentCount() {
var length;
try {
length = angular.element("#sc_cat_item_producer").scope().attachments.length;
} catch (e) {
length = -1;
}
return length;
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
