- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
File-based integrations are not going away anytime soon.
Even in organizations investing heavily in APIs, event-driven architectures, and cloud platforms, many important business processes still begin with a file. Financial systems produce spreadsheets or extracts on a schedule. Reporting applications place files in shared directories. Batch processes generate reconciliation data overnight. Business teams often depend on these files as part of established operational processes.
The modernization question therefore does not always need to be, “How do we eliminate the file?” Sometimes the better question is: How do we modernize the transport, validation, processing, and operational controls around the file?
I recently worked through this pattern for a financial process where balance information was generated externally and needed to be processed in ServiceNow. Rather than having ServiceNow continually poll a network location, we used an existing enterprise scheduler to detect the file and push it securely to ServiceNow.
File produced → Zena detects file → PowerShell submits file → ServiceNow validates and accepts it → an event queues processing → Import Set and Transform Map apply the business logic |
Start with Push Versus Pull
One of the first architectural decisions is determining which system should initiate the integration.
A common approach is to have ServiceNow periodically check a directory for new files. That can work, but it means ServiceNow needs connectivity to the source location, credentials to access it, scheduling logic to poll it, and logic for determining which files have already been processed.
In this implementation, we chose the opposite model. The existing enterprise automation tool, Zena was already configured to monitor network folders and files. Zena therefore remained responsible for monitoring the source directory and detecting new files. Once a file was available, it invoked a PowerShell script that transmitted the file to ServiceNow.
That distinction establishes clearer responsibilities:
- Zena monitors the file location and initiates processing.
- PowerShell handles secure transmission and reports the immediate response.
- ServiceNow becomes responsible once the file reaches the platform.
- Import Sets and Transform Maps turn inbound data into target ServiceNow records.
Secure the Transport
The PowerShell portion of the integration is intentionally straightforward.
The script receives the path of the workbook from Zena, verifies that the file exists and has the expected .xlsx extension, requests an OAuth token from ServiceNow, and then posts the file to a Scripted REST API endpoint.
Authentication uses the OAuth 2.0 client credentials flow. The client ID and secret should be supplied through protected Zena variables rather than embedded directly in the production script.
The upload itself is an HTTPS POST of the workbook:
$Headers = @{
'Authorization' = "Bearer $AccessToken"
'Accept' = 'application/json'
}
$Response = Invoke-WebRequest `
-Uri $UploadUrl `
-Method POST `
-Headers $Headers `
-ContentType $XlsxContentType `
-InFile $File.FullName
PowerShell is acting as a transport adapter, not as the business processing engine. |
Keeping it that way makes the integration considerably easier to operate.
ServiceNow Validation at the API Level
Getting an HTTP request into ServiceNow is only the first step.
A file can be technically valid enough to transmit while still being unusable by ServiceNow. The wrong worksheet might have been generated. A column may have been renamed. A user might have supplied a different spreadsheet entirely.
For that reason, the REST endpoint performs structural validation before accepting the file for downstream processing. It first requires a filename and validates that it actually ends in .xlsx. It then saves the request body as an attachment on the configured ServiceNow Data Source.
A reusable Script Include validates the workbook using GlideExcelParser. It checks:
- Expected file extension
- Required worksheet
- Configured header row
- Expected column headers
- Missing and unexpected headers
- Whether the XLSX content can actually be parsed
The configuration is externalized through application properties, including the expected extension, worksheet name, header row, headers, and Data Source. That matters because file specifications change. A column name or worksheet convention should not necessarily require rewriting an integration.
Reject Bad Files Early
A useful integration contract should tell the calling system why something failed.
If the workbook structure is wrong, the ServiceNow endpoint removes the invalid attachment and returns HTTP 422 together with details about the validation problem, including missing headers, unexpected headers, actual headers, and available worksheets.
The PowerShell client distinguishes validation failures, unsupported file types, authentication errors, authorization errors, and unexpected failures.
That produces a much better operational experience than “Upload failed.” Instead, an operator can receive something actionable such as “Required worksheet was not found” or “Expected header Currency B was missing.”
This is particularly important with unattended integrations. An error message should help the person monitoring the process decide whether the problem belongs to the scheduler, network and security team, ServiceNow team, or the upstream team that generated the file.
Acceptance Is Not the Same as Processing
One of the most important lessons from this client implementation was distinguishing between successfully receiving a file and successfully processing its business data. Those are not the same event.
Once the inbound REST endpoint has validated the workbook, it attaches the file to the configured Data Source and queues a ServiceNow event. It then returns HTTP 202 Accepted, explicitly stating that the file passed validation and has been queued for import processing.
HTTP POST
↓
File received
↓
File structurally validated
↓
202 Accepted
↓
Event queued
↓
Import Set processing
↓
Transform Map
↓
Target records
An HTTP 202 does not mean that every row was successfully processed. It means ServiceNow has accepted responsibility for the next stage of processing. The Script Action subscribed to the event calls the import helper to load and transform the uploaded data, and separately logs whether processing succeeded or failed. This keeps the REST transaction relatively short while allowing longer-running import activity to execute asynchronously.
Stage Before You Transform
For file-based integrations, I generally prefer a staging layer instead of having an inbound API immediately manipulate production business records.
ServiceNow Import Sets are well suited to that pattern:
Inbound file → Data Source → Import Set → Transform Map → Target records |
This separates ingestion from business processing, preserves raw incoming values for evaluation, and provides a natural place for coalescing, normalization, reference resolution, validation, and application-specific transformation.
That distinction is especially useful for issues such as data validation. A spreadsheet may have the correct worksheet and columns and therefore be a valid file, while still containing an illegal value target application does not recognize (such as a string instead of an expected integer value).
Layer 1: Structural validation
- Correct extension?
- Correct worksheet?
- Correct columns?
- Readable XLSX workbook?
Layer 2: Business validation
- Value populated in required columns?
- Valid data types provided in the columns?
- Column values match expected values (choice lists, reference tables, etc.)?
- Is the incoming record a duplicate?
Keeping those layers separate produces much clearer integration behavior.
Operationalize the Process
One of my biggest takeaways from integration work is that operational design cannot be added at the end.
Someone eventually has to answer: “Did last night’s file process?”
The answer should not require one person to inspect Zena, another to read PowerShell output, and a ServiceNow developer to search system logs and Import Sets. The architecture should provide a trace from source file to transmission, API acceptance, attachment, Import Set, transformation, and final business outcome.
The PowerShell implementation helps at the first boundary by outputting HTTP status, ServiceNow response details, attachment identifier, Data Source identifier, and validation information. ServiceNow then owns the remaining processing lifecycle.
I personally like creating an integration processing record that becomes the operational system of record for that transaction rather than relying primarily on logs.
Status | Meaning |
Received | ServiceNow received the file |
Validated | Structural validation passed |
Queued | Asynchronous processing requested |
Processing | Import and transformation underway |
Completed | Business processing succeeded |
Completed with Errors | Some records failed validation |
Failed | Processing could not complete |
A Few Practical Considerations
Do not put business transformation logic in the transport script. PowerShell should deliver the file and interpret the response. Let ServiceNow own the transformation and application processing.
Validate before queuing work. Reject unusable files before creating unnecessary Import Sets or downstream transactions.
Use HTTP status codes intentionally. A 202 should mean accepted for asynchronous processing, not “everything worked.”
Make configuration external. Worksheet names, expected headers, Data Sources, and similar settings should be properties rather than scattered constants.
Plan for duplicate delivery. Schedulers retry and networks fail. Design idempotency before production.
Separate technical success from business success. A successful HTTPS request proves connectivity. It does not prove that the business transaction completed.
Final Thoughts
In this implementation, Zena performs the job it is already good at: monitoring enterprise file activity. PowerShell provides a lightweight bridge into a secure REST interface. ServiceNow validates and stages the inbound file, queues the longer-running work, and uses its Import Set framework to perform the actual application processing.
That separation gives each component a clear responsibility. More importantly, it introduces the characteristics a production integration actually needs: secure authentication, validation, asynchronous processing, recoverability, traceability, and meaningful error handling.
The goal is not merely to get a spreadsheet into ServiceNow. It is to be able to confidently answer four questions:
- Did we receive the right file?
- Was the file structurally valid?
- Did we successfully process its data?
- If something failed, can the support team determine exactly where and safely recover?
I hope this is helpful and I welcome your thoughts and experiences on supporting file based integrations with ServiceNow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.