Skip to main content

Notifications

Service | Customer Service, Contact Center, Fie...
Suggested answer

Adding a Lookup to Invoice for Agreement

(2) ShareShare
ReportReport
Posted on by 360
I've added a Lookup field to the Invoices table pointing to Agreement.
 
I have a trigger flow when the Agreement Invoice Dates table get's updated:
 
1.  I'd like to to get the AgreementID of that row and the InvoiceID of that row (both are fields in that table).
2.  I want to update the corresponding InvoiceID row with the AgreementID.
 
PROBLEM #1
The triggerOutputs doesn't expose the Invoice field even if I specifically list it in select columns parameter of the trigger.  WHY NOT?
 
I think it would be ludicrous to have to hit the database again to pull that but even when trying that it did not get me the Invoice guid of the referenced Agreement Invoice Dates row.
 
 
  • Tom Gioielli Profile Picture
    Tom Gioielli 40 on at
    Adding a Lookup to Invoice for Agreement
    What are you triggering your flow from? If you trigger it off the [Invoice] field being modified, and add a condition for it such as 'msdyn_invoice_value ne null' it should work.
     
    I'm wondering if you are triggering the flow from either the record creation or the status changing, and the invoice lookup reference has not been populated yet. If the invoice field is available in the trigger outputs but simply blank, then I think you might just be triggering it too early.
  • crham Profile Picture
    crham 360 on at
    Adding a Lookup to Invoice for Agreement
    I just realized I posted this in the D365 Community and was thinking I was posting in Power Automate Community.
     
    If you have an answer great.  ...but I will be posting same question in Power Automate.
     
  • crham Profile Picture
    crham 360 on at
    Adding a Lookup to Invoice for Agreement
    You are correct in that the Invoices table has nothing that points to the Agreement Invoice Dates table but opposite of that, the Agreement Invoice Dates table has a field for both Agreement and Invoice.  So it effectively connects the two.  However, that has been problematic in my need to pull the data for my Word Template for invoicing.  Therefore I wish to create a more direct link from Invoice to Agreement and that's why I added the Agreement field to the Invoice table as a lookup column.
     
    And your proposed solution is exactly what I'm attempting.
     
    However, the first hurdle is trying to figure out why the triggerOutputs does not give me a reference to the Invoice field of the row changed.
     
    I am hoping someone with much greater knowledge can shed some light.
     
    If the final answer is that I MUST do a Get Row by ID then sadly so bit it, but in my testing of that I still had failure which I'm assuming is something I'm doing wrong.
     
    I'm getting the Agreement Number from the triggerOutputs and Getting a Row from the Invoices table whose Invoice Name contains the Agreement Number.
     
    However that did not result in a invoice guid either.
     
    When I get home tonight I'll provide some screenshots.
     
  • Suggested answer
    Tom Gioielli Profile Picture
    Tom Gioielli 40 on at
    Adding a Lookup to Invoice for Agreement
    As far as I am aware, an Invoice created through the Agreement Invoice scheduled process does not contain a link back to the Agreement Invoice Date or the Agreement itself (which is a bit ridiculous, I know).
     
    Your solution would be the following:
    • Create a custom lookup field on the Invoice table that points back to the Agreement table
    • When the [Invoice] field on the Agreement Invoice Date field is populated, trigger an automation (D365 workflow would be fine here, cloud flow of course would also work) and populate the new lookup field with the Agreement
      • Note: This automation should run on the Agreement Invoice Date table if a D365 workflow so you can get to the Agreement reference on the parent setup
     
    Good luck, hope this helps!

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans