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! 

  

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable
    [quote user="GirishS"]

    If you asked about the record level security in the starting itself we will provide you the same solution.

    Anyways you got a solution. Thanks for sharing your answer.

    Thanks,

    Girish S.

    [/quote]

    Hi. I just noticed that I have not mentioned XDS anywhere in the post. :D Sorry about that.

    I was working on XDS and posting many queries from time to time, so I forgot to mention the background info.  

    Thanks a ton! 

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable

    If you asked about the record level security in the starting itself we will provide you the same solution.

    Anyways you got a solution. Thanks for sharing your answer.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable

    Hi. I was able to fix the issue. Here's what I did for anyone's reference.

    I added HcmWorker as the primary & only table in the query (instead of SalesTable) and added PersonnelNumber in the range and specified a specific salesman's personnel number in its value field.

    SalesResp-Policy.jpg

    In the security policy, I updated HcmWorker as the primary table and set SalesTable as constrained, allowing table relations "WorkerSalesTaker_FK" and "WorkerSalesResponsible_FK" to appear. I added it to a specific role so that I can add it to people as and when required. And voila, it worked. 

    In hindsight, it was sort of obvious to make the SalesTable the constrained table and not primary. Don't know why I didn't think of it.

    Thanks a lot for all your support guys and also for being patient with me! :) 

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable
    [quote user="GirishS"]

    One more thing you can override the init method of the query and add range to the PersonnelNumber field. Refer to the standard query "PayrollWorkSpaceWorkerNotSetForPayrollRunQuery >> Methods >> Init.

    Thanks,

    Girish S.

    [/quote]

    Unfortunately no luck. 

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable
    [quote user="GirishS"]

    One last try can you give the range value in double quotes and check.

    Thanks,

    Girish S.

    [/quote]

    No luck, the sales orders list still shows blank. 

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable

    One more thing you can override the init method of the query and add range to the PersonnelNumber field. Refer to the standard query "PayrollWorkSpaceWorkerNotSetForPayrollRunQuery >> Methods >> Init.

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable

    One last try can you give the range value in double quotes and check.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable
    [quote user="Mohit Rampal"]

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

    [/quote]

    Hi Mohit. Sorry I missed your replies. How do I add paramter for worker as you mentioned (Not current but a specific worker)? 

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable

    In the application explorer it will show like that only. Open it in new window and then see the relation.

    Thanks,

    Girish S.

  • VJ VM Profile Picture
    122 on at
    RE: Filter by Worker name on WorkerSalesTaker on SalesTable
    [quote user="GirishS"]

    No, you just added HcmWorker as a Datasource to SalesTable and added range and value - So it will filter HcmWorker along with SalesTable only.

    Can you try that in a runnable class - Call that AOT query in the runnable class and try to print the output to info log and check.

    Refer to the below blog for using AOT query in X++ code.

    https://daxbeginners.wordpress.com/2014/08/19/how-to-use-aot-query-through-x/

    Thanks,

    Girish S.

    [/quote]

    I tried this and the SalesTable showed blank / empty without any sales orders. 

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,034 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans