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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Filter by Worker name on WorkerSalesTaker on SalesTable

(0) ShareShare
ReportReport
Posted on by 122

Hi. I am trying to filter using a sales worker name in WorkerSalesTaker field in a query on SalesTable.

Applying the name directly to value (Julia Funderburk for example) does not work. I also tried the Recid for the worker but it does not filter it either. Is there a specific format I should use? Any support is welcome! Thanks! 

  

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Vijay, I think RecId will not work and probably not good idea as RecId of this worker will be different in Different environments (Prod, Test, Dev). I'm not sure if there is a right format to add in AOT query range but you can manage it via code. You need to add the range where query is being used.

    community.dynamics.com/.../modify-range-in-aot-query

  • GirishS Profile Picture
    27,827 Moderator on at

    Hi Vijay,

    Do you need to set the current worker or random worker?

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    You can check this article for current user or employee associated with user. However, If you need to hard code the worker then it's best to add parameter in form, as worker's employment can be terminated and you have change the worker in AOT query or code level. Better to add parameter for worker if you want to show data related to that specific worker.

    daxamigo.wordpress.com/.../

  • VJ VM Profile Picture
    122 on at
    [quote user="GirishS"]

    Hi Vijay,

    Do you need to set the current worker or random worker?

    Thanks,

    Girish S.

    [/quote]

    Hi Gireesh. I need to add it to a specific worker and I'll also be creating a separate role specific for that user. All I need to know is how to specify a worker in the query. 

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

    You cannot hard code worker RecId or name in the query range - RecId will be different in different environment and name will not accept as it is int 64 field. If the Personnel number is same in all the environments, you can add HcmWorker table to the query and add range to the personnel number.

    If the personnel number also different, then you need to create a parameter table to save worker value and use that table in that query.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Ok that makes sense. Yes, the personnel number is common. I can add HcmWorker to the query but how do I link it to WorkerSalesTaker?

  • GirishS Profile Picture
    27,827 Moderator on at

    You have relation under SalesTable where SalesTable.WorkerSalesTaker == HcmWorker.RecId.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Hi. The SalesTable.WorkerSalesTaker returns a name while HcmWorker.Recid returns a number which is not relatable to SalesTable. I checked both the table records. I can only find SalesTable.WorkerSalesTaker==HcmWorker.Person to be common. But that does not seem to work for filtering salestable by specific worker.

  • GirishS Profile Picture
    27,827 Moderator on at

    SalesTable.WorkerSalesTaker returns a name because its a reference group field. But in SQL it will be save as RecId only.

    Relation between SalesTable and HcmWorker will be SalesTable.WorkerSalesTaker == HcmWorker.RecId not Person.

    Just add HcmWorker table under SalesTable Datasource in query - Add personnel number as a range and then specify the value for it.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at

    Yes I already added HcmWorker as a datasource for the salestable. After specifying the personnel number as range and value, what value should I specify under SalesTable range for WorkerSalesTaker in the query?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans