Thursday, September 3, 2026

ax - How enable change on the row only to the user who created

On the DataSource override this method:
public int active()
{
    boolean bModifyEnabled;
    CIEB_OOPP_Requirements requirement = CIEB_OOPP_Requirements_ds.cursor();

    ret = super();

    // new record
    if (!requirement.RecId || requirement.createdBy == "")
    {
        bModifyEnabled = true;
    }
    else
    {
        bModifyEnabled = (
                            requirement.createdBy == curUserId() ||
                            UserInfoHelp::userInUserGroup(curUserId(), 'OOPP_ADMIN') ||
                            Global::isSystemAdministrator()
                         );
    }

    CIEB_OOPP_Requirements_ds.allowEdit(bModifyEnabled);
    CIEB_OOPP_Requirements_ds.allowDelete(bModifyEnabled);

    return ret;
}
+ important this one:
public void write()
{
    super();

    this.active();
}

No comments:

Post a Comment