Skip to main content

Notifications

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

won't get the recid from purchline , when select the itemid

(0) ShareShare
ReportReport
Posted on by

hI Team,

[FormDataFieldEventHandler(formDataFieldStr(PurchTable, PurchLine, ItemId), FormDataFieldEventType::Modified)]
    public static void ItemId_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {       

        PurchLine       purchLine      = sender.datasource().cursor();
    }

But when I create a new line and enter Item Id, then won't get the Recid from Purch Line.

Kindly let me know if anything missing?

Pls give me more shed on this.

thanks!

  • Verified answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: won't get the recid from purchline , when select the itemid

    Yes, To get RecId, record should be inserted. You can add breakpoint on insert method of PurchLine table and try adding new line, add item and dont save the line. If on selecting itemId it hits insert method then you will get RecId. However,  PurchLine is not created just by selecting ItemId. You need to write you logic in post insert event handler or after next statement in CoC of insert method in PurchLine table extension class.

  • @rp@n Profile Picture
    @rp@n on at
    RE: won't get the recid from purchline , when select the itemid

    thanks Mohit,

    I tried in PurchLine table - insert , PurchTable(form) - PurchLine - Insert

    but unbale to get the rec id.

    my question is, Is required to save the record after selecting the itemid ?

    when i select the item id and putting the break point on insert but the purch line showing no data selected.

    kindly help me with the code pls

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: won't get the recid from purchline , when select the itemid

    RecId will be created after a record is inserted. In this case, record in purchLine table is not yet created, so no RecId.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    RE: won't get the recid from purchline , when select the itemid

    That's the correct behaviour. New, unsaved records don't have RecId yet. It's assigned on insert.

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans