function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
annoyingmouseannoyingmouse 

Make a new object on another objects page

Hi there,

I've a junction object between two custom objects (Person and Address, the junction object is called Person Address). Thus I've a many-to-many object.

I've got the Person page layout to display the list of Addresses associated with the Person, I'm not so bothered about the Address page displaying Persons!

I can associate a Person with an Address only when the Address has already been created. Is it possible to create a new Address whilst still on the Person page?

I'm thinking it is though it might require a custom VisualForce page, not an issue but a pointer in the right direction would be very helpful. I've been scouring Google for ages but my Google-foo must be lacking as I'm not able to see anything quite like what I need :-(.

Thanks in advance

Dom

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

You can create a custom button on the person object .when user click on the custom button user will redirect on the address creation page

 

For creating a custom button follow the below steps:

  1. First of all copy the url of the new creation of the address
    For example:   https://ap1.salesforce.com/a03/e?
  2. Now create a custom button
    Setup->create-> Objects->click on person object->click on new button present in Custom Button or Link
  3. Enter the Label and name of the custom button
  4. Select Detail Page Button as Display Type
  5. Select Display in new window as Behavior
  6. Select URL as Content Source
  7. Paste coped url in the blank space
  8. And save the button
  9. Add the custom button on the person page layout.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

 

All Answers

goabhigogoabhigo

You can achieve this using a trigger on Person Address object. But for that there should be some unique identifier for address. So basically the trigger will check for it and if not found in the DB it will create new one. Now here question arises as to what information can be put in Address. Then you might have to use a VF page with help of apex controller. So when there is no match found for the current address, popup a new window for Address creation.

annoyingmouseannoyingmouse

Hey there,

 

thanks for the reply. I'm thinking that I need to add something to the Person page so that I can automagically create another Address and then select it in the Address Lookup field but I'm looking for an example. Do you know of one at all?

 

Thanks again,

 

Dom

Navatar_DbSupNavatar_DbSup

Hi,

You can create a custom button on the person object .when user click on the custom button user will redirect on the address creation page

 

For creating a custom button follow the below steps:

  1. First of all copy the url of the new creation of the address
    For example:   https://ap1.salesforce.com/a03/e?
  2. Now create a custom button
    Setup->create-> Objects->click on person object->click on new button present in Custom Button or Link
  3. Enter the Label and name of the custom button
  4. Select Detail Page Button as Display Type
  5. Select Display in new window as Behavior
  6. Select URL as Content Source
  7. Paste coped url in the blank space
  8. And save the button
  9. Add the custom button on the person page layout.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

 

This was selected as the best answer
annoyingmouseannoyingmouse

Hi Ankit,

 

that's lovely and your instructions were very clear, thank you.

 

Not quite what I was looking for but it will do as a stop gap.

 

What I want is to do within a block of ajax so I guess I'll have to work on it some more.

 

In the meantime if anyone else has any other ideas I'd be grateful.

 

Thanks again,

 

Dom