I'm building a javascript query that calls a Microsoft Graph API for data related to a user.
The query is generic and I pass the userID into the additionalScope to make it specific to a user.
Unfortunately the resulting dataset from the API does not include the original userID, it only has the results so I don't know how to map the results to the specific userID for those results.
My code looks something like this:
users = ["1", "2"]; // Array of userIDs
let i=0; // in the future I would iterate overall user IDs, but I'm just doing one for simplicity
const myUserStatusPromise = new Promise(function(resolve, reject) {
getStatus.trigger(
{
additionalScope: {userID; users[i]},
onSuccess: {(data) => console.log(additionalScope.userID); resolve(data);}
}
);
});
myUserStatusPromise.then((data) => {
console.log(`Status for user is ${data} for ${additionalScope.userID}`);
});
The part I'm trying to figure out is "additionalScope.userID". I made that up, it's not a valid property. I tried "this.additionalScope.userID" also. I can't see to get the additional scope properties in the onSuccess function nor in the resolve step. I looked at the docs Promise reTool docs but the example resolves all promises with Promise.all where the query result is returned but not the initial query request parameters.
Any ideas on how to access the additionalScope specific to the query that was run?
Thanks!