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, ...
Suggested answer

What is a unique relation between SMAServiceOrderTable or SMAServiceOrderLine tables with ProjInvoiceJour table?

(0) ShareShare
ReportReport
Posted on by 62

Hi experts,

I need to join SMAServiceOrderTable or SMAServiceOrderLine Table with ProjInvoiceJour Table. I found out that there is no direct relation between these tables but I found that I can join SMAServiceOrderTable with ProjTable and then join ProjTable with ProjInvoiceTable and then finally with ProjInvoiceJour but I am getting multiple records. I need to get one unique record against that.

Basically my requirement is to add few fields of SMAServiceOrderTable in ProjInvoiceJournal form which contains ProjInvoiceJour table as a datasource. 

Here is the SQL Query:

Select * from SMAServiceOrderTable as s1
join ProjTable as p1
on s1.ProjId = s1.ProjId
join ProjInvoiceTable as p2
on p1.PROJID = p2.PROJINVOICEPROJID
join PROJINVOICEJOUR as p3
on p2.PROJINVOICEPROJID = p3.PROJINVOICEPROJID
where p3.PROJINVOICEID = ''

Your response would be highly appreciated. 

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: What is a unique relation between SMAServiceOrderTable or SMAServiceOrderLine tables with ProjInvoiceJour table?

    Hi, This has been discussed before.

    Have you checked this thread.

    community.dynamics.com/.../x-relation-from-service-order-header-link-to-project-invoice-journal

  • Arabic Translation with item Profile Picture
    62 on at
    RE: What is a unique relation between SMAServiceOrderTable or SMAServiceOrderLine tables with ProjInvoiceJour table?

    Hi Mohit,

    Thank you for your response.

    Yes, I have gone through that link. I also tried that in Insert event of ProjInvoiceJourTable but it's not working.

    select ProjInvoiceId, TransId, Qty from invoiceLinesUnion where invoiceLinesUnion.ProjInvoiceId == projInvoiceJour.ProjInvoiceId;

    if(invoiceLinesUnion)

           {

               select ProjTransId,ServiceOrderId from  serviceOrderLine where serviceOrderLine.ProjTransId == invoiceLinesUnion.TransId;

               if(serviceOrderLine)

               {

                   projInvoiceJour.SMAServiceOrderId = serviceOrderLine.ServiceOrderId;

                   Info(strFmt("ServiceOrderId: %1", serviceOrderLine.ServiceOrderId));

               }

           }

    Can you tell me on which event should I call this code?

    Regards,

    Arif Hussain

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 678

#3
Martin Dráb Profile Picture

Martin Dráb 526 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans