Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Access modifiers in X++
Finance forum
Answered

Access modifiers in X++

Posted on by 60
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_ 60 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,566 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?
  • Waed Ayyad Profile Picture
    Waed Ayyad 5,416 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 228,441 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,064 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans