cancel
Showing results for 
Search instead for 
Did you mean: 

UserPermissionTree.Levels changed to read-only?

Former Member
0 Kudos

Hi all:

I am trying to create some user-defined permissions for an add-on in C#. While trying to create them, contrary to the SDK documentation, apparently the Levels property of the UserPermissionTree is now read-only. Here's my code, maybe someone can confirm this problem/change of behaviour, or point out the correct way to create child permissions, as it is possible in the UI.

UserPermissionTree oPermission = (UserPermissionTree)oCompany.GetBusinessObject(BoObjectTypes.oUserPermissionTree);

if (!oPermission.GetByKey(permissionID))

{

     oPermission.PermissionID = permissionID;

     oPermission.Name = description;

     oPermission.Options = options;

     if (parentID != null)

     {

          //oPermission.Levels = 2;  // "this property cannot be assigned to"

          oPermission.ParentID = parentID;

     }

     result = oPermission.Add();

}

Any clues?

Thanks,

Joerg.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

OK... I just answered my own question. Assigning the "Levels" is not necessary any more. It's sufficient to supply the ParentID and the DI will automatically assign the corresponding level to the new child permission based on the existing father.

The DI documentation should be updated, though. In version "SAP Business One DI API 8.82 - Objects Reference (8.82.061)" it still says you can assign the level...

Regards,

Joerg.

Answers (0)