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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Question about Relationship Between WHSWorkLine and SalesLine

(0) ShareShare
ReportReport
Posted on by 66
Hello D365FO Community,
 
I hope this message finds you well. I'm currently working on a project where I need to determine the association between the `WHSWorkLine` and `SalesLine` tables in Dynamics 365 Finance and Operations.
 
Specifically, I'm trying to find out which `SalesLine` is associated with a given `WHSWorkLine`. Can you please provide insights on:
 
Thank you for your expertise and assistance!
Best regards,
Hatem
D365FO Technical Consultant
 
I have the same question (0)
  • Martin Dráb Profile Picture
    235,792 Most Valuable Professional on at
    Question about Relationship Between WHSWorkLine and SalesLine
    An obvious problem of your SQL code is that it ignores Partition and DataAreaId field, therefore it may be potentially joining unrelated data from different companies. F&O handles it for you, but it's your responsibility if you bypass F&O and query the DB directly.
  • TNGrizzly Profile Picture
    66 on at
    Question about Relationship Between WHSWorkLine and SalesLine
    Hello,
    Thank you both for your valuable input; it has been incredibly helpful.
     
    I've tried the suggested query, and while it provided the expected result in my current scenario, I have concerns about its accuracy in other cases. I want to ensure that the query is robust and won't lead to inaccuracies in different scenarios.
    Could you kindly review the query below and advise if it covers a broader range of cases? Additionally, if there are any potential pitfalls or improvements you could suggest, I would greatly appreciate your insights.
    Notes: I'm working on works of WHSWorkTransType::Sales and work lines of  WHSWorkType::Pick
     
    the query I'm talking about is the first one. the second query is the one suggested by u.
     
     
    Your expertise is highly valued, and I'm grateful for any further guidance you can provide.
    Thank you
     
  • Verified answer
    Layan Jwei Profile Picture
    7,995 Super User 2025 Season 2 on at
    Question about Relationship Between WHSWorkLine and SalesLine
    Yes Martin is correct, i was describing in general that you can reach SalesLine from WHSWrokerLine.

    Martin's solution is correct, this is the relation:

    WHSWorkerLine.InventTransId = InventTransOrigin.InventTransId
    then InventTransOrigin.RecId = InventTransOriginSalesLine.InventTransOrigin
    then InventTransOriginSalesLine.SalesLineDataAreaId = SalesLine.DataAreaId && InventTransOriginSalesLine. SalesLineInventTransId = SalesLine.InventTransId

    Thanks,
    Layan Jweihan
  • Martin Dráb Profile Picture
    235,792 Most Valuable Professional on at
    Question about Relationship Between WHSWorkLine and SalesLine
    Using just SalesId isn't sufficient, because it doesn't identify a specific order line.
  • Suggested answer
    Layan Jwei Profile Picture
    7,995 Super User 2025 Season 2 on at
    Question about Relationship Between WHSWorkLine and SalesLine
    Hi TNGrizzly,

    WHSWorkLine.OrderNum = SalesTable.SalesId
    and SalesTable.SalesId = SalesLine.SalesId
     
     
    so you need to get to the salesTable first and then from SalesTable you can reach SalesLine

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Verified answer
    Martin Dráb Profile Picture
    235,792 Most Valuable Professional on at
    Question about Relationship Between WHSWorkLine and SalesLine
    I guess you can use InventTransOrigin table (WHSWorkLine has a relation with it) and InventTransOriginSalesLine table.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans