Change Bulk upload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
This is regarding the Change Request bulk upload.
Requirement regarding the change bulk upload, including the expected format, mandatory fields, validations, and any prerequisites.
- We need to create one front end form (Catalog item or Record producer) for change bulk upload and make Attachment mandatory with some variables like requested for and Is it Bulk upload (only choice is yes) and all other variables which are required- can be done
- We need to create Excel template such that the fields which are present in the change which are mandatory while creating the change should be present in the excel template.
- Once user uploads the Excel template and submits the form according to the data provided by the users in the Excel change request should be created in bulk.
- Whenever user uploads the Excel, we need to verify all mandatory fields which are present in the change are filled by users or no in Excel template shared.
- If all the data provided by the users are correct, then change requests needs to be created.
- If at all in Excel template for some of the fields which are present in change and data provided by users is not proper or not filled in template, we need to send one email to requestor telling them that the details filled in the excel or not correct or some fields are empty.
Please suggest me know to proceed on bulk upload and creation of change request and how to validate mandatory fields which are present in the change are added in Excel template.
Thanks,
Pujitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey @pujitha K
We recently had a requirement to allow users to upload multiple Change Requests using an Excel file. Below is the approach we followed, including form design, template structure, validation logic, and bulk creation process.
Front-End Form (Catalog Item)
We created a Catalog Item called:
Change Bulk Upload
Variables used:
Requested For (Reference to sys_user) – Mandatory
Is it Bulk Upload (Single choice: Yes) – Default = Yes, Mandatory
Attachment – Mandatory
To make attachment mandatory:
In Catalog Item - enable “Mandatory Attachment”.
This ensures users cannot submit the request without uploading the Excel template.
Excel Template Design
The Excel template contains only mandatory fields required for creating a Change.
We checked mandatory fields from:
System Definition - Tables - change_request - Dictionary entries (Mandatory = true)
Sample columns in Excel:
Short Description
Description
Category
Risk
Assignment Group
Planned Start Date
Planned End Date
Change Type
Important:
Column names must exactly match what is expected in the script.
Processing Logic Overview
Flow:
Catalog Item Submission
- Trigger Flow Designer
- Read Attachment
- Parse Excel
- Validate Data
- If valid - Create Change records
- If invalid - Send Email to requestor
Script Include to Process Excel
Create a Script Include:
Name: ChangeBulkProcessor
Client Callable: False
Code:
var ChangeBulkProcessor = Class.create();
ChangeBulkProcessor.prototype = {
initialize: function() {},
processAttachment: function(attachmentSysId, requestor) {
var parser = new GlideExcelParser();
parser.parse(attachmentSysId);
var errorRows = [];
var successCount = 0;
while (parser.next()) {
var shortDesc = parser.getValue('Short Description');
var desc = parser.getValue('Description');
var category = parser.getValue('Category');
var risk = parser.getValue('Risk');
var assignmentGroup = parser.getValue('Assignment Group');
var startDate = parser.getValue('Planned Start Date');
var endDate = parser.getValue('Planned End Date');
var type = parser.getValue('Change Type');
// Mandatory validation
if (!shortDesc || !desc || !category || !risk ||
!assignmentGroup || !startDate || !endDate || !type) {
errorRows.push(parser.getRowNumber());
continue;
}
// Validate Assignment Group
var grp = new GlideRecord('sys_user_group');
if (!grp.get('name', assignmentGroup)) {
errorRows.push(parser.getRowNumber());
continue;
}
// Validate date logic
if (new GlideDateTime(endDate) < new GlideDateTime(startDate)) {
errorRows.push(parser.getRowNumber());
continue;
}
// Create Change
var chg = new GlideRecord('change_request');
chg.initialize();
chg.short_description = shortDesc;
chg.description = desc;
chg.category = category;
chg.risk = risk;
chg.assignment_group = grp.sys_id;
chg.start_date = startDate;
chg.end_date = endDate;
chg.type = type;
chg.insert();
successCount++;
}
return {
success: successCount,
errors: errorRows
};
},
type: 'ChangeBulkProcessor'
};
Flow Designer - Script Action
In Flow Designer:
Trigger:
When Catalog Item is Requested
Steps:
Get Attachment sys_id
Add Script Action
Call Script Include
Script inside Flow:
var requestedFor = fd_data.trigger.request_item.requested_for;
var attachmentSysId = fd_data.flow_var.attachment_sys_id;
var processor = new ChangeBulkProcessor();
var result = processor.processAttachment(attachmentSysId, requestedFor);
outputs.hasErrors = result.errors.length > 0;
outputs.errorRows = result.errors.join(', ');
outputs.successCount = result.success;
return outputs;Add a Flow condition:
If hasErrors = true
- Send failure email
Else
- Send success email
Dynamic Mandatory Field Validation (Optional Enhancement)
Instead of hardcoding mandatory fields, you can dynamically fetch them:
var mandatoryFields = [];
var dict = new GlideRecord('sys_dictionary');
dict.addQuery('name', 'change_request');
dict.addQuery('mandatory', true);
dict.query();
while (dict.next()) {
mandatoryFields.push(dict.element.toString());
}
You can then validate Excel values against this list to make the solution future-proof.
Email Notification
Create an Event:
Name: change.bulk.error.check
From Script Include or Flow:
gs.eventQueue('change.bulk.error.check', current, requestor, errorRows.join(','));
Next create notification
Recommended Additional Validations
It is highly recommended to validate:
Choice values (Category, Risk, Type)
Assignment Group existence
Date format
Planned End Date greater
Planned Start Date
This prevents incorrect data from being inserted.
*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hey @pujitha K
Hope you are doing well.
Did my previous reply answer your question?
If it was helpful, please mark it as correct ✓ and close the thread 🔒. This will help other readers find the solution more easily.
Regards,
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi @vaishali231 ,
Thanks for providing quick response, apologies I couldn't reply back on time.
I'm facing challenge in reading the attachment and calling the script Include and parsing the excel and providing the Action outputs could you please help me with the screen shots on how you have defined the flow designer and parsing the excel and screen shot of Action.
I tried below things but unable to do it as I'm new to flow designer concepts struggling a bit on this.
Flow Designer:
Here I'm calling Name is 'Change Bulk Upload'.
In step 2 Get Attachments I'm calling Request Item sys id.
In Parse Excel I have placed below script
Script In Parse Excel:
I tried creating the Action but unable to add the Ouput as it's taking as Array.Boolean when we try to give Boolean type
In Script i have added the below code :
but facing issues to create the Outputs.
Can you please help me with the above
Thank you.

