Creating a record via script and ensuring referential integrity
Consider the tables Contacts and Requests. One contact can have many requests, thus Contact::ID = Request::ContactID as a relationship allowing creation of records in both tables via this relationship.
In the current setup I have currently a portal where I can enter both Contact::(fields) as well as Request::(fields). A new record is created in Request provided I have created a new Contact automatically. Works fine.
I am redesigning the application so that the user gets a list of all requests in the dialog for contacts. The user can either click on an existing request of the list and it jumps to a window with a modal dialog for Request::(several fields) and works fine.
I have also a button for the creation of new requests for an existing contact. Clicking the button in the Contact dialog triggers a script that is supposed to create a new Request:: record. The script does the following:
Go To Related Record (from table: „Request“ using layout „“W_ProcessRequest“); New Window)
New Record Request
Apparently the relationship between both tables is not active, because although the new record is created in Request, the associated Request::ContactID is not created automatically. What do I need to do in order to create a new related record in Request while at the same time ensuring referential integrity (the relationship is there already) ?