- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:04 AM
Hello,
Following this article - https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/build/service-portal/task/search-s... I have created the below Search Source to lookup Knowledge Articles in another instance of ServiceNow we use.
Below is the content in the article that I have pasted into the 'data fetch script field', the highlighted I will change the name of the instance I would like to refer to.
Do I need to add anything else to the data fetch script? I have been given a username and password service account to access but I am unsure where this goes.
This is what I have in the 'facet generation script' field:
Thank you for any assistance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 12:06 AM
does your user have sufficient roles to read those article in the question now. So can you confirm what all your user has (in external system)?
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:36 AM
as per same documentation , your data fetch script is missing following after execute() and before returning results
if (jsonOutput) {
var response = new JSON().decode(jsonOutput.getBody());
results = response.result;
results.forEach(function(result) {
result.url = "https://myInstance.service-now.com/kb_view.do?sysparm_article=" + result.number;
result.target = "_blank";
result.primary = result.short_description;
});
}
if (jsonOutput.haveError()){
gs.addErrorMessage(jsonOutput.getErrorMessage());
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:55 AM
Thanks @sushantmalsure I have added it as explained and get the below error:
Do you also know where I need to add the username and password for authentication?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 08:09 AM - edited 04-19-2023 08:11 AM
well that's not error it must be warning. If you hover on that icon you will get it.
user name and password you are using it here :
ws.setBasicAuth("search_user", "search");
user name: search_user and password 'search'. You may want to update it as per your user who has access to other servicenow instance
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 08:20 AM
This is the warning:
Okay, so I will put the username where the "search_user" is and the password where the "search" is and as long as they are in the sys_user table on the instance I am searching it will authenticate?