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

How to prevent a class executing default case in Switch case using Extension

(0) ShareShare
ReportReport
Posted on by 15

Hi Guys,

I want to add a new switch case in this method getColumnFilterTableFieldMappingForRowElement from this class BudgetPlanLineFieldFilterMapping. So I added a new switch case in that method using Chain of Command. After my code was executed it keeps executing the default case in that method. I don't know how to prevent that. please help me out here.

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can't prevent it.

    But, you can create an extensibility request for Microsoft in Lifecycle Services. There's a request type just for these cases (default case which throws an error).

    docs.microsoft.com/.../extensibility-requests

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    However in this particular case you can work around the issue in your code. You can use this workaround until Microsoft hopefully reacts to your extensibility request and changes the standard code.

    Something like this:

    public static container getColumnFilterTableFieldMappingForRowElement(FieldName _fieldName)
    {
        container retCustom;
        container retStandard;
        FieldName fieldNameLocal;

        if (_fieldName == fieldStr(BudgetPlanLine, MyCustomField))
        {
            fieldNameLocal = fieldStr(BudgetPlanLine, Comment); // Use just something that doesn't cause exception
            retCustom = [tableStr(BudgetPlanLine), fieldStr(BudgetPlanLine, MyCustomField)];
        }
        else
        {
            fieldNameLocal = _fieldName;
        }
       
        retStandard = next getColumnFilterTableFieldMappingForRowElement(fieldNameLocal);

        if (conLen(retCustom) > 0)
        {
            return retCustom;
        }
        return retStandard;
    }

  • Mohamed Ibahim Profile Picture
    15 on at

    Hi Nikolaos,

    It's working fine now, thank you very much.

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

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans