Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Get a value that some user set in a class dialog field (SysLastValue)

Posted on by 15

Hello people, 

how can I get what user has set in a class dialog field? (the class extends runbasebatch, the variable I am interested in is also in a CurrentVersion(1) macro) 

i believe it may look something like this: (but this just gives me a 1, i don't know, how to show the value of a dialog field)

static void getSysLastValue(Args _args)
{
container lastValues;
RunBaseBatchExtendedClass extClass = new RunBaseBatchExtendedClass();
;

lastValues = xSysLastValue::getValue(curext(), 'userId', UtilElementType::Class, classStr(RunBaseBatchExtendedClass));

extClass.unpack(lastValues);

info((strFmt('%1', conPeek(lastValues, 1))));
}

thanks

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Get a value that some user set in a class dialog field (SysLastValue)

    Then you need to add such method, as Martin mentioned.

  • edgcibu Profile Picture
    edgcibu 15 on at
    RE: Get a value that some user set in a class dialog field (SysLastValue)

    Thanks Martin,

    No, the class didn't have the parm method for the variable.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,251 Most Valuable Professional on at
    RE: Get a value that some user set in a class dialog field (SysLastValue)

    You unpack variables to extClass object, which is the right approach. But then you completely ignore this object and you're trying to part the container by yourself, which is wrong.

    Let's say you're interested in variable myData1 in RunBaseBatchExtendedClass. After you call extClass.unpack(lastValues), myData1 variable is set (in extClass object). All you need to do it extract it from there, usually by a parm method. Like this: extClass.parmMyData1(). If you the class doesn't have any suitable method, you'll have to add it.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans