How to load and fill field of content A when content B is created?

Created on 8 August 2024, 4 months ago
Updated 10 September 2024, 3 months ago

Problem/Motivation

I am having troubling solving this on my own, so I am looking for help here.

When content B is created, get the date from a field and add 6 months to it. If the name field of content A and B match, fill the date field in content A with the 6 month added date.

Thanks!

💬 Support request
Status

Fixed

Version

1.1

Component

Miscellaneous

Created by

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

Comments & Activities

  • Issue created by @london6339
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Here is a brief run-down on how that could look like:

    • Event: Update content entity
    • Action: get field value - this stores the date value into a token
    • Action: Tamper Math - this requires the eca_tamper module and allows you to add your 6 months (=15768000 seconds) to the timestamp in that token you stored the date value into
    • Action: Entity load - this allows you to load an entity by properties where you can search another node by the name of your new content B. If no match is found, ECA will not continue processing. If loading the entity by property is not sufficient, you can use a view to find the matching entity
    • Action: Entity set field value - you can set the field value with the calculated token value from above and save that entity

    You may want to build some safe-guards into that model, otherwise the update of the second node will trigger the same model again as this is then also a content update. If your 2 contents A and B are of different type or bundle, you can limit the event by the type and/or bundle of the content B.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Has this support reply been helpful?

  • Status changed to Fixed 4 months ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Marking as fixed due to missing feedback.

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

Production build 0.71.5 2024