Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 06:32 AM
This is the script include:
var AvMeetingPopulateLocation = Class.create();
AvMeetingPopulateLocation.prototype = {
initialize: function() {
/*This script contains hardcoded sys_ids. The only alternative
was to store each countries cmn_locations in sys_properties but
this would make it complex to update in case new locations were
required
To add new locations, add the location sys_id to this.offices with
a descriptive key and then call it from this.countryLocation in
the relevant country object. Key cannot begin with a number and
should not contain spaces,
Labels are initially invalid and then replaced by loop below for display
If location record isn't found "invalid" will show in select box*/
this.offices = {
TowerDubai: { label: "invalid", id: "99fb64a5db807740adf3e2e15b961980" },
GrosvenorHouse: { label: "invalid", id: "004eb4cd1bcf3b0007bf21ff6e4bcb51" },
CanadaSquare: { label: "invalid", id: "96783ab4db40d4d445cdd06b68961958"},
CentenarySquare: { label: "invalid", id: "80fba0a5db807740adf3e2e15b9619ea" },
CorkStreet: { label: "invalid", id: "cdfb64a5db807740adf3e2e15b961942" },
QueensRoadHK: { label: "invalid", id: "58fbe0a5db807740adf3e2e15b96196b" },
TseungKwanOHK: { label: "invalid", id: "c451ea68db0814d4662ed8e74b961969" },
HudsonNYC: { label: "invalid", id: "b748ac681bd56950b88ca609b04bcb59" },
LarkinBuffalo: { label: "invalid", id: "f748ac681bd56950b88ca609b04bcb5a" },
};
// loop through this.offices getting correct labels
for (var key in this.offices) {
var grLOCN = new GlideRecord('cmn_location');
if (grLOCN.get(this.offices[key].id)) {
this.offices[key].label = grLOCN.getDisplayValue('name');
}
}
this.countryLocation = {
'uae': [
this.offices.TowerDubai
],
'unitedkingdom': [
this.offices.GrosvenorHouse,
this.offices.CanadaSquare,
this.offices.CentenarySquare,
this.offices.CorkStreet
],
'hongkong': [
this.offices.QueensRoadHK,
this.offices.TseungKwanOHK
],
'usa': [
this.offices.HudsonNYC,
this.offices.LarkinBuffalo
]
};
},
populateLocation: function(location) {
/*pass in the location value and use it to access the relevant
country object and return the sys_ids*/
var responseObj = JSON.stringify(this.countryLocation[location]);
return responseObj
},
type: 'AvMeetingPopulateLocation'
};