web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Multiselect workers for SSRS Report

(0) ShareShare
ReportReport
Posted on by

I have two problems.

(1) I am not getting names in the text box only numbers.   I get recdId's.  Below is just an example.

(2)  My Rec Id list is not getting passed to the DP class.

Here's my code:

class DeductionClosedContract
{

    List workerList;

    DataMemberAttribute('workerList'),
    AifCollectionTypeAttribute("_workerList", Types::Int64),
    AifCollectionTypeAttribute("return", Types::Int64)
    ]
    public List parmWorkerList(List _workerList = workerList)
    {

       
        workerList = _workerList;
        return workerList;

    }

}




class DeductionClosedUIBuilder extends SysOperationAutomaticUIBuilder
{
    DeductionClosedContract contract;
    DialogField dialogWorkerList;
    HcmWorkerLookup hcmWorkerLookup = HcmWorkerLookup::newOnlyActiveEmployeesWithinCompany();
    Set  workerListSet;
    SetIterator it;
 
    public void build()
    {
    
        
        contract = this.dataContractObject() as DeductionClosedContract;

        dialogWorkerList = this.addDialogField(methodStr(DeductionClosedContract,parmWorkerList),contract);

    }


    public void lookupWorkerList(FormStringControl _control)
    {
        
        Query           query = hcmWorkerLookup.updateQuery();
        smmParametersTable parameters;
       

        parameters = smmParametersTable::find();

        //Modify the query built by HcmWorkerLookup to filter the employees whos responsibility Id
      
        query.dataSourceTable(tableNum(HcmWorker)).addRange(fieldNum(HcmWorker,ResponsibilityId)).value(
                    SysQuery::value(parameters.ResponsibilityId));

        workerListSet = hcmWorkerLookup.multiSelectWorkers();
    
  
        if (dialogWorkerList)
        {
            dialogWorkerList.lookupButton(2);
        }
       
    }

    /// 
    ///
    /// 
    public void getFromDialog()
    {
        HcmWorkerRecId workerRecId;

        super();

        List WorkersList = new List(Types::Int64);

        it = new SetIterator(workerListSet);

        while (it.more())
        {
            workerRecId = it.value();

            WorkersList.addEnd(workerRecId);

            it.next();
        }

        contract.parmWorkerList(WorkersList);
        
    }

  
    /// 
    ///
    /// 

    /// 
    ///
    /// 
    public void postRun()
    {
      
        //super();

        dialogWorkerList   = this.bindInfo().getDialogField(contract, methodStr(DeductionClosedContract, parmWorkerList));
        dialogWorkerList.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(DeductionClosedUIBuilder, lookupWorkerList), this);
     

    }

}

I have the same question (0)
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    To make your code simple, you can create a query and use that in your dp class so that you can get the filter criteria button where you can give multiple workers.

  • brianmaric Profile Picture
    on at

    I am not able to pass the parameter value to the DP class so I'm not sure how using a query would help.  I still need the parameter value the user selected.

  • brianmaric Profile Picture
    on at

    I added a custAccount parameter in the contract class and it also doesn't get sent to the DP.  I suspect something more basic in involved, but the from and to date parameters work fine...puzzling

  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at

    Hi Brian, Please check these articles. If still issue then share your DP class code.

    jonesd365.blogspot.com/.../multi-select-lookup-in-ssrs-report-in.html

    dynamicsaxinsight.com/.../

    ariste.info/.../

  • Suggested answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi Brian,

    You are using lookup from HcmWorkerLookup class - Calling the multiselectworker method will call another form. So that multiselect is different than what you are looking for. This lookup is used in the Human resource >> Benefits >> Action pane >> Benefits >> Enroll in benefit >. Clicking on add button will open the new form for multi-selection of workers. I think that's the reason why you are not getting values in the DP class.

    Please refer to the below blogs in addition with blog suggested by Mohit or creating multi select lookup.

    https://d365fotechnicalblog.blogspot.com/2022/06/create-multi-selection-lookup-in-d365fo_5.html

    Thanks,

    Girish S.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    For using query in DP class you can follow this link. In this, report automatically adds everything for you.

    community.dynamics.com/.../adding-filter-on-report-in-records-to-include-tab

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 414 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 352

#3
Martin Dráb Profile Picture

Martin Dráb 275 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans