insert_ recordset - query


im working on Ax 4.0 im trying to insert a record from the table A to B both are similar struction.

i can use insert_recordset command to insert. but my doubt is… my table is having many fields… all needs to be inserted into B.

syntax of Insert_recordset is

Insert_recordset B (field list) select fieldList from A where …

in the fieldList i need to specify all the column names. so in future if i added any field there then i need to add it here also. so to avoid this problem… can v have any way to insert all the values with out specifying column list. just select and insert like that… ?

Pls help me to overcome this.



Pls do the needful

When you are able to add a field to the table - what problem you have in adding it to the list?

you might want to use the reflection , you need to use the SysDictTable and sysDictfield class to write the generic logic to insert all the field from Table A to Table B


YEs i can add the field required. But the problem is, when we will create new fields in future may be after some months i should remember these are all the place i have to do modifications. :slight_smile: if i put like select * … then no need to think about where I missed like that. automatically it will take all the fields and update all. This is the reason why I’m searching for the option.

Thanks for your reply. If you find any solution pls let me know.

I have one more doubt. I created a query dialog to get a input for main form. for example: in query dialog i\m getting 2 fields like billno and issuedate. based on that when i’m clicking ok button it gives the output in main form. Now is there any way to make these 2 input fields as mandatory or is there any way to check whether that 2 input fields have values or not , if yes it has to open form else it has to throw error.

let me know, if any one knows solution.



if anyone knows pls do the needful

Hi Maria,

In the getFromDialog() method,check the validation for these two fields billno and issuedate[dialogbillno & dialogissueDate]…try this…
if(!dialogbillno.value() || !dialogissueDate.value()
throw error(“values need to be filled in”);

Naresh Kolli

Thanks for your reply. I have asked for SysQueryForm validation.

if you know, pls let us know