Looking for a best practice approach
I have 2 entities, Book and Author
Book has a N:1 Relationship with Author, Many books, 1 author
I have a screen that is "Add a book"
It searches the google book API and returns books in a gallery.
In the Gallery Items I have an "Add to database" button that I want to add the book title, author and other information into the Book Entity.
My question is, what is the best approach for adding the Author Information into the second entity and relating it back to the item in the book?
I have tried to do Patch, lookups, relate, find and I just can't seem to get this correct. Maybe I am using the wrong approach here?
You have to create the Author record first (or find the Author record if it’s available in database already) and store the created Author record in a global variable. Then while creating child Book records, associate the Author lookup from the global variable. Read more
Set(recAuthorRecord, Patch(Authors, Defaults(Author), {lastname: "Author Name"}));
Patch(Books, Defaults(Book), {bookname:"Book Name", Book_Author: recAuthorRecord});