{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":33852,"path":"it-service-management/service-operations-workspace/modify-greeting-text.md","title":"Configure the header message on the landing page","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure the header message on the landing page\n\nConfigure the header message that is part of the greeting text on the landing page. For example, You are on-call until Monday, Mar 21.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nThe Get service desk agent shift data broker server script calls the `SOWServiceDeskAgentShift` script includes to display the shift information in the greeting text.\n\nWhile the display text can be customized for the default landing page, the visual styling changes to the text can be done only by creating a copy of the landing page.\n\n\\[Omitted image \"greeting-text.png\"\\] Alt text: Greetings text\n\n**Note:**\n\nThe alert notification on the banner in SOW automatically expands to display the full message. This feature is enabled by default in the base system. You can update the **auto\\_expand\\_now\\_alert\\_message** system UX page property to false if you don't want to automatically expand and display the entire message.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Service Operations Workspace Admin Center** &gt; **Overview**.\n\n2.  On the **Overview** tab, from the **Initial Setup** section, select the **Configure the landing page** option.\n\n3.  On the Landing Page form, select **Configure** next to **Greetings**.\n\n    The Script Includes form is displayed for SOWServiceDeskAgentShift, which internally calls the SOWServiceDeskAgentShiftSNC\n\n4.  Copy the **Script** value of SOWServiceDeskAgentShiftSNC.\n\n    1.  Navigate to **All** &gt; **System Definition** &gt; **Script Includes**.\n\n    2.  From the list of Script Includes, open SOWServiceDeskAgentShiftSNC.\n\n    3.  Copy the **Script** field value.\n\n5.  Edit the SOWServiceDeskAgentShift script.\n\n    1.  Navigate to **All** &gt; **System Definition** &gt; **Script Includes**.\n\n    2.  From the list of Script Includes, open SOWServiceDeskAgentShift.\n\n    3.  Paste the **Script** field value that you copied from SOWServiceDeskAgentShiftSNC.\n\n        ```\n        initialize: function() { \n        \n                this.PLUGINS = { \n        \n                    ON_CALL: \"com.snc.on_call_rotation\", \n        \n                    SHIFT_PLANNING: \"com.sn_shift_planning\" \n        \n                }; \n        \n                this.DAYS_AHEAD = gs.getProperty('com.snc.on_call_rotation.upcoming_rota_days', 30); \n        \n                this.DATE_FORMAT = gs.getDateFormat(); \n        \n                this.TIME_FORMAT = gs.getTimeFormat(); \n        \n                this.WFO_SCHEMA_IDENTIFIER = 'readInTimezone'; \n        \n                this.WFO_ONCALL_TYPE_IDENTIFIER = 'oncallAPIReadInTimezone'; \n        \n                this.WEEK_DAY_FORMAT = 'EEEE'; \n        \n                this.FORMAT = { \n        \n                    SERVICE_DESK_HEADER: 'SERVICE_DESK_HEADER' \n        \n                }; \n        \n                this.DATE_TIME_FORMAT_FULL = \"full\"; \n        \n            }, \n        \n         \n        \n            getUpcomingShift: function(userId, outputFormat, wfoShift) { \n        \n                var upcomingShifts, gd = new GlideDate(); \n        \n                var from = gd.getDisplayValueInternal(); \n        \n                gd.addDaysLocalTime(this.DAYS_AHEAD); \n        \n                var to = gd.getDisplayValueInternal(); \n        \n                var mayBeWFOUser = userId == gs.getUserID() ? gs.hasRole(\"sn_shift_planning.agent\") : true; \n        \n                if (GlidePluginManager.isActive(this.PLUGINS.SHIFT_PLANNING) && mayBeWFOUser && wfoShift) \n        \n                    upcomingShifts = this.getWFOShifts(from, to, userId); \n        \n                var isWFOResponseValid = Array.isArray(upcomingShifts) && upcomingShifts.length > 0; \n        \n                if (!isWFOResponseValid && GlidePluginManager.isActive(this.PLUGINS.ON_CALL)) \n        \n                    upcomingShifts = this.getOnCallShifts(from, to, userId); \n        \n                return this.getFormattedShift(upcomingShifts, outputFormat); \n        \n            }, \n        \n         \n        \n            getWFOShifts: function(from, to, userId) { \n        \n                var smUtil = new sn_shift_planning.ScheduleManagerUtil(); \n        \n                var defaultEventCategories = [ \n        \n                    smUtil.WORK_CATEGORY_SYS_ID, \n        \n                    smUtil.ON_CALL_CATEGORY_SYS_ID \n        \n                ]; \n        \n                var params = { \n        \n                    \"assignmentGroups\": \"\", \n        \n                    \"individualAgents\": userId, \n        \n                    \"startDate\": from, \n        \n                    \"endDate\": to, \n        \n                    \"published\": true, \n        \n                    \"eventCategories\": defaultEventCategories, \n        \n                    \"filter\": { \n        \n                        \"sn_shift_planning_agent_schedule\": { \n        \n                            \"event\": [\"8d03fd9b0f310010717cc562ff767e4a\", \"936319993bd02010e81a4ee1f3efc419\"] \n        \n                        } \n        \n                    } \n        \n                }; \n        \n                var upcomingShifts = []; \n        \n                try { \n        \n                    var agentScheduleRESTAPIUtils = new sn_shift_planning.AgentScheduleRESTAPIUtils(); \n        \n                    var spans = agentScheduleRESTAPIUtils.retrieveAgentSchedulesFromParams(params); \n        \n                    if (spans && spans.shiftData && spans.shiftData.user && spans.shiftData.user.data && spans.shiftData.user.data.length > 0 && spans.shiftData.user.data[0].schedules) { \n        \n                        var schedules = spans.shiftData.user.data[0].schedules, \n        \n                            arrayUtil = new global.ArrayUtil(); \n        \n                        for (var schedule in schedules) \n        \n                            upcomingShifts = arrayUtil.union(upcomingShifts, schedules[schedule]); \n        \n                    } \n        \n                } catch (e) { \n        \n                    gs.error(\"SOWServiceDeskAgentShiftSNC: Error fetching WFO shifts\"); \n        \n                } \n        \n         \n        \n                return upcomingShifts; \n        \n            }, \n        \n         \n        \n            getOnCallShifts: function(from, to, userId) { \n        \n                var onCallCommon = new global.OnCallCommon(); \n        \n                var onCallGroups = onCallCommon.getMyGroups(); \n        \n                var spans = new global.OCRotationV2(null, global.OCRotationV2.DEFAULT_FORMAT_OPTION).setStartDate(from).setEndDate(to).setUserIds(userId).setGroupIds(onCallGroups).getSpans(); \n        \n                var upcomingShifts = []; \n        \n                for (var i = 0; i < spans.length; i++) \n        \n                    if ((spans[i].type == \"roster\" || spans[i].type == \"override\") && spans[i].user_id == userId) \n        \n                        upcomingShifts.push(spans[i]); \n        \n                return upcomingShifts; \n        \n            }, \n        \n         \n        \n            getFormattedShift: function(upcomingShifts, outputFormat) { \n        \n                if (gs.nil(upcomingShifts)) \n        \n                    return; \n        \n                switch (outputFormat) { \n        \n                    case this.FORMAT.SERVICE_DESK_HEADER: \n        \n                        return this.getServiceDeskFormattedShift(upcomingShifts); \n        \n                    default: \n        \n                        return upcomingShifts; \n        \n                } \n        \n            }, \n        \n         \n        \n            getServiceDeskFormattedShift: function(upcomingShifts) { \n        \n                var response = { \n        \n                    shiftText: \"\", \n        \n                    nearestShift: {} \n        \n                }; \n        \n                var startAttr = \"start\", \n        \n                    endAttr = \"end\", \n        \n                    isOnCall = true; \n        \n                var dateFormat = 'EEEE, MMM dd', \n        \n                    timeFormat = 'hh:mm a'; \n        \n                var isWFOSchema = Array.isArray(upcomingShifts) && upcomingShifts.length > 0 && this.WFO_SCHEMA_IDENTIFIER in upcomingShifts[0]; \n        \n                if (isWFOSchema) \n        \n                    startAttr = \"scheduledStartTime\", endAttr = \"scheduledEndTime\"; \n        \n                response.nearestShift = this.getNearestShift(upcomingShifts, startAttr, endAttr); \n        \n                if (response.nearestShift) { \n        \n                    if (isWFOSchema) { \n        \n                        if (response.nearestShift.schedule && !(this.WFO_ONCALL_TYPE_IDENTIFIER in response.nearestShift.schedule)) \n        \n                            isOnCall = false; \n        \n                    } \n        \n                    if (isOnCall) { \n        \n                        if (response.nearestShift.isCurrent) { \n        \n                            if (response.nearestShift.roster_name) \n        \n                                response.shiftText = gs.getMessage(\"You are on-call until {0} as {1}\", [this.getFormattedDateTime(response.nearestShift[endAttr]), response.nearestShift.roster_name]); \n        \n                            else \n        \n                                response.shiftText = gs.getMessage(\"You are on-call until {0}\", [this.getFormattedDateTime(response.nearestShift[endAttr])]); \n        \n                        } else { \n        \n                            if (response.nearestShift.roster_name) \n        \n                                response.shiftText = gs.getMessage(\"Your next on-call shift starts on {0} as {1}\", [this.getFormattedDateTime(response.nearestShift[startAttr]), response.nearestShift.roster_name]); \n        \n                            else \n        \n                                response.shiftText = gs.getMessage(\"Your next on-call shift starts on {0}\", [this.getFormattedDateTime(response.nearestShift[startAttr])]); \n        \n                        } \n        \n                    } else { \n        \n                        if (response.nearestShift.isCurrent) { \n        \n                            response.shiftText = gs.getMessage(\"Your shift ends on {0}\", [this.getFormattedDateTime(response.nearestShift[endAttr])]); \n        \n                        } else \n        \n                            response.shiftText = gs.getMessage(\"Your next shift starts on {0}\", [this.getFormattedDateTime(response.nearestShift[startAttr])]); \n        \n                    } \n        \n                } \n        \n         \n        \n                return response; \n        \n            }, \n        \n         \n        \n            getNearestShift: function(upcomingShifts, startAttr, endAttr) { \n        \n                if (gs.nil(upcomingShifts) || gs.nil(startAttr) || gs.nil(endAttr)) \n        \n                    return; \n        \n                var nearestShift; \n        \n                upcomingShifts.sort(function(shift_1, shift_2) { \n        \n                    var gdt1 = new GlideDateTime(); \n        \n                    gdt1.setDisplayValueInternal(shift_1[startAttr]); \n        \n                    var gdt2 = new GlideDateTime(); \n        \n                    gdt2.setDisplayValueInternal(shift_2[startAttr]); \n        \n                    return GlideDateTime.subtract(gdt2, gdt1).getNumericValue(); \n        \n                }); \n        \n                var currentDateTime = new GlideDateTime(), \n        \n                    startDateTime = new GlideDateTime(), \n        \n                    endDateTime = new GlideDateTime(); \n        \n                for (var i = 0; i < upcomingShifts.length; i++) { \n        \n                    startDateTime.setDisplayValueInternal(upcomingShifts[i][startAttr] + \"\"); \n        \n                    endDateTime.setDisplayValueInternal(upcomingShifts[i][endAttr] + \"\"); \n        \n                    if (currentDateTime.onOrBefore(endDateTime)) { \n        \n                        nearestShift = upcomingShifts[i]; \n        \n                        if (currentDateTime.onOrAfter(startDateTime)) \n        \n                            nearestShift.isCurrent = true; \n        \n                        else \n        \n                            nearestShift.isCurrent = false; \n        \n                        break; \n        \n                    } \n        \n                } \n        \n                return nearestShift; \n        \n            }, \n        \n         \n        \n            getFormattedDateSpan: function(date, dateFormat, timeFormat) { \n        \n                var formattedDate = this.getFormattedDate(date, dateFormat); \n        \n                var dateAmPmTime = this.getFormattedTime(date, timeFormat); \n        \n                return formattedDate + \" \" + dateAmPmTime; \n        \n            }, \n        \n         \n        \n            getFormattedDate: function(inputDate, format) { \n        \n                var date = new GlideDateTime(); \n        \n                date.setDisplayValueInternal(inputDate); \n        \n                format = !format ? this.DATE_FORMAT : format; \n        \n                var gd = date.getLocalDate(); \n        \n                return gd.getByFormat(format); \n        \n            }, \n        \n         \n        \n            getFormattedTime: function(inputDate, format) { \n        \n                var date = new GlideDateTime(); \n        \n                date.setDisplayValueInternal(inputDate); \n        \n                format = !format ? this.TIME_FORMAT : format; \n        \n                var gt = date.getLocalTime(); \n        \n                return gt.getByFormat(format); \n        \n            }, \n        \n         \n        \n            getFormattedDateTime: function(date) { \n        \n                var dateTime = new GlideDateTime(); \n        \n                dateTime.setDisplayValueInternal(date); \n        \n                return dateTime.getDisplayValueLang(this.DATE_TIME_FORMAT_FULL); \n        \n            }, \n        \n         \n        \n            endsToday: function(inputDate) { \n        \n                var inputGdt = new GlideDateTime(); \n        \n                inputGdt.setDisplayValueInternal(inputDate); \n        \n                return new GlideDateTime().getLocalDate().getValue() == inputGdt.getLocalDate().getValue(); \n        \n            }, \n        \n         \n        \n            endingTomorrow: function(inputDate) { \n        \n                var inputGdt = new GlideDateTime(); \n        \n                inputGdt.setDisplayValueInternal(inputDate); \n        \n                var tomorrowDateTime = new GlideDateTime(); \n        \n                tomorrowDateTime.addDaysLocalTime(1); \n        \n                return tomorrowDateTime.getLocalDate().getValue() == inputGdt.getLocalDate().getValue(); \n        \n            }, \n        ```\n\n    4.  Edit the following part of the script as mentioned.\n\n        ```\n                    if (isOnCall) { \n        \n                        if (response.nearestShift.isCurrent) { \n        \n                            if (response.nearestShift.roster_name) \n        \n                                response.shiftText = gs.getMessage(\"You are on-call until {0} as {1}\", [this.getFormattedDateTime(response.nearestShift[endAttr]), response.nearestShift.roster_name]); \n        \n                            else \n        \n                                response.shiftText = gs.getMessage(\"You are on-call until {0}\", [this.getFormattedDateTime(response.nearestShift[endAttr])]); \n        \n                        } else { \n        \n                            if (response.nearestShift.roster_name) \n        \n                                response.shiftText = gs.getMessage(\"Your next on-call shift starts on {0} as {1}\", [this.getFormattedDateTime(response.nearestShift[startAttr]), response.nearestShift.roster_name]); \n        \n                            else \n        \n                                response.shiftText = gs.getMessage(\"Your next on-call shift starts on {0}\", [this.getFormattedDateTime(response.nearestShift[startAttr])]); \n        \n                        } \n        \n                    } else { \n        \n                        if (response.nearestShift.isCurrent) { \n        \n                            response.shiftText = gs.getMessage(\"Your shift ends on {0}\", [this.getFormattedDateTime(response.nearestShift[endAttr])]); \n        \n                        } else \n        \n                            response.shiftText = gs.getMessage(\"Your next shift starts on {0}\", [this.getFormattedDateTime(response.nearestShift[startAttr])]); \n        \n                    } \n        ```\n\n6.  Select **Update**.\n\n\n**Parent Topic:**[Landing page configurations in Service Operations Workspace for ITSM](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-service-management/service-operations-workspace/landing-page-configurations-sow-itsm.md)\n\n"}}