Notifications
Announcements
No record found.
Hey Team,
I'm working with the dialog form for the first time and I have a parent form whose action pane consists of a button (action menu item) which when clicked opens a dialog form to change the field "End Date". Now this dialog form consists of field like "Personnel Number, FirstName, LastName" which are not editable and these values should come from the parent form, but in my case when I select a record from the parent form and click action menu item the dialog forms shows the values for "FirstName, LastName" from the data source table(first record in the table) and not the selected record also Personnel Number value is not visible. How can I solve this issue? I want the dialog form to have information of the selected record from the parent form.
You can get the selected record from the parent form by calling this.args().record() in the dialog form (e.g. in init() method). Then you must somehow use data from it in your dialog fields.
One option is using unbound fields populated from code. Another is using a data source and adding a filter (e.g. for RecId) based on the record you receive.
Hey Martin Dráb ,
Could you please elaborate how to use this.args().record() .
I wrote it in the init() method of dialog form but couldn't get the desired output. Can you please tell me where I'm going wrong?
public void init() { super(); this.args().record(); }
record() gives you the data, but you completely ignore the return value, therefore the call has no effect.
Before writing any code, you must decide what you want it to do. I mentioned two possible ways above - choose one of them. (There are more possible solutions, but let's keep it simple).
Hey Martin Dráb,
Can we go with this way: " using a data source and adding a filter (e.g. for RecId) based on the record you receive"? If yes, pls help me, how can I go ahead with this approach?
How are you opening the dialog form? Are you using a menu item button? Is the the same table or are those two different tables?
I'm asking because you should normally get a dynamic link that that do the filtering automatically.
If we get this working, you won't have to write any code at all.
YEs I'm using the action menu item. The dialog form has two tables both of the parent form table datasource.
I tried to take some reference from the standard forms available and tried this and it worked. Is this right the way I have done it?
public void setHcmWorker(HcmWorkerRecId _WorkerRecId) { QueryBuildRange qbr; mytable_ds.query().clearQueryFilters(); mytable_ds.query().dataSourceTable(tableNum(mytable)).clearRanges(); qbr = mytable_ds.query().dataSourceTable(tableNum(mytable)).addRange(fieldNum(mytable, RecId)); qbr.value(int642str(_WorkerRecId)); mytable_ds.executeQuery(); } public void init() { super(); if (element.args() && element.args().record() && element.args().record().TableId == tableNum(mytable)) { element.setHcmWorker(element.args().record().RecId); } }
Yes, it's a possible way (if you don't want a dynamic link), although your code is over-complicated. Also, calling executeQuery() from init() is wrong. I would change the method to this:
public void setFilter(RecId _myTableRecId) { QueryBuildRange recIdRange = myTable_ds.queryBuildDataSource().addRange(fieldNum(MyTable, RecId)); recIdRange.value(queryValue(_myTableRecId)); }
Thank you so much.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional