Custom Lookup Using X++ code

 UI builder class for custom Lookup.

UI builder class is used to store the customization-related information of the report dialog.

For creating a UI builder class you have to go to your Project >> Right Click Add Item >> Go to Class tab >> select Class and Give it the name "AttendanceDetailsReportUIBulder".

I have created this,

class AttendanceDetailsReportUIBulder  extends SrsReportDataContractUIBuilder

{

    DialogField     displayEmp;

    public void lookupEmployee(FormStringControl control)

    {

        Query                   query               = new Query();

        SysTableLookup  SysTableLookup = SysTableLookup::newParameters(tableNum(HcmWorker), control);

        QueryBuildDataSource qbds = query.addDataSource(tableNum(HcmWorker));

        SysTableLookup.addLookupfield(fieldNum(HcmWorker, PersonnelNumber));

        SysTableLookup.addLookupfield(fieldNum(HcmWorker, Person));

        sysTableLookup.parmQuery(query);

        sysTableLookup.performFormLookup();  

    }

    public void postBuild()

    {

        super();

        displayEmp = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(AttendanceDetailsReportContract,parmDirPartyName));

        displayEmp.registerOverrideMethod(methodStr(FormStringControl,lookup), methodStr(AttendanceDetailsReportUIBulder,lookupEmployee),this);

    }

}

Now use this link in your contract class you will get the custom Lookup.

[DataContractAttribute,SysOperationContractProcessingAttribute(classstr(AttendanceDetailsReportUIBulder))]

Enjoy 👍

No comments:

Post a Comment

Workflow Approver Name For PurchRequsition Order

 For First Approver, this.workflowApprover(purchReqTable.RecId);     public void workflowApprover (RecId _recId)  // Requsation Table RecId ...