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, ...
Answered

Auto generated child record when creating parent line

(0) ShareShare
ReportReport
Posted on by 275

Hi

I have a created an alteration to SalesProjectQuotationLine (Parent) by creating an extra table (Child) which contains alot of extra infomation. 

But the line should only be created if the Parent type is a specific type. The problem is because of the innerjoin on the datasource level, the line are created automatically. I have tried to alter Write (Form method), ValidateWrite (Form method), InitValue (Form method), OnCreating (Form event method), OnInitValue (Form event method), OnValidatingWrite (Form event method), Insert (Table method), Update (Table method), InitValue(Table method) But none of the methods are called before the line are created.

How can i prevent the Parent inserting a new record on the child? Or atleast creating my if before the line are created.

Sinceryly AShein

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    skip super() in write if you dont wont to save it and then return true from validateWrite to avoid warnings.

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    An inner join sounds like a bad choice if the related record will exist only for certain header. The inner join would filter out all headers that don't have that, i.e. all header except of those of your specific type.

    Consider using a link (such as Delayed) instead of a join, or using an outer join. Then you can create the line from code (or, in case of outer join, let the system to create a line automatically when one of its fields get changed).

  • Ashein Profile Picture
    275 on at

    Thanks Martin, this worked exactly the way i should.

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

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans