OneDrive integration error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2023 01:12 AM
HI Experts,
I'm facing an error in OneDrive integration, while adding permission using the oob "Add Permission" action. we have an integration where when a remediation record is created, a folder with same record number gets generated in OneDrive and the link to the folder is populated in a custom field in servicenow record. Due to the below error the folder gets created but the link does not appear back in servicenow instance.
This is the flow error message, kindly help in investigating the issue. let me know if any more info is required.
Root cause of JavaScriptException: org.mozilla.javascript.NativeError
JavaScript evaluation error on:
(function execute(inputs, outputs) {
var utils = new OneDriveUtils();
inputs = new OneDriveUtils().trimStringInputs(inputs);
utils.validateMandatoryVariables(inputs, ['file_id','source']);
if(inputs.source != "root" && inputs.source_id == null)
throw new Error("Source ID can't be empty for "+inputs.source+" source");
var payload = {};
if(!inputs.requireSignIn && !inputs.sendInvitation)
throw new Error("RequireSignIn and SendInvitation cannot both be false, anyone must be true");
payload["requireSignIn"] = inputs.requireSignIn;
payload["sendInvitation"] = inputs.sendInvitation;
var rep = [];
if(inputs.recipients.length > 0){
for(var i=0;i<inputs.recipients.length;i++){
rep.push({
"email":inputs.recipients[i]
});
}
payload["recipients"] = rep;
}
if(inputs.roles == "read")
payload["roles"] = [ "read"];
if(inputs.roles == "write")
payload["roles"] = [ "write"];
if(inputs.roles == "read and write")
payload["roles"] = ["read", "write"];
if(inputs.message)
payload["message"] = inputs.message;
outputs.payload = JSON.stringify(payload);
if (inputs.file_id)
outputs.request = new OneDriveUtils().OnedrivePath(inputs.source,
inputs.source_id) + inputs.file_id + "/invite";
})(inputs, outputs);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2023 03:36 AM
Hi,
The error message you provided suggests that there is a JavaScript evaluation error in the code snippet you provided. Specifically, it seems that the error is being thrown from within the "execute" function, which is used to add permissions to a OneDrive file.
Without seeing the full code and understanding the context of the error, it is difficult to provide a specific solution. However, here are a few general tips that may help you troubleshoot the issue:
Check the input variables: The error message suggests that the "requireSignIn" and "sendInvitation" input variables are causing the issue. Make sure that these variables are defined correctly and that their values are valid. Also, check the other input variables to make sure they are being used correctly.
Debug the code: Try adding some console.log statements to the code to see where the error is occurring. You can also try commenting out parts of the code to isolate the issue.
Check the OneDrive API documentation: Make sure that you are using the correct API endpoint and that your code is following the correct syntax and format. The OneDrive API documentation should provide more information on how to add permissions to a file.
Seek help from the OneDrive support team: If you are still having trouble, you may want to reach out to the OneDrive support team for assistance. They should be able to help you troubleshoot the issue and provide a solution.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar