Auto-generate an entity reference using just the product id

Created on 31 July 2018, almost 7 years ago
Updated 18 May 2025, about 2 months ago

Hello everyone!

I'm looking for some help with my workflow on my Drupal 7 website...

Currently:
2 user types ( user type 1: u1, user type 2: u2 )

1 - u1 creates content
2 - u2 creates a product referencing u1's content
3 - u1 purchases the product
4 - a reference to the purchased product is created in u1's content

I am trying to automate step 4. I currently have a rule (r1) in place that saves the product ID in a field in u1's content after the checkout process is completed by u1. I tried to see if it was possible to just create an entity reference with rules but I could not figure that out and I read some issues/comments by other users and it doesn't appear to be possible.

My question: Is there any way to auto generate an entity reference (behind the scenes) using only the product ID?

I could also save some other product fields when r1 is triggered like title, price, sku, etc. But I think that if this is possible that the only thing I would need is the product id (maybe the sku, but those don't necessarily need to be unique values).

If this is not possible then does anyone know of any workarounds that do not involve coding/custom modules/etc?

Any help is much appreciated!

💬 Support request
Status

Active

Version

1.5

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024