Skip to main content

Notifications

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);
     

    }

}

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Multiselect workers for SSRS Report

    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

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Multiselect workers for SSRS Report

    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
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Multiselect workers for SSRS Report

    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/.../

  • brianmaric Profile Picture
    brianmaric on at
    RE: Multiselect workers for SSRS Report

    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

  • brianmaric Profile Picture
    brianmaric on at
    RE: Multiselect workers for SSRS Report

    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.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Multiselect workers for SSRS Report

    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans