Announcements
I create a job in x ++. I would like the dialogfields inside the dialog to remember what the user entered for later (until the next Job launch)
How to do it?
Does Ax2012 have mechanisms to remember user variables?
Or do I need to write values to files on disk, or to the windows registry?
Best regards
Tom
Good point of view. I will think about it next time
This code is for the IT department only. It has historically been a practice in the IT department to use Jobs to automate activities. It has remained so far
Thank you for replies :)
Yes, it only works in a class because you need to extend RunBase. Why are you using a job for something that is executed often? You should develop a class, link it to a menu item, menu, security and so on. Jobs are not intended for implementing actual business operations.
I didn't understand this part and missed it.
Now I understand a little, but does it all only work inside classes?
[SOLVED
I made progress and found another solution using xSysLastValue.
I present a solution for other interested people:
DialogRunbase dlg; DialogField txtDim, lstWorker; container conValues; dlg = new Dialog("Title"); txtDim = dlg.addField(extendedTypeStr(Comments_JP), "Parameters"); lstWorker = dlg.addField(extendedTypeStr(HcmWorkerRecId), "Select worker"); conValues = xSysLastValue::getValue(curExt(), curUserId(), UtilElementType::Job, "SaveLastValue"); if (conValues != conNull()) { txtDim.value(conPeek(conValues, 1)); lstWorker.value(conPeek(conValues, 2)); } if (dlg.run()) { conValues = conNull(); conValues = txtDim.value(); conValues = lstWorker.value(); xSysLastValue::putValue(conValues, curExt(), curUserId(), UtilElementType::Job, "SaveLastValue"); }
It works ok
Did you find the tutorial class? Pay attention to the CurrentList macro in class declaration (define list of variables to be stored), as well as pack (saving values) and unpack (fetching old values) methods.
DialogRunbase dlg; DialogField txtDim, lstWorker; dlg = new Dialog("Title"); txtDim = dlg.addField(extendedTypeStr(Comments_JP), "Parameters"); lstWorker = dlg.addField(extendedTypeStr(HcmWorkerRecId), "Select worker"); dlg.run();
I made DialogRunbase like this.
It doesn't remember the values the next time it is started
What is missing?
You should use RunBase or SysOperation framework, then the last values are stored automatically.
Check class Tutorial_RunBaseBatch.
Hi Tom,
Assuming you are talking about X++ job, I don't think you can save the last values.
André Arnaud de Cal...
294,161
Super User 2025 Season 1
Martin Dráb
232,942
Most Valuable Professional
nmaenpaa
101,158
Moderator