Need help on UI Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 04:27 AM
Hi All,
I need some help here.
Use Case- Restrict attachment insertion for more than 25 MB on knowledge table but this restriction should not be applied for view HR(custom view). Also the warning which is added on attachment UI Page should not be visible to knowledge record where view is HR.
The solution which I have right now works well post submission of record but doesn't work on new record.
Here are the snapshot:
Business Rule (On attachment table, before business rule)
2. UI Page:
On UI page I'm trying get the view of new knowledge record, but it is giving me log in null.
Any help on this would be a great help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 05:02 AM
There is some issue going on in community that images are not visible.
please add it using browse feature and add as attachment to post
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 05:11 AM - edited ‎07-23-2025 07:29 AM
Business Rule:(On Attachment table,before business rule)
try {
var checkAttachmentSize;
var attachmentFlag = false;
// List of tables to check
var allowedTables = ['task', 'cmdb_ci'];
var attachemtTable = current.table_name;
// Get the base table for the given table name
var baseTable = String(new global.Hnk_project_process().getBaseTable(attachemtTable));
var grRecord = new global.Hnk_project_process().getScope(attachemtTable);
var kbRecord = new global.Hnk_project_process().getKnowledgeBase(current.table_sys_id);
// If the base table matches and the attachment exceeds max size, restrict it
if ((allowedTables.includes(baseTable) && !grRecord.startsWith('Human')) || (attachemtTable == 'kb_knowledge' && !kbRecord.startsWith('HR'))) {
checkAttachmentSize = new global.Hnk_project_process().getAttachmentSize(current);
var totalSize = parseInt(current.size_bytes) + checkAttachmentSize;
var maxSize = 25 * 1024 * 1024;
if (totalSize > maxSize) {
attachmentFlag = true;
gs.addErrorMessage('Total attachments on this record cannot exceed 25 MB.');
current.setAbortAction(true);
}
}
} catch (ex) {
gs.error("Attachment could not be find." + ex.message);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 06:21 AM
if you are planning to customize the OOTB attachment UI page, I will recommend not to do that.
I will push back on this requirement as you are touching an OOTB component.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 07:32 AM
<j2:if test="$[!scope.contains('sn_hr')]">