help needed having issues in creating interactions in the walkup location queue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 11:10 PM - edited 12-16-2023 05:44 PM
hi would need some help as i am having issue in getting the interactions created after scanning the serial number of the laptop using the service portal widget. i understand i need to use the facade function not sure is that true as i have tried to use the table method to create but it is not displaying in the correct walkuplocation queue
(function ($sp, options, input, data) {
if (barCodeScanned(input)) {
var interactionSysId = lookUpAssetAndCreateInteraction(input.barCode);
if (interactionSysId) {
// Interaction successfully created, optionally perform additional actions
data.interactionSysId = interactionSysId;
} else {
// Handle the case where interaction creation failed
data.error = gs.getMessage('Failed to create a walk-up interaction.');
}
} else {
// Handle the case where the barcode is not scanned
data.error = gs.getMessage('Barcode not scanned.');
}
function barCodeScanned(input) {
return input && input.barCode;
}
function lookUpAssetAndCreateInteraction(barCode) {
var alm_hardware = new GlideRecord('alm_hardware');
if (alm_hardware.get('serial_number', barCode)) {
if (facade) {
var newInteraction = facade.createInteraction();
newInteraction.short_description = "Walk-up Interaction";
newInteraction.description = "Laptop refresh";
newInteraction.u_walkup_location = "Singapore"; // Update with the correct walk-up location
var interactionSysId = facade.saveInteraction(newInteraction);
if (interactionSysId) {
// Interaction successfully saved, optionally perform additional actions
facade.openInteraction(interactionSysId);
return interactionSysId;
} else {
// Handle the case where interaction save failed
gs.error("Error: Failed to save the walk-up interaction.");
return null;
}
} else {
// Handle the case where the facade is not initialized
gs.error("Error: Walk-up Interaction Facade not initialized.");
return null;
}
} else {
// Handle the case where the hardware record was not found
gs.error("Error: Hardware record not found for serial number: " + barCode);
data.error = gs.getMessage('Hardware record not found for serial number: {0}', barCode);
return null;
}
}
})($sp, options, input, data);
- Labels:
-
Walk-Up Experience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 08:47 PM
help needed please