Getting below highlighted errors on Portal,please provide valuable suggestion to resolve the issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 04:58 AM
Hi All,
I got a bug where on portal the below error message is displayed on portal when we open the portal, please suggest how to resolve this issue.
As I'm new to portal development please help me with the approach.
Server Script written on Widget:
(function () {
data.ACTION_TODO_COUNT = 'update_todo_count';
data.ACTION_LOAD_CASES = 'load_cases';
data.isMobile = gs.isMobile();
data.isVAActive = new GlidePluginManager().isActive("com.glide.cs.chatbot");
data.chatSupportEnabled = new sn_hr_sp.hr_PortalUtil().isChatSupportEnabled();
//Load To-dos count
if (!input || input.action == data.ACTION_TODO_COUNT) {
var myTodosCountObject= new sn_hr_sp.todoPageUtils().getMyTodosCount();
data.todoCount = myTodosCountObject.todoCount;
data.todoCountLabel = gs.getMessage("{0} to-dos remaining");
data.recordWatchers = myTodosCountObject.recordWatchers;
// avoid consecutive calls
if(input)
return ;
}
data.isHrCoreActive = GlidePluginManager().isActive("com.sn_hr_core");
if (data.isHrCoreActive && gs.getProperty('sn_hr_core.esc.create_hrprofile.override', 'true') === "true") {
// HR Profile
var hrProfileGr = new GlideRecord('sn_hr_core_profile');
hrProfileGr.addQuery('user', gs.getUserID());
hrProfileGr.setLimit(1);
hrProfileGr.query();
if (!hrProfileGr.hasNext() && gs.getUserID() && new GlideRecord('sys_user').get(gs.getUserID())) {
hrProfileGr.setValue('user', gs.getUserID());
hrProfileGr.insert();
}
}
// populate the 'data' object
data.link = '?id=hri_user_profile&sys_id='+ gs.getUserID();
// Defines the support queue ID that will be linked to by the Live Chat link in header
data.login_page = $sp.getValue('login_page');
var menu = $sp.getValue("sp_rectangle_menu");
//Initialize menu objects
data.sub = {};
data.top = {};
data.sub.menu = $sp.getWidgetFromInstance(menu);
//Copy sub menu to top menu, we want cart up top and menu items in the sub nav
data.top.menu = JSON.parse(JSON.stringify(data.sub.menu));
if (data.sub.menu && data.sub.menu.data) {
data.sub.menu.data.replace = true;
// Hide login if menu already has link to login
data.hasLogin = false;
if (data.sub.menu.data.menu.items) {
for(var i in data.sub.menu.data.menu.items) {
var item = data.sub.menu.data.menu.items[i];
if (item.type == 'page' && item.sp_page == data.login_page)
data.hasLogin = true;
}
}
}
var configOptions = JSON.parse(data.top.menu.options.widget_parameters);
data.hideSearchOnHomepage = configOptions.exclude_search_on_homepage.value;
if (data.hideSearchOnHomepage) {
data.homepage = $sp.getValue('homepage');
var gr = new GlideRecord('sp_page');
gr.get(data.homepage);
data.dashboardSuffix = gr.getValue("id");
data.portalSuffix = $sp.getPortalRecord().getDisplayValue("url_suffix");
}
// Analytics
data.analyticsSupportEnabled = new GlidePluginManager().isActive('com.sn_content_analytics') && new GlidePluginManager().isActive('com.sn_content_delivery') && !sn_cd.cd_ContentDelivery.isContentPreview($sp);
//Clean up items that don't belong
data.sub.menu.data.cartWidget = {};
data.sub.menu.options.enable_cart = false;
data.sub.menu.data.showTours = false;
data.top.menu.data.menu.items = [];
data.loginWidget = $sp.getWidgetFromInstance('login-modal');
var typeAheadOptions = {};
typeAheadOptions.refresh_page_on_search_submission = false;
typeAheadOptions.title = gs.getMessage("Search the portal");
if($sp.isAISearchEnabled())
typeAheadOptions.disable_all_suggestions = ($sp.getParameter('disableAllSuggestions') == 'true');
data.typeahead = $sp.getWidget('typeahead-search', typeAheadOptions);
data.avatarDropDown = $sp.getWidget('profile-with-drop-down',{"profile_url": data.link, "show_xs_avatar": false});
})();
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 05:37 AM
Hello,
i think the error is in this line
var configOptions = JSON.parse(data.top.menu.options.widget_parameters);
data.hideSearchOnHomepage = configOptions.exclude_search_on_homepage.value;
can you put one gs.info('My JSON printed'+configOptions); below this line and let me know what is the log getting printed
var configOptions = JSON.parse(data.top.menu.options.widget_parameters);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 05:55 AM
As this Widget is OOB the below message is getting displayed when i tried to edit the widget.
This widget is read only and cannot be edited except for the Public checkbox. You can clone this widget by clicking the button in the top right corner of the editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 06:43 AM
Hello Ram,
I think you are using OOB widget called "ESC Header"
Please follow below steps for solving the issue
The error that you are getting because they are trying to access widget parameters called
"exclude_search_on_homepage" which might not have been declared in your widget parameters .
Please follow below steps to correct it
1) Navigate to portals
2) Open Employee center record and open record tagged in Main menu
3) After opening check the JSON's in Additional options
Please check whether the Aboev highlighted JSON is declared or not .
If not please add below lines to the existing JSON in your main menu record just like above
"exclude_search_on_homepage":{
"displayValue":"true",
"value":true
},
Please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 07:20 AM
Hello Mohith,
Thanks you so much for taking time to reply.
I don't see Employee center record under Portals and there is Employee Service Centre and i tried to update(PFA Screen shots) that but it's still the same.
Please help me if anything needs to be checked further.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 07:28 AM
Hello,
Can you write your Additional options like below
{
"enable_cart":{
"displayValue":"false",
"value":false
},
"auto_update_cart":{
"displayValue":"true",
"value":true
},
"exclude_search_on_homepage":{
"displayValue":"true",
"value":true
}
}
Please mark my answer correct if it works