Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts

Sunday, December 14, 2025

Why ServiceNow Schedule Calendars Suddenly Stop Working (Even Without Role Changes)

Why ServiceNow Schedule Calendars Suddenly Stop Working (Even Without Role Changes)

A user reports:

"Last month I could open the Schedule Calendar using 'Show Schedule,' but now I get a Security constraints prevent access message."

No role changes. No group changes. No recent deployments touching On-Call. Yet the calendar suddenly becomes inaccessible.

This scenario is far more common than it appears, and it usually isn't a defect. It's a data-level permission shift — a silent change that occurs underneath the roles and groups. Let's break it down.

1. Schedule access isn't controlled only by roles

Many ServiceNow users assume:

"If I'm in the right group and have on-call roles, I can access the schedule."

But schedule access depends on ownership and underlying ACLs, especially on these tables:

  • cmn_schedule — the base schedule record
  • cmn_rota — the on-call shift record layered on top of a schedule
  • cmn_schedule_span and, for On-Call Scheduling specifically, roster_schedule_span — the individual time spans that make up the calendar view

If the owner group, schedule, or rota visibility shifts — even slightly — a user may lose access without any admin touching their roles.

Typical causes

  • Schedule ownership changed to a group the user is no longer part of
  • Rota owner field updated accidentally
  • A new ACL was introduced by another team or plugin
  • A schedule was copied from another environment with different permissions

2. "Show Schedule" loads a calendar UI page — and that page enforces ACLs

The "Show Schedule" link loads a specific UI Page that visually renders the calendar. This page queries schedule records, loads rota and span data, and renders only what the user is allowed to see.

If the user fails even one ACL check on any related record (for example, a span they cannot read), the entire page can fail with:

Security constraints prevent access to requested page

Even though the user has the same roles and the same group membership, they can still fail an ACL evaluation because the data they're trying to view is now restricted.

3. Why it "used to work" and now it doesn't

This is the most confusing part for users. It happens because someone changed the schedule's group, the rota's owner, a span record's permissions, or a schedule was overwritten or reimported — or a Dev → Test → Prod migration created mismatched access.

These changes often happen silently:

  • A rota owner edits the group
  • Another support team updates a schedule
  • Copy changes from one environment alter ownership
  • A plugin update modifies ACL inheritance

No code change. No role change. But access breaks.

4. The quickest way to diagnose the issue (admin steps)

Step 1 — Test as the impacted user (Impersonate). Try to open the group, the on-call schedule, the specific rota, and the calendar UI page. Find what fails.

Step 2 — Check these ACLs. Review read ACLs on cmn_schedule, cmn_rota, and cmn_schedule_span (or roster_schedule_span if On-Call Scheduling is active). If any "read" ACL denies access, the calendar collapses completely.

Step 3 — Confirm schedule ownership. Check Schedule → Group, Rota → Group, and Coverage/Span → Owned by which group. If ownership belongs to a private group the user cannot see, the calendar stops loading.

5. How to prevent this issue in the future

  • Lock schedule ownership. Assign a single designated owner group for on-call schedules and restrict edit access.
  • Prevent accidental schedule overwrites. If teams import or export schedules across environments, enforce update sets with fixed ownership and restrict access to schedule tables.
  • Build a diagnostic report that flags schedules owned by private groups, rota records with mismatched permissions, and spans that belong to inconsistent groups.
  • Add a knowledge article for end users so that instead of panic escalations, they understand what the error means, why it occurs, and how to request access properly.

Conclusion

When "Show Schedule" suddenly stops working, it's rarely a defect — it's usually data-level permission drift. The underlying tables powering on-call scheduling are sensitive to ownership and group visibility, and even a small shift can break the UI page.

With controlled ownership, regular audits, and a simple access troubleshooting checklist, this becomes a preventable issue.


Table and field names referenced here reflect the base Common Schedule and On-Call Scheduling data model. Exact ACL configuration and inherited access rules can vary by instance, active plugins, and customizations — verify against your own instance before making ACL changes.

Sunday, November 30, 2025

How to Generate the Correct OneDrive OAuth Token in ServiceNow

If your ServiceNow instance keeps uploading files into the wrong OneDrive folder, it means the OAuth token was issued for the wrong Microsoft account. This is the exact procedure to generate a correct token for the right service account, using a manually configured OAuth Application Registry — the approach behind a custom-built OneDrive integration rather than ServiceNow's official OneDrive Spoke.

