To add client condition in attachment action by using javascript:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2025 10:30 AM
I want to fetch attachment sys ids in a filter where action model field is used which attachmentSysId.
I have added condition like this but it is not showing attachment action on the form even if the attachments are getting added. I have tried the same code in attachment table by using sys is one of it is showing those sys_ids. Could you suggest something to add condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2025 06:12 AM
In attachment action there is one action called as removal I need to show it only if the the field in respective attachment record is true. Please refer removal attachment action attachment for the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2025 07:19 AM
So are you saying based on INC field value that option should be shown?
If yes then you can use Script Condition and pass the current.sys_id to script include
if the current.sys_id -> is sys_attachment sysId then query that table record with sysId and check the field value
I am not sure how that action assignment is created and how it came in that attachment option
Share screenshots for that so that I can try in my instance
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
08-21-2025 07:27 AM
I want to check if selected attachment is having checkbox as true or not.If is true then we need to show the action. This attachment action so when we create attachment action, action model fields comes automatically where attachmentSysId is there.
In script condition,current.sys_id takes incident sys_id where attachment is attached.
In client conditions ,it shows action model fields which has attachmentSysId but it does not accept scripted filter in it. For e.g. attachmentSysID "Is one of" javascript:new global.checkAttachment().checkAttachment(current.sys_id).
I need to add criteria or condition on action so that it will check for each attachment if the checkbox is true in the attachment or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2025 07:27 AM
what do you mean by attachment record?
based on which record's field you need to hide that?
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
08-21-2025 07:13 AM
Hi @Ankur Bawiskar Any idea or thoughts ?