web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Get Active record in form init method

(0) ShareShare
ReportReport
Posted on by 435

Hi Experts,

In "SMAServiceOrderTable" form, I need to get "SMAServiceOrderTable" active record in 'SMAServiceOrderLine' data source init method.How can I achieve this.

AnyOne suggest.

Thanks.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi!

    Why?

    What do you want?

  • Edselv Evert Profile Picture
    435 on at

    Hi Laputin,

    I need "SMAServiceOrderTable" Datasource active record in "SMAServiceOrderLine" dataSource init method.

    HOw to get that record.

    Thanks.

  • Edselv Evert Profile Picture
    435 on at

    Hi Crispin,

    Use like the way don't get the any recid for this buffer.

    Thanks.

  • Martin Dráb Profile Picture
    240,312 Most Valuable Professional on at

    It's impossible - init() runs before any data is fetched from database, so there simply isn't any active record yet. You'll have to change your requirements. If you need some help with it, please explain what business logic you're trying to achieve.

  • Edselv Evert Profile Picture
    435 on at

    HI Martin,

    I will need already initialized value in "SMAServiceOrderTable" record in "SMAServiceOrderLine" dataSource init method.

    Is this possible or not.

    Thanks,

  • Martin Dráb Profile Picture
    240,312 Most Valuable Professional on at

    You asked for an active of a datasource and I've just explained why it's not possible. Talking about an active record makes no sense before you run the form (and the query).

    If you say you want an initialized record of SMAServiceOrderTable, you surely can write some code to create and fill in a variable, but you would have to know which record you need - it doesn't seem to be your case.

    It seems to me that you simply picked a wrong method; you need running your logic later.

  • Verified answer
    Edselv Evert Profile Picture
    435 on at

    Thnx for the replies,

    Issue solved.

    Using SMAServiceOrderTable = element.args().record();

    This will give the active buffer for SMAServiceOrderTable.

    Thanks Again.

  • Martin Dráb Profile Picture
    240,312 Most Valuable Professional on at

    Aha, so you actually wanted something else than you asked. Your code doesn't access the active record of SMAServiceOrderTable datasource of the form (because there isn't any), it's a parameter passed from another form.

    Note that if the variable is the buffer created automatically for the datasource, your value will be thrown away as soon as the query executes.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans