- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Everyone,
Can someone please help me to create a custom button on a specific catalog item as the UI page is not supported in the recent version of ServiceNow
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes UI page/UI macros are not supported on Portal Side.
Why not use Attachment type variable so that user can upload file?
Why to use other customization?
Types of service catalog variables
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Arundhati ,
We can do this with supported client-side APIs—no UI Pages needed.
Below are two solid implementations depending on where users submit the item:
Service Portal / Next Experience (Catalog UI) — Recommended, simplest
Classic UI16 form — if your users order from the platform UI
1) HTML Variable Button + Catalog Client Script
Works in Service Portal and Next Experience Catalog.
1) Add an HTML variable to the Catalog Item
- Catalog Item → Variables → New
- Type:
HTML - Question: Custom Actions (or similar)
- Default value (HTML):
Uses out‑of‑the‑box Bootstrap styling so it blends in.
2) Add a Catalog Client Script (UI type: All, Type: onLoad)
This binds the click to open the native attachment dialog:
Add another Catalog Client Script (Type: onSubmit) to enforce attachments:
Notes
- Keep Attachments enabled on the item (Catalog item form → Attachment: ✔).
- If you want to hide the default paperclip only in Service Portal, add a small CSS theme rule:
(Scope to the item or page so you don’t hide it globally.JavaScript.sp-attachments, .sp-attachment { display: none !important; }Show more lines
✅ Option B: Classic Platform UI (UI16) users
If some users open the catalog item in the classic UI, the same HTML variable works. The click handler stays the same because g_form.addAttachment() is supported in UI16 catalog as well.
If you prefer a Macro with Label variable instead of HTML:
- Create a UI Macro (e.g.,
u_add_attachment_btn😞
- Add a Macro with label variable and point it to that macro.
- Use the same onLoad client script to bind the click and call
g_form.addAttachment().
Common Tips:
- Attachment disabled: If the Catalog Item has attachments disabled, your custom button will show the error above. Keep it enabled and hide the default UI if you need a custom entry point.
- Service Portal rendering: Bind handlers after the DOM is available (the
setTimeoutretry above handles that). - Validation: Use
g_form.getAttachments()duringonSubmitto make attachments required. - Limiting file types/sizes: You can’t fully enforce on the client; rely on System Properties and ACLs/Validators. You can display guidance messages or do server-side validation (Flow/Scripted validation) and return an error message.
Please mark as helpful, if you learn something from this
Thanks
Yamsani Bhavani
Developer - SN SecOps, Custom Applications, UI Builder, Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @Arundhati
There are several ways to do it.
But first recommendation is to implement it by UI macro as per Servicenow KB article KB0791202 :
'Add Attachment' button on catalog that works on both request catalog item form and RITM form.
You can create a variable with type custom there you get options to include macro
Also you can refer : https://www.servicenow.com/community/servicenow-ai-platform-blog/create-a-custom-attachment-button-f...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes UI page/UI macros are not supported on Portal Side.
Why not use Attachment type variable so that user can upload file?
Why to use other customization?
Types of service catalog variables
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
