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

How to get a reference from sales order to production

(0) ShareShare
ReportReport
Posted on by 172

I'm trying to find a reference point for a sale order to pin it with a production order but I can't find any possible columns for it.

My task is to get all ProdID that are created from a sale order. I'm working on SalesTable form.

I have the same question (0)
  • Crispin John Augustine Profile Picture
    37,081 on at

    If you look at the relations in ProdTable, you will find the correct columns for joining with SalesTable and SalesLine..

  • RadekM Profile Picture
    172 on at

    Look like in Salesline retaion is ProdTableRef class reference. But how can I get into this data with a relation ?

  • Crispin John Augustine Profile Picture
    37,081 on at

    Not sure, what you saw, but this is how the relation works.

    salesprodrel.jpg

  • RadekM Profile Picture
    172 on at

    Did look from salesline > Relations > prodtableref > inventrefid , inventreftype

    in AOT I got ProdTable > Relations > SalesOrderLine and the relations above you pasted.

    How can use it in select statement ?

    Could you give me a example for it?

    I need something like this. Select prodid, collectrefprodid from prodtable where inventrefid == current.salesid ??

  • Crispin John Augustine Profile Picture
    37,081 on at

    You already have the tables and relations now.

    As to writing a select statement, you have to go through docs.microsoft.com/.../xpp-data-query

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    Whatever fields present  in the  relation , you can use those in where clause while building your query.

  • RadekM Profile Picture
    172 on at

    Can someone say me why I get '.' expected error at the end in this ?

    I need to get all prodid from collectref since the nested statement gives me just the main prodid and collectref

    select ProdId, ProdStatus from prodtable where prodtable.CollectRefProdId in (select  ProdId, CollectRefProdId, ProdStatus from prodtable join salestable where prodtable.InventRefId == salestable.salesid);
                    Info(strFmt('%1,%2, %3', prodtable.ProdId, prodtable.CollectRefProdId, prodtable.ProdStatus));

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi RadekM,

    The select syntax is incorrect. Subqueries are not supported in x++.

    In your case use join between all tables.

  • RadekM Profile Picture
    172 on at

    I dont see how should it work for me. From my first select I got exact that what wanted but now I need to use this value in another select .

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi RadekM,

    You just need to replace "in" with "join". And don't forget to declare all variables.

    select prodtable 
    exists join prodtable1
    	where prodtable1.ProdId = prodtable.CollectRefProdId
    exists join salestable 
    	where prodtable1.InventRefId == salestable.salesid

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 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans