Hello all. I have a detail page form that allows you to open a child record ("Attributes") of a parent table ("Customers") to make changes and submit them to the DB. No problem there.
However, I'd like to utilize this layout to submit a new "attributes" record for this customer as well. My "Save" button simply passes the "Attributes" entity for the server side update. But if I want to add a new "Attribute" record for that customer, I cannot just pass the "attributes" entity because it will pass a blank customer ID.
How do I pass the "attributes" entity to the server side CRUD script but append to it the customer ID I want that newly created record to have?
I know I can create a dozen input paramaters to explicitly pass all the new information along with the existing customer ID but I wanted to see if there is a way to do this without needing to specify the fields.
Hi Richard,
The easiest way is to add some client-side logic to the Save action before calling the server action. You can modify the record you're about to pass, so it will contain all the necessary data.
So utilizing client side action, I can set the value of IdentityID to my desired value utiling an Assign widget....thank you!
Hi @Richard Dwyer,
Not sure if I understood your question correctly, but for every entity OutSystems provides us with a CreateOrUpdate<EntityName> server action. You can make use of it in your CRUD wrapper action if not already implemented.
This action will create a new record with new Id when the source attribute Id is null. For detail information please check out the below link -
https://www.outsystems.com/forums/discussion/85614/real-time-examples-to-use-create-entity-action-over-createorupdate/
Please let us know if this helps. If not please attach an oml for your query.
Thanks
Rahul Yadav
I can update an existing record....that works now. I can create a new record, that works as well. But the newly created record has a field called "IdentityID" that I want to set upon creation. For a newly created record in the "Attributes" table, how do I pass the server side script the Identity ID value I want to pass it?