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 :
Microsoft Dynamics AX (Archived)

Sales Order default values

(0) ShareShare
ReportReport
Posted on by 282

Hi all,

Running AX 2012 R3 CU9. Probably a question with a simple solution but it's stumped me.

I have a custom text field against my sales order header which I usually by default set to the value "Standard". However, I've now created an identical field against my customer.

I thought to get it to default to the customer's one would be simply putting an if statement around my line of code. However, it seems that the code runs before the user physically selects a customer account. Usually init() or initValue() are fine for my purposes, but I can't work out if there's somewhere that gets called after the initFrom___() methods afterwards to slip my if statement in - it's not very manageable to have to code it in each individual one.

Is there such a place where I could put my code?

Thanks very much for your help in advance :)

Luke

*This post is locked for comments

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

    initValue() is only called when creating a new record. If you want your code to be executed when a customer is selected I suggest you to add the code to the modifiedField method of the table and execute whatever logic when the CustAccount field is changed.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    salesTable.InitFromCustTable should be the suitable place, just at end of standard Code.

  • lukbel Profile Picture
    282 on at

    Hi Jens,

    Ahh, that sounds like a winner - would I just use "if (_fieldId == fieldNum(SalesTable, CustAccount))" at the end of the method ignoring all the other code in the default method?

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans