Landing on SP portal home page when we click on M365 meets my requirements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === oldValue) {
return;
}
// Trigger only when the new value is "new"
if (String(newValue).toLowerCase() === 'new') {
try {
var uiPageSysId = "<UI_PAGE_SYS_ID>";
// Classic UI link
var uiPageLink = "/now/nav/ui/classic/params/target/sys_ui_page.do?sys_id=" + uiPageSysId;
// Your Service Portal URL
var spHome = "<SERVICE_PORTAL_BASE_URL>";
// Service Portal path
if (typeof spModal !== 'undefined') {
var ga = new GlideAjax('CatalogUIPagesAjax');
ga.addParam('sysparm_name', 'getUiPageHtmlById');
ga.addParam('sysparm_page_id', uiPageSysId);
ga.getXMLAnswer(function(response) {
spModal.open({
title: 'Recommendation',
message: response + "<p>Would you like to proceed with Shared Mailbox creation?</p>",
buttons: [
// BUTTON 1 — Proceed with Shared Mailbox Creation
{
label: 'Proceed with Shared Mailbox Creation',
primary: true,
action: function() {
spModal.open({
title: 'Action Required',
message: "<p>Please exit the form and open the following link to proceed:</p>" +
"<p><a href='" + uiPageLink + "' target='_blank'>Open M365 Mailbox Page</a></p>",
buttons: [
{
label: 'OK',
primary: true
}
]
});
}
},
// BUTTON 2 — M365 Group Meets My Requirements
{
label: 'M365 Group Meets My Requirements',
action: function() {
// Redirect user to your Service Portal home page
window.location.href = spHome;
}
}
]
});
});
// Classic UI path
} else if (typeof GlideModal !== 'undefined') {
var proceed = confirm("Click OK to proceed with M365 Mailbox creation, or Cancel if M365 Group meets your requirements.");
if (proceed) {
alert("Please exit the form and open this link:\n" + uiPageLink);
} else {
window.location.href = spHome;
}
// Fallback
} else {
var proceedFallback = confirm("Click OK to proceed with M365 Mailbox creation, or Cancel if M365 Group meets your requirements.");
if (proceedFallback) {
alert("Please exit the form and open this link:\n" + uiPageLink);
} else {
window.location.href = spHome;
}
}
} catch (e) {
if (typeof g_form !== 'undefined') {
g_form.addErrorMessage("Error opening modal: " + e.message);
}
console.error("Error opening modal:", e);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
what's your actual question?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@Ankur Bawiskar : Requirement is to land on SP portal page when user clicks on M365 button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
can you please tell where this button is coming from and on which form?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
We configured this popup using a Client Script that calls spModal.open() and defines two buttons. Each button has its own action: function, and for the “M365 Meets My Requirements” button we simply added a redirect to the Service Portal.