- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 03:28 AM
Hi Experts,
I have cloned OOTB widget : Knowledge Bases Browse
im getting error : ErrorServer JavaScript error Method "toString" called on incompatible object.
in line number 2 of below script, Please suggest,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 08:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 03:38 AM
Hi @raja_5 ,
The incompatible object error happens when you try to work with Java objects that do not have toString functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 03:50 AM
Hi @Community Alums ,
Could you please suggest what changes needs to be done in the above ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 04:32 AM
the function getServicePortalKnowledgeBases returns an array
so you can check if array is empty or has zero length
var kbService = new global.CopyKBPortalService();
options.knowledge_bases = options.knowledge_bases || kbService.getServicePortalKnowledgeBases($sp.getPortalRecord().url_suffix).length == 0 || "";
data.isMobile = kbService.isMobile();
data.result = kbService.getMyKnowledgeBases(options.order_by,options.knowledge_bases);
var kbCount = data.result.length;
var articleCount = 0;
var socailqaCount = 0;
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 06:06 AM