Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

problem with changing enum value The record has never been selected

(0) ShareShare
ReportReport
Posted on by 2,030

Greeting everyone

i've created a new form with that now i'm trying to change the statues on that form so i've created a new enum

pastedimage1613030842684v1.png

and i've crated action menu for every status as you see here below

pastedimage1613030955774v2.png

also i've created class for those actions

static void main(Args _args)
{
    GovernmentIdTransStatus   governmentIdTransFlow;
    GovermentIdTrans                   argsGovermentIdTrans, govermentIdTransTmp;
    FormDataSource                  fds;


    if (_args.record().TableId == tableNum(GovermentIdTrans))
    {
        argsGovermentIdTrans = _args.record();

        if (_args.parmEnumType() != enumNum(GovernmentIdTransStatus))
        {
            throw error("@SYS104799");
        }

        governmentIdTransFlow = _args.parmEnum();

        ttsBegin;
            govermentIdTransTmp.SubmitStatus = governmentIdTransFlow;
            govermentIdTransTmp.doUpdate();
        ttsCommit;

        fds = argsGovermentIdTrans.dataSource();
        fds.research(true);
    }

    else
    {
        throw error("@SYS104799");
    }

}

when i pressed on anyone of those status i've got error message

Cannot edit a record in GovermentIdTrans (GovermentIdTrans).
The record has never been selected.

how can solve this problem? 

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: problem with changing enum value The record has never been selected

    In your code you introduce govermentIdTransTmp table buffer but you never initialize it.

    You put _args.record() to argsGovermentIdTrans, but then you try to update govermentIdTransTmp.

    Perhaps you need to clarify what you are trying to do?

    But you can't update a table buffer without selecting / assigning some record   into that buffer first.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,044 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans