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

Community site session details

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

Access modifiers in X++

(1) ShareShare
ReportReport
Posted on by 438
I don't why I'm faceing these errors  
 
 
public class XDSSalesTableRegular extends common
{
    XDSSalesTableTmp xDSSalesTableTmp;
 
     private void insertUserInfoIntoTmp(UserGroupId _userId,str _field,str _value)
    {
        xDSSalesTableTmp.clear();
        xDSSalesTableTmp.UserId = _userId;
        xDSSalesTableTmp.Field = _field;
        xDSSalesTableTmp.Value = _value;
        xDSSalesTableTmp.insert();
    }

    public XDSSalesTableTmp populateUserRangesForSalesTable()
    {
        DYNADDVTable         dYNADDVTable;

        while select dYNADDVTable
            where dYNADDVTable.TableOption == DYNADDVTableOption::SalesTable
        {
            if(dYNADDVTable.UserType == DYNADDVUserType::UserGroup)
            {
                DYNADDVUserGroupTable dYNADDVUserGroupTable;

                while select dYNADDVUserGroupTable
                    where dYNADDVUserGroupTable.GroupId == dYNADDVTable.UserGroupId
                {
                    this.insertUserInfoIntoTmp(dYNADDVUserGroupTable.SysUserId,dYNADDVTable.Field,dYNADDVTable.Value);
                }
                continue;
            }

            this.insertUserInfoIntoTmp(dYNADDVTable.UserGroupId,dYNADDVTable.Field,dYNADDVTable.Value);
        }

        return xDSSalesTableTmp;
    }
}
 
I have the same question (0)
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Access modifiers in X++
    Hi Abdullah,

    As your visual studio screenshot is not fully visible, are you getting any red lines errors in this method "populateUserChangesForSalesTable"?

    also just to confirm, I'm assuming XDSSalesTableRegular is an actual table while XDSSalesTableTmpTable is either inMemory or TmpDB?
  • Verified answer
    Martin Dráb Profile Picture
    237,693 Most Valuable Professional on at
    Access modifiers in X++
    The title is misleading - it has nothing to do with access modifiers.
     
    The problem is that tables can't have instance variables, therefore your declaration of xDSSalesTableTmp variable is invalid. Declare variables inside methods (a local variable in populateUserRangesForSalesTable() and as a method parameter in insertUserInfoIntoTmp()).
  • Waed Ayyad Profile Picture
    9,023 Super User 2025 Season 2 on at
    Access modifiers in X++
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Access modifiers in X++
    Is the model in which the xds tables are added is added as a reference to your custom model?
  • AbdullahAhmed_ Profile Picture
    438 on at
    Access modifiers in X++
    Thank you all.. the issue is resolved. Can someone please check Martin's answer as verified!

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 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans