- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi Community,
We have new integration requirement, need to fetch the ADO PBI data to ServiceNow
created script include and Ui page, but script include code not executing. so any suggestion?
UI Page code
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I used your suggestion and looks like it does need to be adjusted in ShrinivasprN code. I tweaked my UI Page and script include to try and replicate what was provided and was able to get:
Adjusted UI Page:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @k_lutz ,
By clicking on test it is working and i did one mistake, i didn't mention proper method name in the script so that issue resolved but i am not getting proper values in the table.
when i print the value one by one, values are showing in the pop up.
code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Can you try to adjust the script include to the following:
var ADOIncidentFetcher = Class.create();
ADOIncidentFetcher.prototype = Object.extendsObject(AbstractAjaxProcessor, {
fetchPBI: function() {
var pbiId = this.getParameter('sysparm_pbi_id');
if (!pbiId) return JSON.stringify({ error: 'No PBI ID provided' });
var rest = new sn_ws.RESTMessageV2('ADO_Get_PBI', 'Default GET');
rest.setStringParameterNoEscape('pbi_id', pbiId);
try {
var response = rest.execute();
var body = response.getBody();
var result = JSON.parse(body);
// ADO work item structure: result.id and result.fields["System.Title"], etc.
var fields = result.fields || {};
return JSON.stringify({
id: result.id, // ✅ corrected
title: fields["System.Title"] || "",
state: fields["System.State"] || "",
workItemType: fields["System.WorkItemType"] || ""
});
} catch (ex) {
return JSON.stringify({ error: ex.message });
}
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
i tried above code, still not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Since I do not have the REST code, would you be able to paste in a sample of what the response data looks like? You can modify it so that's its not your real data but want to see what the structure of the data looks like coming back in the REST response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago