I have a form where I can create/ update a record, and based on this action I need to update the record in another form which stores the Primary Key of the initial form and whether the field is updated or created. I am new to D365 F&O and not sure which functions/ code to use here. Can anyone please help me out?
First of all, focus on tables, not forms. Forms are used only for displaying data to users, but storage and related logic happen in tables.
You can utilize insert() and update() methods on the table (or corresponding events) and there you already know whether it's an insert or an update. Then you call a common logic with parameters distinguishing these two cases.