A note on scope before starting: this procedure applies specifically to a custom OAuth setup built around a System OAuth Application Registry entry, which relies on the delegated permissions model — the same mechanics covered in this blog's companion articles on why ServiceNow needs two Microsoft identities, and why uploads land in the wrong folder in the first place. If your integration instead runs through ServiceNow's official Microsoft OneDrive Spoke, authentication is typically managed through its own Connection & Credential Alias — often set up with a certificate-based application identity rather than a delegated user session — and this specific token-regeneration procedure won't apply the same way. Confirm which of the two you're actually running before following the steps below.

Prerequisites

  • OneDrive service account
  • Azure AD (Entra ID) admin account, for App Registration
  • OneDrive OAuth profile configured in ServiceNow
  • Valid Client ID and Client Secret

Why This Procedure Is Necessary

With SSO environments:

  • VDI login automatically logs users into Microsoft.
  • Teams/Outlook auto-start with cached credentials.
  • Office apps silently authenticate.

This means clicking Get OAuth Token will always use whatever Microsoft session is active — even if you logged into ServiceNow with a different account.

Step-by-Step Procedure

Step 1 — Completely Log Out of All Microsoft Sessions

You must remove all cached Microsoft identity data:

  • Sign out of Teams.
  • Sign out of Outlook.
  • Stop the OneDrive sync client.
  • Close Office apps.
  • Log out of Office.com.
  • Clear browser cookies.
  • Restart the browser.
  • Optionally, reboot the VDI session.

Step 2 — Open a New Incognito Window

Do not use a normal window — normal windows share cookies from the VDI session you just tried to clear.

Step 3 — Sign In to Microsoft Manually With the OneDrive Account

In the incognito window:

  • Go to https://login.microsoftonline.com.
  • Sign in as the OneDrive service account.
  • Complete MFA if required.

At this stage, Microsoft knows the identity that should receive the OAuth token.

Step 4 — Log In to ServiceNow With the Same Service Account

Still in the same incognito window:

  • Log in to ServiceNow as the OneDrive service account.
  • Do not use impersonation — impersonation only changes the ServiceNow-side identity, not the Microsoft session behind it.

Step 5 — Navigate to the OneDrive OAuth Profile

Go to:

System OAuth → Application Registry → Your OneDrive OAuth Profile

Step 6 — Click "Get OAuth Token"

This time:

  • Microsoft sees the OneDrive service account as the active session.
  • Microsoft issues the OAuth token for the OneDrive service account.
  • ServiceNow stores the token under the OneDrive service account's user context.

Step 7 — Validate the Token

Run a test action against your configured OneDrive integration — for example, a Create Folder action. The folder should appear under the OneDrive service account's OneDrive path, not any other account's.

What If It Still Shows the Wrong Account?

Then the VDI or OS-level Microsoft session is still active. Use one of these options:

  • Try a different browser.
  • Use an entirely different machine.
  • Use a private Windows account profile.
  • Disable Teams auto-login temporarily.
  • Use a clean VM with no corporate SSO session.

Once the correct token is captured, normal usage will no longer rely on the end user's Microsoft session — the token, once correctly issued, stays valid independent of whoever's logged into Windows or Teams afterward.

If You're Doing This Often, Consider the Structural Fix

This procedure works, but it's worth being honest about what it actually is: a careful manual workaround for a session-dependent authentication model. If this keeps recurring — a token needs regenerating every time someone's VDI session changes, or every time a service account's cached credentials expire — that's a signal worth acting on, not just repeating the fix for. Moving to ServiceNow's official Microsoft OneDrive Spoke, configured with a certificate-based application identity rather than delegated permissions, removes the session dependency at its root. See this blog's companion article on wrong-folder uploads for the specific setup details, including the Sites.Selected scoping option that keeps the application's access appropriately limited rather than organization-wide.

Summary

To ensure ServiceNow writes files into the correct OneDrive folder:

  • The OneDrive service account must be the active Microsoft identity when generating the OAuth token.
  • Logging in to ServiceNow as that same service account ensures correct token storage.
  • Clearing cached Microsoft sessions is essential in SSO environments.

Following these steps guarantees the OAuth token belongs to the correct storage account every time — and if you find yourself following them often, that's the cue to look at the Spoke-based alternative instead of treating this as a permanent routine.