Hello,
I'm having an issue with a one to many relationship on my site. We have a Services type and an Attorneys type. We made a one to many relationship between Service and Attorneys, the primary contact. A Service can have one primary contact, an Attorney can be the primary contact for many Services.
The relationship appears to be created correctly and a meta box to assign the primary contact appears at the bottom of the post page for Services and Attorneys. However, for Services the buttons to assign a primary contact are disabled. On the Attorneys side, the buttons are enabled, but clicking to assign to an existing Service only shows Services that are in draft, non that are currently published.
We had successfully assigned some primary contacts in the past, but now we can't reassign or make any new assignments.
Any assistance here would be much appreciated. I don't know if this is a setting I'm missing or something we misconfigured in the relationship setup.
However, for Services the buttons to assign a primary contact are disabled.
Hello, I'll be glad to help figure this out. First, I will need to know the status of your relationships system. Recent updates to Types included updates to the relationships system, and some of those require database updates or migrations. If you go to Toolset > Relationships, what do you see? If you see a list of all your relationships, no further update or migration is required and the problem must be somewhere else. If you see a message about migrations, you may need to perform a database migration to update to the new system. Updating to Types 3.4 from 3.x requires a small migration. If you have less than 100 related posts, the migration should happen automatically. If you have more than 100 related posts, the migration must be run manually.
If you're updating from Types 2 to Types 3, the migration is more substantial. So it would be most helpful for me to know what you see at Toolset > Relationships, and we can assess next steps from there. It would also be helpful for me to know if any JavaScript errors appear when you edit an Attorney or Service post. You can open your browser console to see, or if you'd prefer I can log in and take a quick look. Let me know how you would like to proceed. I will activate private reply fields so you can share login credentials if necessary.
In the Service posts that are already connected to a Primary Contact Attorney, it makes sense that the buttons are disabled. There can be only one Attorney selected, so you would have to disconnect that existing Attorney.
In the Attorney posts, if all the published Services have a connected Primary Contact Attorney, then it makes sense that you cannot select them in another Attorney post. One Service can only have one Primary Contact Attorney, and you would have to disconnect that Attorney before you can assign that Service to another Attorney.
I quickly scanned a few Services and Attorneys, but I can't seem to find a Service that is not yet connected to a Primary Contact Attorney. Do you know of one offhand?
Okay it all came together for me now thanks to your comments. Here's what happened.
We had all of the Services assigned a primary contact. Then we deleted (trashed) an Attorney. The Attorney was still assigned as primary contact on some Services. I guess those relationships didn't automatically free up when that Attorney was trashed. Leading to some primary contacts being in a state where they had an Attorney assigned (so the buttons became disabled) but didn't have an Attorney to list (so no listing to disconnect).
The attached images are from before (Attorney in the trash bin) and after (Attorney recovered from trash bin)
You can see the state with no listing on this post hidden link
So the solution for me looks like recovering this Attorney, then manually removing all primary contact connections this Attorney has, then moving him to the trash.
With that being said, maybe this could be a bug report or a feature request. The state shown in the screen shot with the Attorney in the trash is very confusing. Maybe if the Object that was linked on the one side of a one to many relationship no longer exists it could show some text explaining that, or an option to clear the connection.
Okay understood, thanks for the extra information. I agree that the "limbo" connection state is confusing, and I wonder if our developers can address that as a usability issue by adding a simple message explaining that the related post should be permanently deleted or restored before you can use the relationship editor panel again in the child post editing screen. Types 3.3 included some changes to address a related issue, but this still isn't as clear as it could be. I will submit this as a Usability issue and let you know what I find out. Thanks for the report, and hopefully we can clear things up for other people who experience the same frustration.
Okay my team leader agrees that this could be improved, and will escalate internally as a Usability issue. I can't guarantee our developers will be able to implement it in a timely manner, but they will take care of it in turn. I think we can close out here now that our developers are aware of the issue, and they can take it from here when their schedule allows.
Thanks again for the report!