Skip to main content

Notifications

Announcements

No record found.

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

  • NR-11010513-0 Profile Picture
    NR-11010513-0 2 on at
    Re: AIF Document Services... Setting Default Values?

    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;

  • NR-11010513-0 Profile Picture
    NR-11010513-0 2 on at
    Re: AIF Document Services... Setting Default Values?

    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.

  • Suggested answer
    Re: AIF Document Services... Setting Default Values?

    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.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans