Error "SampO365Admin.getProfileTypeFromAttachment" When Attaching a File in Service Portal<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } @import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&family=Source+Code+Pro:wght@400;500&display=swap'); :root { --color-bg: #ffffff; --color-text: #1a1a2e; --color-text-secondary: #4a4a68; --color-heading: #0f1b2d; --color-accent: #293e6b; --color-accent-light: #e8ecf4; --color-border: #d1d5e0; --color-code-bg: #f4f5f8; --color-error-bg: #fdf2f2; --color-error-border: #e8b4b4; --color-info-bg: #f0f4fa; --color-info-border: #a8b8d8; --color-success-bg: #f0f7f0; --color-success-border: #a8c8a8; --color-step-number: #293e6b; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--color-text); background: var(--color-bg); line-height: 1.7; font-size: 16px; } .page-wrapper { max-width: 860px; margin: 0 auto; padding: 48px 32px 80px; } /* Title */ h1 { font-size: 1.75rem; font-weight: 700; color: var(--color-heading); line-height: 1.3; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 3px solid var(--color-accent); } /* Section headings */ h2 { font-size: 1.15rem; font-weight: 700; color: var(--color-accent); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 40px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); } /* Sub-section headings */ h3 { font-size: 1.05rem; font-weight: 700; color: var(--color-heading); margin-top: 28px; margin-bottom: 12px; } p { margin-bottom: 14px; color: var(--color-text-secondary); } strong { color: var(--color-text); font-weight: 600; } /* Lists */ ul, ol { margin-bottom: 16px; padding-left: 24px; } li { margin-bottom: 8px; color: var(--color-text-secondary); } li strong { color: var(--color-text); } /* Ordered list styling for steps */ ol li { padding-left: 4px; } ol li::marker { color: var(--color-step-number); font-weight: 700; } /* Inline code */ code { font-family: 'Source Code Pro', monospace; font-size: 0.9em; background: var(--color-code-bg); padding: 2px 7px; border-radius: 4px; border: 1px solid var(--color-border); color: var(--color-heading); } /* Code blocks */ pre { background: var(--color-code-bg); border: 1px solid var(--color-border); border-radius: 6px; padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; line-height: 1.55; } pre code { background: none; border: none; padding: 0; font-size: 0.88em; } /* Error message block */ .error-block { background: var(--color-error-bg); border-left: 4px solid var(--color-error-border); border-radius: 0 6px 6px 0; padding: 16px 20px; margin-bottom: 16px; } .error-block pre { background: none; border: none; padding: 0; margin: 0; } .error-block pre code { font-size: 0.84em; color: #5a2020; white-space: pre-wrap; word-break: break-word; } /* Verification block */ .verification-block { background: var(--color-success-bg); border-left: 4px solid var(--color-success-border); border-radius: 0 6px 6px 0; padding: 20px 24px; margin-top: 20px; margin-bottom: 16px; } .verification-block h3 { margin-top: 0; color: #2d5a2d; } .verification-block ol li { color: var(--color-text-secondary); } /* Links */ a { color: var(--color-accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; } a:hover { border-bottom-color: var(--color-accent); } /* Resources section */ .resources-list { list-style: none; padding-left: 0; } .resources-list li { padding: 8px 0; border-bottom: 1px solid var(--color-accent-light); } .resources-list li:last-child { border-bottom: none; } .resources-list li::before { content: "→"; color: var(--color-accent); margin-right: 10px; font-weight: 600; } /* Print styles */ @media print { .page-wrapper { padding: 20px 0; } h1 { font-size: 1.5rem; } a { color: var(--color-accent); } a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; } } @import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&family=Source+Code+Pro:wght@400;500&display=swap'); :root { --color-bg: #ffffff; --color-text: #1a1a2e; --color-text-secondary: #4a4a68; --color-heading: #0f1b2d; --color-accent: #293e6b; --color-accent-light: #e8ecf4; --color-border: #d1d5e0; --color-code-bg: #f4f5f8; --color-error-bg: #fdf2f2; --color-error-border: #e8b4b4; --color-info-bg: #f0f4fa; --color-info-border: #a8b8d8; --color-success-bg: #f0f7f0; --color-success-border: #a8c8a8; --color-step-number: #293e6b; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--color-text); background: var(--color-bg); line-height: 1.7; font-size: 16px; } .page-wrapper { max-width: 860px; margin: 0 auto; padding: 48px 32px 80px; } /* Title */ h1 { font-size: 1.75rem; font-weight: 700; color: var(--color-heading); line-height: 1.3; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 3px solid var(--color-accent); } /* Section headings */ h2 { font-size: 1.15rem; font-weight: 700; color: var(--color-accent); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 40px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); } /* Sub-section headings */ h3 { font-size: 1.05rem; font-weight: 700; color: var(--color-heading); margin-top: 28px; margin-bottom: 12px; } p { margin-bottom: 14px; color: var(--color-text-secondary); } strong { color: var(--color-text); font-weight: 600; } /* Lists */ ul, ol { margin-bottom: 16px; padding-left: 24px; } li { margin-bottom: 8px; color: var(--color-text-secondary); } li strong { color: var(--color-text); } /* Ordered list styling for steps */ ol li { padding-left: 4px; } ol li::marker { color: var(--color-step-number); font-weight: 700; } /* Inline code */ code { font-family: 'Source Code Pro', monospace; font-size: 0.9em; background: var(--color-code-bg); padding: 2px 7px; border-radius: 4px; border: 1px solid var(--color-border); color: var(--color-heading); } /* Code blocks */ pre { background: var(--color-code-bg); border: 1px solid var(--color-border); border-radius: 6px; padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; line-height: 1.55; } pre code { background: none; border: none; padding: 0; font-size: 0.88em; } /* Error message block */ .error-block { background: var(--color-error-bg); border-left: 4px solid var(--color-error-border); border-radius: 0 6px 6px 0; padding: 16px 20px; margin-bottom: 16px; } .error-block pre { background: none; border: none; padding: 0; margin: 0; } .error-block pre code { font-size: 0.84em; color: #5a2020; white-space: pre-wrap; word-break: break-word; } /* Verification block */ .verification-block { background: var(--color-success-bg); border-left: 4px solid var(--color-success-border); border-radius: 0 6px 6px 0; padding: 20px 24px; margin-top: 20px; margin-bottom: 16px; } .verification-block h3 { margin-top: 0; color: #2d5a2d; } .verification-block ol li { color: var(--color-text-secondary); } /* Links */ a { color: var(--color-accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; } a:hover { border-bottom-color: var(--color-accent); } /* Resources section */ .resources-list { list-style: none; padding-left: 0; } .resources-list li { padding: 8px 0; border-bottom: 1px solid var(--color-accent-light); } .resources-list li:last-child { border-bottom: none; } .resources-list li::before { content: "→"; color: var(--color-accent); margin-right: 10px; font-weight: 600; } /* Print styles */ @media print { .page-wrapper { padding: 20px 0; } h1 { font-size: 1.5rem; } a { color: var(--color-accent); } a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; } } Issue An error is thrown when attempting to attach a file in Service Portal referencing the business rule "Validate M365 attachments" and the Script Include "SampO365Admin". Symptoms Attaching a file in Service Portal triggers an error in the system logs.The following error message appears: Condition 'Condition: SampO365Admin.getProfileTypeFromAttachment(current.table_sys_id) === 'microsoft_office_365' && gs.nil(SampO365Admin.parseCSVFileDateTime(current.file_name)); Filter Condition: table_name=samp_sw_subscription_profile^file_nameSTARTSWITHVisio^ORfile_nameSTARTSWITHCopilot ^ORfile_nameSTARTSWITHProject^EQ' in business rule 'Validate M365 attachments' on sys_attachment: sc_cat_item (sys_idSTARTSWITHebe9027fc3ffae5487f63fbf05013192).xml evaluated to null; skipping business rule The business rule "Validate M365 attachments" is skipped due to the condition evaluating to null. Facts The business rule Validate M365 attachments and the Script Include SampO365Admin are part of the SaaS License Management Microsoft Extension [com.sn_sam_saas_int.samp.microsoft] plugin.Upgrading the SaaS License Management [sn_sam_saas_int] plugin also upgrades all associated software publisher integration extension plugins, including the Microsoft Extension.The Script Include SampO365Admin is an out-of-the-box component delivered with the plugin. Cause The getProfileTypeFromAttachment function is missing from the Script Include SampO365Admin. This function is called in the advanced condition of the business rule Validate M365 attachments, and because it does not exist, the condition evaluates to null and the business rule is skipped. This most likely occurred because the Script Include SampO365Admin was not updated to its latest version from the com.sn_sam_saas_int.samp.microsoft plugin when the SaaS License Management plugin was last upgraded. Solution Repair or upgrade the SaaS License Management [sn_sam_saas_int] plugin to restore the missing function in the Script Include. Option A: Repair the Plugin Navigate to Application Manager on your instance.Search for SaaS License Management [sn_sam_saas_int].Select Repair on the currently installed version.Wait for the repair process to complete. This reinstalls all associated plugins, including the Microsoft Extension, and updates the SampO365Admin Script Include to the correct version. Option B: Upgrade the Plugin If your instance is not running the latest version of SaaS License Management, upgrade instead of repairing: Navigate to Application Manager on your instance.Search for SaaS License Management [sn_sam_saas_int].Select Update to install the latest available version.Wait for the upgrade process to complete. This reinstalls all associated plugins, updates the SampO365Admin Script Include, and provides the additional benefit of upgrading to the latest release. Verification After the repair or upgrade completes, verify that the missing function has been restored: Navigate to System Definition > Script Includes.Search for SampO365Admin.Open the Script Include and confirm that the getProfileTypeFromAttachment function is present in the code. The function should appear as follows: SampO365Admin.getProfileTypeFromAttachment = function(recordID) { var gr = new GlideRecord('samp_sw_subscription_profile'); if (gr.get(recordID)) { return gr.getValue('profile_type'); } return null; }; Attach a file in Service Portal and confirm that the error no longer appears in the system logs. Additional Resources ServiceNow Documentation: SaaS License ManagementServiceNow Documentation: Repairing ApplicationsServiceNow CommunityServiceNow Support