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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AIF Document Services... Setting Default Values?

(0) ShareShare
ReportReport
Posted on by 2

Hello,

When writing to AX using Document Services, does any know where the best place is to add logic to default field values.

I'm not sure whether this logic should be added to the Axd Document Class or to the parameter methods of the data object classes?

Can anyone offer any advice?

Thanks in advance,

Nick

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    640579632b5c4e6780a624c4771b6f93 Profile Picture
    4,730 on at

    Depends if the defaults are regardless of where the document is created from like client , AIF or EP then the best place is to add on the defaultField method of the table.

    See AdvanceLedgerEntry webservice for public sector (fpk layer).

    If you want to defualt the values only when used with web service then I would add the logic to prepareForsave.

  • NR-11010513-0 Profile Picture
    2 on at

    Thanks for your response.

    The defaults would be for the web service only, so I will try setting the values in the prepareForSave method.

    Cheers.

  • NR-11010513-0 Profile Picture
    2 on at

    I've attempted to add the logic to set the default values in the prepareForSaveExtended() method, but this doesn't seem to work. Maybe I am setting it in the wrong place? Below is an example of where I have tried to default the value of an the organization's name.

            // ----------------------------------------------------------------------

            // Process Organization records

            // ----------------------------------------------------------------------

            case #Organization_DataSourceName:

     

                axbc_Organization_DirOrganization = _axBcStack.top();

                //TODO Put validating code for DirOrganization here

     

                //Default value of Organization Name

                axbc_Organization_DirOrganization.parmName("NameSetByService");

     

                switch (_recordProcessingContext)

                {

                    // Ensure Organization record is saved before any of its dependent child records

                    case AxdRecordProcessingContext::BeforeChildRecordProcessed:

                        switch (_childRecord.dataSourceName())

                        {

                            case #PartyLocation_DataSourceName:

                                if (!axbc_Organization_DirOrganization.isProcessed())

                                {

                                    return true;

                                }

                                break;

                        }

     

                        return false;

     

                    // Ensure Organization record is saved

                    case AxdRecordProcessingContext::AfterAllChildRecordsProcessed:

                        if (!axbc_Organization_DirOrganization.isProcessed())

                        {

                            return true;

                        }

     

                        return false;

                }

     

                return false;

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans