Skip to content

Commit

Permalink
Merge pull request #202 from friggframework/feature/lef-545-fix-share…
Browse files Browse the repository at this point in the history
…point-module-entity-update

Add the updated credential to an already existing entity in SharePoint integration
  • Loading branch information
leofmds authored Jul 24, 2023
2 parents c44b373 + feeee90 commit a1da0de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api-module-library/sharepoint/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ class Manager extends ModuleManager {
};
this.entity = await Entity.create(createObj);
} else if (search.length === 1) {
this.entity = search[0];
this.entity = await Entity.findOneAndUpdate(
{ _id: search[0] },
{ $set: {
credential: this.credential.id
}},
{ useFindAndModify: true, new: true }
);
} else {
const message = 'Multiple entities found with the same external ID: ' + externalId;
debug(message);
Expand Down

0 comments on commit a1da0de

Please sign in to comment.