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, ...
Answered

Access modifiers in X++

(1) ShareShare
ReportReport
Posted on by 525
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;
    }
}
 
  • Layan Jwei Profile Picture
    8,428 Super User 2026 Season 2 on at
    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
    241,635 Most Valuable Professional on at
    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,224 Super User 2026 Season 2 on at
    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
    Is the model in which the xds tables are added is added as a reference to your custom model?
  • AbdullahAhmed_ Profile Picture
    525 on at
    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287 Super User 2026 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 232 Most Valuable Professional

#3
Aayush Tiwari Profile Picture

Aayush Tiwari 222

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans