- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2025 11:32 PM
Hi Team,
My use case is to open an outlook email upon clicking a button on a workspace form. I thought to use a declarative action implemented as a server script which includes below line:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 12:20 AM
you need to use client side UI action and write code in workspace client script for this.
Something like this
function onClick(g_form) {
var email = 'recipient@example.com';
var subject = 'Subject of the email';
var body = 'This is the email body.';
// Construct the mailto link
var mailtoLink = 'mailto:' + email + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);
// Open the email client
open(mailtoLink);
}
Output: when I clicked it opened this
Then I selected Outlook app and it opened the email form
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-06-2025 11:36 PM
- Go to UI Builder for your Workspace.
- Select the form or component where you want the button.
- Add a Declarative Action:
- Action Type: Open URL
- URL:mailto:recipient@example.com?subject=Hello&body=This is a test email
- Attach this action to a Button Component:
- On click, it will trigger the mailto: link and open the default email client (e.g., Outlook)
Important Notes:
- This must be done client-side — server-side scripts like gs.setRedirect() won’t work for mailto: links.
- Ensure your browser allows pop-ups and default email client is configured.
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 12:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 12:20 AM
Why "Open URL" Might Be Missing:
Action Type Limitations
- The "Open URL" action type is not available by default in all workspace configurations.
- It may be restricted to certain Next Experience-based interfaces or require specific UX Framework (UXF) components.
Missing UXF Client Action
- You may need to create a UXF Client Action that performs the URL opening logic.
- This is especially true if you're trying to open external links like mailto:.
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 12:20 AM
you need to use client side UI action and write code in workspace client script for this.
Something like this
function onClick(g_form) {
var email = 'recipient@example.com';
var subject = 'Subject of the email';
var body = 'This is the email body.';
// Construct the mailto link
var mailtoLink = 'mailto:' + email + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);
// Open the email client
open(mailtoLink);
}
Output: when I clicked it opened this
Then I selected Outlook app and it opened the email form
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