lschaaf Posted June 23, 2008 Share Posted June 23, 2008 I'm having trouble getting this to work and wonder if I'm using the wrong tool. I currently have a list of Customers who each have a list of Clients. These clients will have one or more mailing programs assigned to each one. Currently I have a CUSTOMER layout w/a button to Go to Related CLIENT layout (selecting Related Record from "Client" table option and Go to "Client" layout). My problem is if there are no clients assigned to the customer, the button won't let me go to the layout to add new clients. Should I be using a portal instead and then selecting the client layout from the portal? Or maybe I just have it set up wrong! I have a primary Customer_ID (from Customer table) linking to a foreign Customer_ID in Clients Table. In the Clients fields, the foreign Customer ID is set as an auto entry calculation: Customer_ID=Customer::Customer_ID Before I made the button on the CUSTOMER layout a Go To Related Record and just used Go To Layout, I could enter clients, but when I looked at them, there was nothing auto-entered in the Client's foreign Customer_ID field. I deleted all my test clients and started using the Go To Related Record button and now I can't get to the CLIENT Layout! I hope it's a simple answer. Most samples with similar relationships were using portals, so maybe I'm just doing it wrong. I just think my CLIENT layout looks better than the portal! Link to comment Share on other sites More sharing options...
AHunter3 Posted June 23, 2008 Share Posted June 23, 2008 Write a script and attach the script to your button instead: If (count (Clients::Serial Number)>0] .. Go to Related Records [show only, Clients, using layout "Clients"] .. Exit Script End If Show Custom Dialog ["No clients yet. Create one now?" OK / Cancel] If (Get(LastMessagechoice) = 2] .. Exit Script End If Set Variable [$Customer ID, Customers::Serial Number] Go to Layout [Clients] New Record/Request Set field [Clients::Customer ID, $Customer ID] Commit Record Link to comment Share on other sites More sharing options...
lschaaf Posted June 23, 2008 Author Share Posted June 23, 2008 Thanks a bunch, of course it works perfect! Link to comment Share on other sites More sharing options...
Recommended Posts