gpt4 book ai didi

axapta - 如何在 Ax 2012 中获取公司用户访问列表?

转载 作者:行者123 更新时间:2023-12-04 02:18:39 26 4
gpt4 key购买 nike

在 Ax 2009 中,要按用户获取公司列表,我是这样获取的:

static container getAllCompanies()
{
Container companies;
DataArea dataArea;
CompanyDomainList companyDomainList;
AccessRightsList accessRightsList;
UserGroupList userGroupList;


//select all the companies in which current user’s access level is higer than NoAccess
while select id,name from DataArea
Exists join companyDomainList
where companyDomainList.companyId == dataArea.Id
join accessRightsList
where accessRightsList.domainId == companyDomainList.domainId && accessRightsList.accessType > AccessType::NoAccess
join userGroupList
where userGroupList.groupId == accessRightsList.groupId && userGroupList.userId == curuserid()
{
companies += [dataArea.name,dataArea.Id];
}

return companies;
}

但在 Ax 2012 中,我没有 CompanyDomainList 表,我怎样才能获得用户有权访问的公司列表?

最佳答案

用户和公司信息保存在OMUserRoleOrganization

UserId userId = curUserId();

CompanyInfo companyInfo;
OMUserRoleOrganization oMUserRoleOrganization;
container result;

while select companyInfo
exists join oMUserRoleOrganization
where oMUserRoleOrganization.OMInternalOrganization == companyInfo.RecId
&& oMUserRoleOrganization.User == userId
{
result += [companyInfo.Name, companyInfo.DataArea];
}

if (!result)
{
// no specific company for user --> all
while select companyInfo
{
result += [companyInfo.Name, companyInfo.DataArea];
}
}

关于axapta - 如何在 Ax 2012 中获取公司用户访问列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32569917/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com