D365 access level for entry point in x++ comparison

Hi,

how to use entryPoint.Grant.Create.ToString() for comparison, in if statement,

sometimes it returns right value, sometimes it returns integer value randomly, so it becomes garbage data ???

AxSecurityEntryPointReference entryPoint = enumeratorEntryPoints.Current;

if(entryPoint.Grant.Create.ToString() != ‘Unset’)

instead of Read sometimes it returns something like 52115489

all i need is to get:

  1. Direct access permissions of an specific privilege access levels
  2. entry points of a privilege access levels

both by code

What is the type of Create property?

it is

Microsoft.Dynamics.AX.Metadata.Core.MetaModel.AccessGrantPermission.Create

but i cannot declare such type variable too,

so i couldnt do a type comparison i tried

any of the below doesnt work

Microsoft.Dynamics.AX.Metadata.Core.MetaModel.AccessGrantPermission.Create create;

if(entryPoint.GetType().Equals(Microsoft.Dynamics.AX.Metadata.Core.MetaModel.AccessGrantPermission.Create) = true)

if(entryPoint.GetType().Equals(Microsoft.Dynamics.AX.Metadata.Core.MetaModel.AccessGrantPermission::Unset) == false)

this doesnt work too

if(entryPoint.GetType().Equals(Microsoft.Dynamics.AX.Metadata.Core.MetaModel.AccessGrantPermission::Allow) == true)
{
info(entryPoint.ToString());
}

the if statement doesnt go into if property is Allow

i tried with old TreeNode framework but it doesnt pick up a Security privilege entry points node

TreeNode treeNode = TreeNode::findNode(‘\Security\Security Privileges\’ + privilege.Name + ‘\Entry Points’);