Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Question about Relationship Between WHSWorkLine and SalesLine

(0) ShareShare
ReportReport
Posted on by 58
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
 
  • Martin Dráb Profile Picture
    Martin Dráb 230,503 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
    TNGrizzly 58 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
    Layan Jwei 7,379 Super User 2024 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
    Martin Dráb 230,503 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
    Layan Jwei 7,379 Super User 2024 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
    Martin Dráb 230,503 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans