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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Table Display Method Extension

(5) ShareShare
ReportReport
Posted on by 1,276
Hi Community,

I'm trying to extend the display method from the table "TrvExpTrans" and receiving an error during the build.
 
 

Error message 
 

Display methods can take only optional arguments, other than the first argument which can be a table


Display method
 

public display boolean isEditable(boolean _checkUserAccess = true, boolean _splitLineTypeCheck = true)

{

    if (_splitLineTypeCheck && this.SplitLineType == TrvExpSplitLineType::SplitHeader)

    {

        return false;

    }

 

    switch (this.ApprovalStatus)

    {

        case TrvAppStatus::Approved:

        case TrvAppStatus::Cancelled:

        case TrvAppStatus::Ledger:

        case TrvAppStatus::Pending:

        case TrvAppStatus::Submitted:

        case TrvAppStatus::Ready:

        case TrvAppStatus::None:

        case TrvAppStatus::Matched:

            return false;

    }

 

    return _checkUserAccess ? TrvAccessHelper::canCreateNewTransactions(this.CreatingWorker) : true;

}

COC Method


public display boolean isEditable(boolean _checkUserAccess, boolean _splitLineTypeCheck)

{
boolean ret;
ret = next isEditable(_checkUserAccess, _splitLineTypeCheck);
return ret;
}

 
 

 
Categories:
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    305,747 Super User 2026 Season 1 on at
    Hi Subra,

    I haven't extended display methods myself. You can try to edit your method variables to make them optional as mentioned in the error message. You can do this by adding a default value for the variable E.g. add "= true
     
    public display boolean isEditable(boolean _checkUserAccess = true, boolean _splitLineTypeCheck = true)
    {
    boolean ret;
    ret = next isEditable(_checkUserAccess, _splitLineTypeCheck);
    return ret;
    }
     
  • Subra Profile Picture
    1,276 on at
    Hi Andre,

    Already I have tried the same and it was not working as we expected. It was not allowing as add optional parameters in the COC methods.

    Error message 
     
    Default parameter values on chain of command methods may not be provided on the corresponding extension methods. Make the parameter on the extension method non-default, omitting the default value.
  • Deepak Agarwal Profile Picture
    9,065 on at
    This is a tricky situation, your main display method have optional parameter, while in COC they way we need to define method, the parameters become mandatory, hence you are getting the error of option parameter. 
     
    At the same time you can not just remove the parameters from your COC as this will break coc syntax. 
     
    Sounds like something new to learn :) 
  • Subra Profile Picture
    1,276 on at
    Hi @Deepak Agarwal

    Yes It's new learning and Usually display method will have table is the first parameter and I hope it's bug from MS or there will be some different approach for this issue.

     
  • André Arnaud de Calavon Profile Picture
    305,747 Super User 2026 Season 1 on at
    Hi Subra,
     
    An alternative method is duplicating the display method in your model and then add your condition to it.
  • Subra Profile Picture
    1,276 on at
    Hi Andre,

    Thanks for your insights!
     
    Already I have checked this and duplicating display method will not work for my business requirements.

     
  • Verified answer
    Subra Profile Picture
    1,276 on at
    Hi @André Arnaud de Calavon @Deepak Agarwal

    I have removed the display keyword in the extension method and it's works fine.




     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 413

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans