Using the getOwnerId API
You can use the getOwnerId API to check if a private planning version is owned by the current user of the private version.
The check is necessary because a user cannot perform certain operations on a private version like delete, copy, or publish if the version is not owned by the user.
Before you start
This API can only be called on a private version and is therefore not relevant for BPC models.
Example
The following script shows how you can use the getOwnerId API:Sample Code
// check if the private version is owned by the current user var privateVersion = Table_1.getPlanning().getPrivateVersion("privateVersionName"); if (privateVersion && privateVersion.getOwnerId() === Application.getUserInfo().id) { privateVersion.deleteVersion(); } else { // fallback. e.g. show message to user that they may not do certain operations on this version (delete, copy, publish) }