Skip to content

Automatically attach relations when creating a new object

Info

This guide only concerns objects created from the plus sign on an object relation tab, not from the plus sign in the Web Client main menu.

When creating a new object with the Create new dialog, it's possible to get pre-filled relations depending on other relations by configuring it in Lime Admin. For each limetype, you can choose which relation properties that should be auto attached when creating new objects of that limetype. When a property is set to be auto attached, relations of the same limetype on the object card will be auto attached if found. The relation of the object card itself will always be auto attached and is not configurable.

Configuring auto attach in Lime Admin

The Views section in Lime Admin contains the views for all limetypes. In the Card view for each limetype, there are sections with controls containing the different properties for that limetype. For every relation property there's a checkbox deciding whether the property should be auto attached when creating a new object of that limetype.

The coworker relation

The coworker relation is handled slightly differently compared to the other relations. When Auto attach is checked in Lime Admin for a coworker property, the coworker relation in the create dialog will always be pre-filled with the currently logged in user.

When Auto attach isn't checked for a coworker relation, nothing will be auto attached. Just like how it works for any other relation property.

Example - Auto attach company when creating a todo on a person

You want to create a new todo for the person Indiana Jones and the todo should be automatically related to the company which Indiana Jones is connected to. Then the Auto attach for the company relation on the todo limetype should be set.

  1. Go to the Card view of the Todo limetype and find the Company relation property among the section controls.

  2. Set the checkbox Auto attach to true by checking it.

  3. Also go to the Coworker relation property and set the checkbox Auto attach to true by checking it.

  4. Go to Indiana Jones and start creating the new todo by pressing the Todo relation tab and then the plus sign to the right in the action bar.

    The Create new dialog opens up and the company relation is now pre-filled with LEGO (DEMO), which is the company Indiana Jones is connected to. The relation field Business is not configured to be auto attached and is therefore not prefilled. The relation field Coworker is configured to be auto attached and is therefore set to the currently logged in coworker Lime Administrator as explained in The coworker relation.