I have two content types: Account and Contact. The contacts type has an entity reference to the Accounts type. I have the module, entity prepopulate, installed and enabled for the contact type. I've attached a view to the account type using the EVA module that lists all related contacts and provides an "add new contact link".

This link is just an overridden field that outputs content along the lines of:

<a href="/node/add/contact?field_account_from_contact=[nid]">Add New Contact</a>

Technically, everything is working fine, but one thing bugs me. If I'm viewing an account and I click the link to add a new contact and save down the new contact form, the browser directs to the newly created contact page. Imagine how annoying this is for users.

  1. I create a new account. Browser presents me the newly created account page.
  2. I click add a new contact and create a contact. Browser presents me the newly created contact page.
  3. I now have to click the back arrow in the browser a few times to get to the account page and refresh it.
  4. I click add a new contact and create a contact. Browser presents me the newly created contact page.
  5. I now have to click the back arrow in the browser a few times to get to the account page and refresh it.
  6. I click add a new contact and create a contact. Browser presents me the newly created contact page.
  7. I now have to click the back arrow in the browser a few times to get to the account page and refresh it.

As you can see, this becomes a workflow nightmare. Is there anyway, I can have the browser automatically redirect to the original account page after creating a related contact?

Comments

So I fixed the issue when

So I fixed the issue when creating a new contact by doing the following:

I changed the custom link to <a href="/node/add/contact/[nid]?field_account_from_contact=[nid]">Add New Contact</a>

Using Rules I setup the following:

Event: After new content is saved
Condition: Content is of type - Contact
Action: Page Redirect - Redirect to drupal_lookup_path('alias',"node/" . arg(3) );

So far this is working just fine. Now, I just need help figuring out how to do this when viewing/editing a contact.

nobody click here