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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Extension of formDataSource field

(0) ShareShare
ReportReport
Posted on by 1,552

Hi,

I did a duplicate of the standard field CategoryRecId in CaseDetailBase and i'm trying to call the same logic that gets called for it in CaseDetailForm -- but i'm getting errors

when doing this

[ExtensionOf(formDataFieldStr(CaseDetailCreate, CaseDetailBase, CaseCategoryRecIdCopy))]
final class CaseDetailCreateFormDataSourceField_Extension
{
    public Common lookupReference(FormReferenceControl _formReferenceControl)
    {
        next lookupReference(_formReferenceControl);

        return CaseDetailForm::lookupCategoryTree(_formReferenceControl, CaseDetailBase, categoryType);
    }
}


I'm getting those two errors:
pastedimage1684707768877v1.png

And when doing this, I'm getting those errors:
[ExtensionOf(formDataFieldStr(CaseDetailCreate, CaseDetailBase, CaseCategoryRecIdCopy))]
final class CaseDetailCreateFormDataSourceField_Extension
{
    public Common lookupReference(FormReferenceControl _formReferenceControl)
    {
        next lookupReference(_formReferenceControl);

        Args                args;
        FormRun             formRun;
        
        args = new Args();
        args.name(formStr(CaseCategoryLookupCopy));
        args.record(caseDetailBase); //error on caseDetailBase

        if (categoryType)
        {
            CaseDetailForm::updateArgsFromCategoryType(categoryType, args); // error here

            args.parmEnumType(enumNum(CaseCategoryType));
            args.parmEnum(enum2int(categoryType));
        }
        
        formRun = classfactory.formRunClass(args);
        formRun.init();
        formRun.selectRecordMode(_formReferenceControl);
        _formReferenceControl.performFormLookup(formRun);
        formRun.wait();
        
        return formRun.selectRecordModeSelectedRecord();
    }
}


pastedimage1684707800629v2.png

what to do with the delegate method?

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    Hi,

    Use element.CaseDetailBase to get the current record. Also, for getting the categorytype there is a parm method on form method parmCategoryType - Use this method to get a category type.

    Thanks,

    Girish S.

  • junior AX Profile Picture
    1,552 on at

    Hi Girish,

    Do you mean element.parmCategoryType?

    How about the last error related to delegate method?

  • GirishS Profile Picture
    27,833 Moderator on at

    Yes, you need to use element type.

    I am not sure about that error. May be use of delegate call in extension is not possible in the context.

    Thanks,

    Girish S.

  • junior AX Profile Picture
    1,552 on at

    Hi Girish,

    But what to replace the delegate code with? As i'm duplicating what the standard does to get same result

  • GirishS Profile Picture
    27,833 Moderator on at

    Definition for this delegate method is available in CaseDetailFormEventHandler >> CaseDetailForm_updateCaseDetailQuery.

    You can try the logic as given in the method in your extension class.

    Thanks,

    Girish S.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 577 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans