I have table1 and table 2 and they have the relation as follows:
table2.RefRecIdfield == table1.RecId
I need to populate the RecId field using X++ Code. Can someone suggest the code?
I see you've created a follow-up thread: How do i use the "InsertEntityToDataSource" method on parent table to populate the RefRecid of Child table using RecId of Parent table.
Does it mean that we're done in this thread? Didn't you forget to mark verify the answer?
My first reply really tells you the solution. If you need more detailed help, please share more details about your requirement. But if you already shared the actual requirement, then your initial question already contains the solution, just remove one '=' symbol and your code is ready. Well you need also a semicolon (;) in the end of the line.
Sorry, my bad i think the otherwise but yeah i need to populate the RefRecId of table2 with RecId of table1.
Can you please suggest me the X++ code for the same?
Your relation shows something else that you say you need.
You should populate RefRecIdField if Table2 with RecId of Table1.
Your request to populate Table1.RecId field from Table2.RecId makes no sense. You can't assign RecId, you don't want the same RecId in both tables and the request completely ignores RefRecIdField.
Create a record in Table1 - the system will populate RecId on insert. Then use this value in Table2.RefRecIdField.
" table2.RefRecIdfield == table1.RecId" this is the relation between the 2 tables. I need to populate the RecId field of table1 from RecId field of table2 , can you please suggest the code for that?
Hi,
just remove one of the"=" symbols from your code and you're there.
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 Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 846 Super User 2025 Season 2
CA Neeraj Kumar 838
Sohaib Cheema 818 User Group Leader