Record level Security

user should have access to delete unposted journals.

Currently the user has the ability to delete all journals (posted and not).

while user should delete only unposted journals.

Hey Kumar,

You can control this by overriding the delete method on table level. Just ask to your developer to do this. Let me know if you need any other help on the same.

Is there any chance to make any security?

actual i want to disable the button if record is posted.

you can override the activate method to do this.

if(LedgerJournalTable.Posted == NoYes::Yes)

{

Post.enable(False); // post is your button name.

}

else

{

Post.enable(TRUE);

}

yes, you are right, but i want to apply the above code on a single role only not for all users.

can we do that?

Hi,

I do not think that disabling the button will be the best option, since the user could go to File-> Delete record or select the record and press alt+F9.

I recommend you to use Extensible Data Security policies, you can bouild a query that selects LedgerJournalTable with a Range on the Field Posted and set the Value to No, then create a security policy specifically for that role and using the query created and specifying the Action Delete.

Additionally if you want to disable the button specifically for that role. You can create a menu item and a privilege for that menu item and give full control in the privilege to the menu item, then assign that privilege Only to the desired role.

Then do something like the following code in the method that you were previously talking, so if the role that is running the code has full access to the menu item, then it will disable the button. It could seems strange to use full access to disable something but if we do it other way you will have to assign the privilege to all the other roles…

SecurityRights securityRights;
AccessRight accessRight;
;

securityRights = SecurityRights::construct();
accessRight = securityRights.menuItemAccessRight(SecurableType::MenuItemAction, menuitemActionStr(MenuItemName)); //<–substitute yout menu item name

if(accessRight == AccessRight::Delete)

{
//disable your button here
}