Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Filter by Worker name on WorkerSalesTaker on SalesTable

Posted on by 56

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! 

  

  • Vijay VM Profile Picture
    Vijay VM 56 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
    GirishS 27,828 Super User 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.

  • Vijay VM Profile Picture
    Vijay VM 56 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! :) 

  • Vijay VM Profile Picture
    Vijay VM 56 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. 

  • Vijay VM Profile Picture
    Vijay VM 56 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
    GirishS 27,828 Super User 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
    GirishS 27,828 Super User 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.

  • Vijay VM Profile Picture
    Vijay VM 56 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
    GirishS 27,828 Super User 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.

  • Vijay VM Profile Picture
    Vijay VM 56 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. 

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans