AnsweredAssumed Answered

Script to relate existing record

Question asked by atlantisrk on Jun 28, 2018
Latest reply on Jun 28, 2018 by philmodjunk



I have two tables, Companies and People, and they are related using the CompanyIDfk in the People table (one to many relationship). I have turned off the ability to allow the creation of People through the relationship as I want scripted buttons to allow this instead.


I have a portal on the Companies layout to show people that work for the company. I have a scripted button to create a new related person. I would also like a button to relate an existing person to the company.


I have been trying to use a value list on a People::CompanyIDfk field in the portal based on Company::CompanyID and People::Name in order to select which person works at the company, but it doesn't work how I want it to as a portal shows records already related. How can I provide a list of existing people for the user to select and, in doing so, create the relationship by setting the CompanyIDfk?


Many thanks.