How to go to the next object in a layout using script trigger
I am trying to add multiple address of a user into the layout. In the original layout, I am trying to fill some information of a individual user which has address field through a portal. I created a search button, which takes user for searching an existing address in the database and insert the value back into the original layout. I did succeeded implementing it, Now the challenge is to store multiple address, If I search again for an existing address it replaces the existing address which I searched already, instead of adding value to the new object in the layout. I need to find a way to determine if the object 1 is empty or not, if it is empty it should insert the value, if not it should go for the next object and insert it.