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)

Set the default document type under Document Handling

(0) ShareShare
ReportReport
Posted on by

We recently added a document type, "F Note". This type has a specific function and will contain a 10-12 digit number.

My issue is "F Note" is defaulting when anyone goes to add a regular note. They are now required to select the dropdown and select "Note". This is an extra step and if it is forgotten the note is Entered as "F Note" type.

Before the addition of the new type, the default was "Note". Is there a way to return this default?

I have some users who still default to "Note" but there in no discernible connection between them. and I have poured through the options and settings looking for some connection.

The issue is occurring throughout all forms. If the user defaults to "F Note", AR, AP,INV,etc. default to "F Note" 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    You appear to be suffering from alphabetical order.

    The default type of note that is picked is decided in the data source DocuRef method initValue() on form DocuView.

    void initValue()
    {
    ;
        docuRef.TypeId = optionView.parmDefaultTypeId();
    
        super();
    
        // <GBR>
        if (BrazilParameters::isEnabled()
            && BrazilParameters::find().FiscalDocumentTextDocuTypeId)
        {
            docuRef.RefCompanyId    = actualCompanyId;
            docuRef.RefTableId      = actualTableId;
            docuRef.RefRecId        = actualRecId;
        }
        // </GBR>
    }

    The class DocuOptionView initializes that value in method initParmDefault().

    /// <summary>
    ///    Initializes the internal variables.
    /// </summary>
    /// <remarks>
    ///    This method is called when the <c>SysLastValue</c> record is not found when the code calls the
    ///    <c>SysLastValue.GetLast</c> method. Remember to call the <c>super</c> method.
    /// </remarks>
    void initParmDefault()
    {
        defaultTypeId = DocuType::typeNote();
    }

    The DocuType static method typeNote() unfortunately just looks for the first DocuType that is a Note type group.

    static DocuTypeId typeNote()
    {
        DocuType docuType = DocuType::findGroup(DocuTypeGroup::Note);
    
        if (docuType)
            return docuType.TypeId;
        else
            return "@SYS13887";
    }
    /*
    Note that this can find more than one record !
    */
    static DocuType findGroup(
        DocuTypeGroup   _docuTypeGroup,
        boolean         _forUpdate  = false
        )
    {
        DocuType    docuType;
        ;
    
        docuType.selectForUpdate(_forUpdate);
    
        select docuType
            index hint GroupIdx
                where docuType.TypeGroup == _docuTypeGroup;
    
        return docuType;
    }

    It appears you used to be able to set your default Document type using the Setup button at the top of the document handling form, but the code in the dialog method that would present this to the user has been commented out.  Perhaps if you re-enable that code, you'll get something useful out of it.

    // <summary>
    ///    Returns a class that contains the methods that are described by the <c>RunBaseDialogable</c>
    ///    interface.
    /// </summary>
    /// <returns>
    ///    A class that contains the methods that are described by the <c>RunBaseDialogable</c> interface.
    /// </returns>
    /// <remarks>
    ///    A dialog can be either built by using the <c>Dialog</c> class or by using a class that is created
    ///    in the Application Object Tree (AOT).
    /// </remarks>
    public Object dialog()
    {
        DialogRunbase dialog = super();
    ;
        dialogAllUser = dialog.addField(enumStr(AllUser),"@SYS25695", "@SYS25401");
        dialogAllUser.value(showAllUser);
    
        // Syp Modifications - SP2 [R-DEN-DDSP-GIJE-02770][V-ALEXA] - BEGIN
        // dialogDefaultTypeId = dialog.addField(extendedTypeStr(DocuTypeId),"@SYS26730", "@SYS28735");
        // dialogDefaultTypeId.value(defaultTypeId);
        // Syp Modifications - SP2 - END
    
        dialogShowOnlyRef = dialog.addField(enumStr(NoYes),"@SYS28734", "@SYS28736");
        dialogShowOnlyRef.value(showOnlyRef);
    
        dialogShowImage = dialog.addField(enumStr(NoYes),"@SYS54226", "@SYS55303");
        dialogShowImage.value(showImage);
    
        return dialog;
    }
    

    If you decide to try that, don't forget to also fix the getFromDialog() method.

    boolean getFromDialog()
    {
        showAllUser     = dialogAllUser.value();
    
        // Syp Modifications - SP2 [R-DEN-DDSP-GIJE-02770][V-ALEXA] - BEGIN
        // defaultTypeId   = dialogDefaultTypeId.value();
        // Syp Modifications - SP2 - END
    
        showOnlyRef     = dialogShowOnlyRef.value();
        showImage       = dialogShowImage.value();
    
        return true;
    }
    

    Hope this helps.

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    Or, you could rename your new Document type from "F Note" to "NoteF" and take advantage of the apparently alphabetical nature of the standard behavior.

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