D365FO在工作空间上进行过滤

时间:2019-09-13 12:42:37

标签: axapta microsoft-dynamics x++ dynamics-365-operations

我正在使用D365FO(更新28)。需要基于负责人在定制创建的工作空间上进行过滤。表PMCContract包含HCMWORKERRECID列。筛选器会正确打开人员列表,但无论选择了哪个人员。同样,当工作区加载时,默认情况下,它总是在列表中加载第一人称,但应为空。

    [Form]
public class PMCContractManagementWorkspace extends FormRun implements SysIFilterProvider
{

    SysFilterChangeEvent changeEvent;

    public void close()
    {
        super();

        SysFilterLastValueHelper::saveLastValue(worker);
    }

    public void initParmDefault()
    {
        if (!Worker.value())
        {
            HcmWorker     hcmWorker;
            PMCContract personUser;

            select firstonly RecId from hcmWorker
                exists join personUser
                where hcmWorker.RecId == personUser.HCMWORKERRECID;
                && personUser.HCMWORKERRECID == curUserId();

            Worker.value(hcmWorker.recId);
        }
    }

    public void init()
    {
        super();

        SysFilterLastValueHelper::getLastValue(worker);

        changeEvent = SysFilterChangeEvent::newFromFormControl(worker);

        this.initParmDefault();
    }

    public SysIFilter parmFilter()
    {
        SysIFilter                      filter = SysFilterFactory::createEmptyFilter();
        UserInfo                        currentUser;
        HcmWorker                       hcmWorker;
        PMCContract                     personUser;
        SysFilterValueResolutionMethod  filterValueResolutionMethod = SysFilterValueResolutionMethod::All;

        select HCMWORKERRECID from personUser
            //exists join hcmWorker
            where hcmWorker.RecId == personUser.HCMWORKERRECID;
                    //&& hcmWorker.RecId == Worker.value();

        SysIFilterValue  filterValue = SysFilterValueFactory::createFilterValueForBuffer(currentuser);

        if (currentUser)
        {
            filterValueResolutionMethod = SysFilterValueResolutionMethod::None;
        }

        filter.addItem(filterValue, SysFilterOperator::Equal, filterValueResolutionMethod);

        return filter;
    }

    public SysFilterChangeEvent parmChangeEvent()
    {
        return changeEvent;
    }

}

0 个答案:

没有答案