Email access token are not getting refreshedDescriptionThe access token for an active email account that has OAuth set up with a valid OAuth profile associated does not refresh as expected based on its expiry time as set in the "oauth_credential" table thereby causing failure in email sending with "OAuth token has expired or has not been retrieved." message. Below are the steps to reproduce the issue: Create two or more sys_email_account with OAuth authenticationRun the below script and pick the first sys_email_account var grAccount = new GlideRecord("sys_email_account"); grAccount.addQuery("authentication", "oauth2"); grAccount.addNotNullQuery("oauth_profile"); grAccount.query(); Disable the oauth_entity related to the sys_email_accountRun Refresh Email Access Token scheduled job ☞ It will log "com.glide.script.RhinoEcmaError: Cannot convert null to an object." and it will not continue the loop for refreshing the other sys_email_account accounts.CauseAccess tokens will not be refreshed automatically by the "Refresh Email Access Token" scheduled job if one of the oauth_entity records linked to a sys_email_account is set to Active = False.This is a known defect tracked via PRB1588339 and a fix is available in the Utah Patch 1 version.ResolutionThe workaround is to remove the OAuth profile from the inactive email account which is associated with an inactive application registry record. (or)The workaround is to remove the email account with the inactive OAuth2 Provider.Post the above steps, use the below query to find if the "Refresh Email Access Token" scheduled job is able to initiate a call to refresh the token.Log reference # https://instancename.service-now.com/syslog_list.do?sysparm_query=messageLIKERefreshing%20oauth%20access%20token%20for%20email%5Esys_created_onONToday%40javascript%3Ags.beginningOfToday()%40javascript%3Ags.endOfToday()&sysparm_view= Then go to the oauth_credential table and validate if the expiry date for the active OAuth profiles that are associated with the active SMTP email account is having a future expiry time.Additional InformationManaging OAuth Tokens in ServiceNowConfigure SMTP and IMAP email accounts with Microsoft Office365 using OAuth2