Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Access modifiers in X++

(1) ShareShare
ReportReport
Posted on by 190
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;
    }
}
 
  • AbdullahAhmed_ Profile Picture
    AbdullahAhmed_ 190 on at
    Access modifiers in X++
    Thank you all.. the issue is resolved. Can someone please check Martin's answer as verified!
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,609 Super User 2024 Season 1 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?
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,360 Super User 2024 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
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,370 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()).
  • Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 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?

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans