--- title: "Add company address contact" slug: "base-add-company-address-contact-actor-configuration" status: "update" updated: 2026-11-26T14:36:46Z published: 2026-11-26T14:36:46Z canonical: "docs.lobstersoftware.com/base-add-company-address-contact-actor-configuration" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Add company address contact > [!NOTE] > Event action – Abstract > > **Purpose:** Assigns an address present as a *reference object* to a company account as an *address contact* with a specific [Contact type](/v1/docs/en/base-contact-type). > > > [!TIP] > > Tooltip > > > > - **Usage:** The event action must be executed in the context of an entity of the "Address" type. This address is to be added to the company account defined via the "Target company" parameter as an address contact with the parameterized "Contact type", provided that no address contact already exists that refers to the same combination of contact type and address (ID). > > - **Special application case:** In connection with the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact) the "Add address" event provides values for the parameters in the `contactCompanyId`, `contactType` and `contactTypes` variables. > > - **Parameter:** > > - Contact type: A value of the dynamic enumeration [Contact type](/v1/docs/en/base-contact-type) or a text value corresponding to the internal name of one of the values of this enumeration. > > - Target company: The company account or the ID (long value) of the company account in which the address is added as a new address contact. > > - **Output:** Address contact with the address present as a reference object appears in the account of the target company. > > - **WARNING:** If a [Contact type](/v1/docs/en/base-contact-type) is used that is not "plural", the new address will displace an existing entry for that [Contact type](/v1/docs/en/base-contact-type). ![images/download/attachments/189439250/image-2024-11-25_15-54-20-version-1-modificationdate-1732546459869-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-11-25_15-54-20-version-1-modificationdate-1732546459869-api-v2.png) The [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) event action can be performed with an entity of the "Address" type as a *reference object*. This action can be used to assign the address to a company account (see [Companies/Clients](/v1/docs/en/base-company-account)) as an *address contact* with a specific [Contact type](/v1/docs/en/base-contact-type). The following rules apply: 1. An address is added only if it is not previously assigned as an *address contact* for the same [Contact type](/v1/docs/en/base-contact-type) within the address of the company account. 2. Unless the [Contact type](/v1/docs/en/base-contact-type) in the dynamic enumeration qualifies as "plural", an added address contact replaces an existing one for the same [Contact type](/v1/docs/en/base-contact-type). > [!NOTE] > **NOTE:** > > - Adding an address as an address contact for the **Target company** implies saving the relevant company account if its address does not yet contain the combination of address ID and [Contact type](/v1/docs/en/base-contact-type) (see rule no. 1 above). > - For the account of the **Target company**, either the "Change" (existing company account) or "Create" (new company account) event is triggered when saving. > - If the relevant access rights ("Change" or "Create") for the account of the **Target company** are missing, the event handling will cancel with an error (incl. *rollback*). > - If there is no suitable value for at least one of the **Contact type** or **Target company** parameters (see "Configuration") at runtime, the event handling will cancel with an error (incl. *rollback*). Special application case: In [Input forms](/v1/docs/en/base-entity-form), the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact) can be used to trigger the "Add address" event (["Address" form element](/v1/docs/en/fre-address)) for a "Company and address attribute" in the context of an address search (see [Address (Events)](/v1/docs/en/base-address-action-event)). This button can be used if the address search via [Combobox](/v1/docs/en/fre-combo-box-vo) deviates from the default and does not refer to *addressbook entries* but to address contacts of a certain company. The link to the company must be established at runtime via the [Use contacts of this company](/v1/docs/en/freaction-update-address-contact-source) action. Usually, this happens as a reaction to the selection of the company in another [Combobox](/v1/docs/en/fre-combo-box-vo) element (for details, see the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact)). The event primarily passes the relevant address as an *input value*. In addition, further data from the call context is provided in variables: | Variable name | Data type | Content | | --- | --- | --- | | contactCompanyId | Long | ID of the company whose address contacts were offered in the form in the [Combobox](/v1/docs/en/fre-combo-box-vo) for the address search. | | contactTypes | [Contact type](/v1/docs/en/base-contact-type) list | List of all contact types selected as relevant in the service configuration for this [Combobox](/v1/docs/en/fre-combo-box-vo). | | contactType | [Contact type](/v1/docs/en/base-contact-type) (`ContactType`) | The *first* entry ([Contact type](/v1/docs/en/base-contact-type)) of the list in the variable `contactTypes`. | Provided that *exactly* *one* relevant [Contact type](/v1/docs/en/base-contact-type) is selected in the address search, the `contactType` and `contactCompanyId` variables can be transferred directly to the **Contact type** and **Target company** parameters in the event action [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration). If the address search refers to more than one [Contact type](/v1/docs/en/base-contact-type), the event handler must make a determination or – if necessary, taking into account the list in the `contactTypes` variable – query the user (see "Special application case" example below). > [!NOTE] > **NOTE:** > > **"Address contact" background** > > An *address contact* (`addressContact`) is a typed attribute that is only offered for [Addresses](https://www.deepl.com/v1/docs/en/base-address) (see also ["Address contact" form element](https://www.deepl.com/v1/docs/en/fre-address-contact)). Each address contact must be assigned a (sub)type from the dynamic enumeration [Contact type](https://www.deepl.com/v1/docs/en/base-contact-type). Depending on the "plural" option for the [Contact type](https://www.deepl.com/v1/docs/en/base-contact-type) in the dynamic enumeration, it can occur only once or multiple times in the same address. The value of an address contact attribute is the embedded "address" (`address`) in the field of the same name. > [!WARNING] > **IMPORTANT:** > > [Addresses](https://www.deepl.com/v1/docs/en/base-address) are handled in **Lobster Data Platform** as [Referenced objects](/v1/docs/en/orchestration-referenced-objects) whose ID changes when address characteristics change. An *address contact* added via the [Add company address contact](https://www.deepl.com/v1/docs/en/base-add-company-address-contact-actor-configuration) event action refers to a specific address ID and thus a specific combination of characteristics for address data. If the address to be added is "read" from an existing data object, no link to this *origin object* is created. Changes to the address data in the origin object therefore do not affect a created address contact, but change the address ID in the *origin object*, while the *address contac*t continues to refer to the original address ID until address details are changed by accessing the address field in the *address contact*. Operationally, the event action [Add company address contact](https://www.deepl.com/v1/docs/en/base-add-company-address-contact-actor-configuration) therefore acts similarly to adding a snapshot of the address from the *origin object* as an *address contact*. ## Configuration > [!WARNING] > **IMPORTANT:** > > The address added to a company account as an *address contact* must exist as a *reference object* for the event action. Unless the event handling is executed as a whole with an entity of the "Address" type as the *input value*, a context with a suitable *reference object* must first be defined for the execution of the event action. This allows e.g. event actions like [Execute with](/v1/docs/en/core-with-actor) or if necessary a [For each loop](/v1/docs/en/core-for-each-entity-actor) over a list of addresses. | - One of the values of the dynamic enumeration [Contact type](/v1/docs/en/base-contact-type) or a string corresponding to the internal name of one of these values must be specified as the [Contact type](/v1/docs/en/base-contact-type). A static assignment per selection field may be possible using the value resolver "any dynamic enumeration" from the category [Static values](/v1/docs/en/core-literal-value-resolver). - The value resolver for the **Target company** can either return an entity of the "CompanyAccount"(`base:CompanyAccount`) type or alternatively an integer (`Long`) corresponding to the ID (`id`) of an existing company account for which there must be at least read access. **NOTE:** If there is no value or an unsuitable value for at least one of these parameters at runtime, the event handling terminates with an error message (and *rollback* if necessary). | ![images/download/attachments/189439250/image2021-5-6_15-29-18-version-1-modificationdate-1732545977715-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-29-18-version-1-modificationdate-1732545977715-api-v2.png) | | --- | --- | ## Examples ### General use case In a B2B portal implemented with **Lobster Data Platform**, the operator would like to create and manage company accounts for its business customers for logging into the portal. The administration of these company accounts is the task of "account managers" at the operator, for whom a separate role "CustomerAccountManager" has been set up for this purpose. When saving (creating or modifying) a company account by a user who uses the "CustomerAccountManager" role, the address from his user account should be automatically added as an *address contact* in the company account in question. The [Contact type](/v1/docs/en/base-contact-type) "Account manager" (with the internal name `ACCOUNT_MANAGER`) is specified, which was created especially for this purpose. There should always be exactly one "account manager" responsible for each customer. An existing *address contact* for the [Contact type](/v1/docs/en/base-contact-type) "Account manager" should therefore always be replaced if a different address is added for the same [Contact type](/v1/docs/en/base-contact-type). > [!NOTE] > **NOTE:** > > For a practical application, it is important to take into account that the address in the added *address contact* matches the address in the user account only until an address feature is changed (see the "Background" infobox above). If the address in the user account is changed after the *address contact* has been added, the address ID referenced by the user account changes, while the *address contact* still references the original address ID and displays its data unchanged. An update or synchronization would require additional precautions. **Runtime example:** | The user "Karola Mustermann" is logged in for the portal operator (Xflow AG) as "CustomerAccountManager" and accesses the company account of a customer company via the "Companyaccount overview": - In the **Contacts** tab, the *address contacts* of the company are listed there. So far, the list of contacts refers only to the "CEO". **NOTE:** The form layout in the image on the right has been slightly modified compared to the default. Among other things, the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(13).svg) icon for deleting entries is hidden. Instead, a **Delete** [Button](/v1/docs/en/fre-button-vo) has been added inside the repeatable container for the address contact. This can be set active or inactive depending on the contact type to allow or prevent deletion (see [Remove element (optional/repeatable element)](/v1/docs/en/freaction-remove-element)).In the present application case, an address contact with the [Contact type](/v1/docs/en/base-contact-type) "Account manager" should not be able to be deleted and should also appear deactivated except for the [Button](/v1/docs/en/fre-button-vo) for "email" sending (see screenshot below right). | ![images/download/attachments/189439250/image2021-5-6_15-38-28-version-1-modificationdate-1732545977710-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-38-28-version-1-modificationdate-1732545977710-api-v2.png) | | --- | --- | | As soon as the processing of the company account for "fast-or-furious Ltd." is completed via **Save** (in the ribbon), "Account manager" appears in the company account, which shows the address for the user account (see [Users](/v1/docs/en/base-user)) of "Karola Mustermann". Only the name fields are displayed here, but the address contact provides access to the entire address, so that, for example, the email function, can use the communication information it may contain. | ![images/download/attachments/189439250/image2021-5-6_15-39-11-version-1-modificationdate-1732545977708-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-39-11-version-1-modificationdate-1732545977708-api-v2.png) | Configuration: | An event handler is created for the "registration" of the user making the last change to a company account and configured as shown on the right: - "Update" and "Create" events (see [Common action event](/v1/docs/en/core-common-action-event)) are set as the **Triggering events**. - The **Validating rule** uses [Check type](/v1/docs/en/core-check-type-rule) to determine whether the *input value* is the "CompanyAccount" type. If this is the case, the AND-junction [Sub criterion rule](/v1/docs/en/core-association-sub-criteria-rule) is evaluated, which determines per [Role rule](/v1/docs/en/base-role-rule) whether the "CustomerAccountManager" role is claimed in the logon context. | ![images/download/attachments/189439250/image2021-5-6_15-40-56-version-1-modificationdate-1732545977705-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-40-56-version-1-modificationdate-1732545977705-api-v2.png) | | --- | --- | | - An **Action on passed rule** is an event action of the [Execute with](/v1/docs/en/core-with-actor) type that is used to define the *reference object* differently from the company account that is the *input value*: - The company account from the *input value* is saved per **Save Company account in variable** parameter in a variable with the name `company` . - In the **Object Resolver**, the [User of session](/v1/docs/en/base-session-user-value) is first determined via concatenation and then the associated user account is read via an [Input object (type safe)](/v1/docs/en/core-root-entity-resolver). In the `address` field, the *address contact* that is added for the "customer advisor" can be found. This is valid for the following action block as a *reference object.* - In the [Execute with](/v1/docs/en/core-with-actor) event action block, the only event action that follows is [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) with the following parameters: - As [Contact type](/v1/docs/en/base-contact-type), "Account manager" is assigned as a static value (per "Any dynamic enumeration" value resolver, see [Static values](/v1/docs/en/core-literal-value-resolver)). - Access to the **Target company**, which is the *input value* outside the [Execute with](/v1/docs/en/core-with-actor) event action, is available within the [Execute with](/v1/docs/en/core-with-actor) event action only via the [Variable](/v1/docs/en/core-storage-value) `company` . **NOTE:** The fact that the **Target company** is also the *input value* of the event handling is a coincidence. If the address of "Karola Mustermann" in our example is not yet entered as an *address contact* of the "Account manager" type, the "Update" event for the company account will be triggered twice, because the *address contact* is added again. | ![images/download/attachments/189439250/image2021-5-6_15-42-20-version-1-modificationdate-1732545977703-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-42-20-version-1-modificationdate-1732545977703-api-v2.png) | ### Special use case The following example demonstrates the use of the [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) event handling in connection with the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact) triggering event "Add address" (see [Address (Events)](/v1/docs/en/base-address-action-event)). | In the course of addressing a shipment, a company account is selected for the company and address attribute **Loading party** ([Company type](/v1/docs/en/base-company-type) `DPA`) initially in order to be able to specify a precise pickup position (*here*: **Loading party address**), which, if necessary, will subsequently be stored in the address of the same company and address attribute. When selecting the company for the **Loading party**, the action [Use contacts of this company](/v1/docs/en/freaction-update-address-contact-source) for the [Combobox](/v1/docs/en/fre-combo-box-vo) of the **Loading party Address** is executed in the entry form. In the example, this should then offer all *address contacts* with the [Contact type](/v1/docs/en/base-contact-type) "Gate/Entrance" or "Building" for selection, which are found in the company account of the selected company. Alternatively, a completely new **Loading party address** can also be entered. Via the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact), a newly entered or changed company address should be added as a contact. The user should be able to define the assigned [Contact type](/v1/docs/en/base-contact-type) for the *address contact* via context menu (see screenshot on the right) from the options relevant for the pickup address. | ![images/download/attachments/189439250/image2021-5-6_15-45-50-version-1-modificationdate-1732545977700-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-45-50-version-1-modificationdate-1732545977700-api-v2.png) | | --- | --- | Configuration: The configuration of the collection form is not described in detail here. To understand the event handling configuration described below, it is only relevant that the service configuration for the [Combobox](/v1/docs/en/fre-combo-box-vo) element within the **Loading party Address** names the **Contact types** "Gate/Entrance" and "Building". Therefore, only addresses referring to *address contacts* of the selected company belonging to one of these two types will appear in the dropdown for selection. ![images/download/attachments/189439250/image2021-5-6_15-48-15-version-1-modificationdate-1732545977698-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-48-15-version-1-modificationdate-1732545977698-api-v2.png) Therefore, when the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact) is used to trigger the "Add address" event for the **Loading party Address**, the `contactTypes` variable contains a list with these two contact types. | For the **Triggering event** "Add address" (see [Address (Events)](/v1/docs/en/base-address-action-event)), the event handling shown on the right is configured: - The **Validating rule** uses [Check type](/v1/docs/en/core-check-type-rule) to ensure that an "address" was passed as the input value. When triggering the event by the ["Add as company contact" button](/v1/docs/en/fre-address-button-add-to-company-as-contact), this should be implicitly guaranteed. So the [Check type](/v1/docs/en/core-check-type-rule) here essentially declares the data type "address" for the *input value.* **NOTE:** The event is defined here in a generic way and therefore does not need any further rules for the transferred "address" or the values of the variables that are automatically filled when the event is triggered (`contactCompanyId`, `contactType` und `contactTypes`). - Therefore, among the **Actions on passed rule**, it is first determined whether the [Contact type](/v1/docs/en/base-contact-type) to be added to the company account is uniquely determined by the context. In the **Object Resolver**, the [Execute with](/v1/docs/en/core-with-actor) event action defines the [Contact type](/v1/docs/en/base-contact-type) list in the `contactTypes` variable as a *different reference object* for the following block of event actions: - An [If then else](/v1/docs/en/core-if-then-else-actor) event action examines the field `length` of the list by an [Entity property rule](/v1/docs/en/core-entity-property-rule) to determine if it contains more than a single element. The user should only have to select from the available options via the context menu if this is the case. - If a decision is required, the [Show context menu](/v1/docs/en/core-show-context-menu-actor) event action displays the localized texts for the contact types contained in the list as options. - Since the list is already available as a *reference object*, the [Object property](/v1/docs/en/core-property-resolver) value resolver inserted under **Root items** gives the entire list without a field. - The label expression accesses the [Localization](/v1/docs/en/core-localization-entry) with the syntax [`bundle, resource`] to look up the localization entry for the name of the respective contact type (*resource* `{name}`) in the *bundle* `de.lobster.scmbase.address.attributes.ContactType` there. - The `contactType` variable is specified here as the **Name of result variable**. This variable contains the first value of the list until the context menu is called, because the "Add address" event automatically preassigns this variable. - The selection in the context menu returns the [Contact type](/v1/docs/en/base-contact-type) clicked on, unless the user allows the **Wait time** (set here to 300 seconds) to elapse or closes the context menu without making any selection (via the Esc key or by a mouse click in the form. **NOTE:** The already preassigned variable `contactType` is also specifically selected here as the target for the *return object* of the context menu, so that within the event action [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) for the parameter **Contact type** the value of the variable `contactType` can always be transferred. In the special case of a crash or timeout after opening the context menu, however, the [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) event action is then blocked from being executed at all; otherwise, "no value" is passed as **Contact type**, which leads to a crash with an error message (incl. *rollback*). | ![images/download/attachments/189439250/image2021-5-6_15-50-40-version-1-modificationdate-1732545977695-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-50-40-version-1-modificationdate-1732545977695-api-v2.png)![images/download/attachments/189439250/image2021-5-6_15-52-21-version-1-modificationdate-1732545977679-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-52-21-version-1-modificationdate-1732545977679-api-v2.png) | | --- | --- | | After completion of the [Execute with](/v1/docs/en/core-with-actor) event action, which is only relevant if the [Contact type](/v1/docs/en/base-contact-type) is not uniquely predetermined, the address to be added is again considered the *reference object.* In this context, the event action [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) is executed: - Within an [If then else](/v1/docs/en/core-if-then-else-actor) event action, however, it is checked beforehand whether the `contactType` variable is empty: - If the variable specifies the predetermined or selected [Contact type](/v1/docs/en/base-contact-type), then the event action [Add company address contact](/v1/docs/en/base-add-company-address-contact-actor-configuration) is executed, assigning the variable `contactType` as the **Contact type** and the variable `contactCompanyId` as the **Target company**. **NOTE:** If there is no permission in the logon context of the session to change the company account in question, the event action should be executed within an [Run as](/v1/docs/en/base-run-as-actor) event action with a different logon context. - Without any specification for the [Contact type](/v1/docs/en/base-contact-type) – i.e. if the user has exited a context menu without any selection – the event handling should be terminated without comment or further event actions. | ![images/download/attachments/189439250/image2021-5-6_15-54-3-version-1-modificationdate-1732545977674-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-5-6_15-54-3-version-1-modificationdate-1732545977674-api-v2.png) | ## Related - [Addresses](/base-address.md) - [Contact type](/base-contact-type.md) - [Address (Events)](/base-address-action-event.md) - ["Add as company contact" button](/fre-address-button-add-to-company-as-contact.md)