Problem/Motivation

Upon creating a Contact, it takes 4 steps to get to a contact add form: Content -> CRM -> Add contact -> (select bundle).

Creating contact after contact will be a common scenario that we should optimize for.

Proposed resolution

Add two (secondary) buttons:

  • "Save and add another [Type]" -> /crm/contact/add/[type]
  • "Save and add another Contact" -> /crm/contact/add

This reduces the steps to a contact add form down to 1-2.

Original report

Problem/Motivation

Right now in order to create multiple contacts, I have to click out to the Admin Content menu, then the CRM tab, and then the Add Contact button, and then the kind of contact you want each time. This quickly gets pretty annoying, and is something the typical end user will have to do a lot.

Proposed resolution

Change the Status Message that pops up after you create a contact to include links to add the different kinds of contacts

Issue fork crm-3542318

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

speckles created an issue. See original summary.

speckles’s picture

Title: Repeatedly adding CRM contacts is annoying » Change the Status Message that pops up after you create a contact to include links to add the different kinds of contacts
jdleonard’s picture

I feel like the status message could get overwhelming if it includes links for each Contact Type.

What if we added two buttons to the Contact add form?

  • "Save and add another [Type]" -> /crm/contact/add/[type]
  • "Save and add another Contact" -> /crm/contact/add

jdleonard’s picture

Status: Active » Needs work

Created a draft MR to add those buttons. Both buttons were working for me, but now only one of them is and I can't figure out why. Could use some fresh eyes!

bluegeek9’s picture

Maybe this should be the same as add Taxonomy term form:
'Save' and 'Save and goto list'.

bluegeek9 changed the visibility of the branch 1.0.x to hidden.

jdleonard’s picture

Title: Change the Status Message that pops up after you create a contact to include links to add the different kinds of contacts » Reduce steps to add another contact
Assigned: Unassigned » jdleonard
Issue summary: View changes

I like the idea of following an existing pattern. However, a key difference here with adding a taxonomy term is that from the list of taxonomy terms, there is one button to get back to the term add form whereas for contacts, the button takes you to `/crm/contact/add`, which then requires you to make another selection (a bundle).

I agree with @speckles that creating contact after contact will be a common pattern and is worth optimizing for. The two additional buttons optimize for the sub-scenarios of 1) creating another Contact of the same type; and 2) creating another Contact of a different type.

Sub-scenario 2 could perhaps be eliminated if the contact add form were to provide a way to create an associated contact e.g. while creating a Person, create an Organization with a corresponding Relationship (I would think that creating a related Contact would be the most common cause of sub-scenario 2), but there's much more complexity there so I'd propose deferring consideration of that.

Changing IS and title to reflect my proposed solution (but seeking input from @speckles too).

speckles’s picture

Changes suggested make sense to me

jdleonard’s picture

Assigned: jdleonard » Unassigned
Status: Needs work » Needs review

This is now working. Maddeningly time consuming to figure out what the problem was. Placeholder variable needed to start with @ rather than % so as to not introduce HTML into the button label, which was silently causing a no-op.

bluegeek9’s picture

Taxonomy only has two buttons. The second is conditional.

We could do something similar, 'Save and go to contact'

It might make sense to only add the option when adding a new contact.

When updating a contact the form will redirect to the entity.crm_contact.canonical

When creating a new contact the form returns the form to add a new contact.

/**
   * {@inheritdoc}
   */
  protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form, $form_state);
    if (!$this->getRequest()->query->has('destination')) {
      $element['overview'] = [
        '#type' => 'submit',
        '#value' => $this->t('Save and go to list'),
        '#weight' => 20,
        '#submit' => array_merge($element['submit']['#submit'], ['::overview']),
        '#access' => $this->currentUser()->hasPermission('access taxonomy overview'),
      ];
    }

    return $element;
  }
jdleonard’s picture

Good suggestions.

Made "Save and add another" buttons only visible when adding a contact and only if no destination specified.

Changed default button label to "Save and go to contact" when no destination specified.

Lowercased bundle labels for the buttons.

I think adding both "Save and add another" buttons makes sense to support the data entry scenario of someone adding an Organization then adding one or more Persons who are associated with that Organization then repeating for another Organization. I think the extra screen real estate is a worthwhile tradeoff.

bluegeek9’s picture

Status: Needs review » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.
  • Review the Developer Docs for accuracy and clarity.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.