Yapla offers a type of field called Object that allows you to link different elements of the Yapla Platform, from the same or different features.
In other words, this field allows you to create a type of relationship between two Yapla objects.
This can be useful, for example, for linking members to Data objects, contacts, or other members.
Here are some concrete examples:
- Members who need to list their cars in their Member Area
- Members who must submit a form after registration.
- A project object related to a funding program where both have their own information (start date, end date, manager...)
Where to create the Object field?
Go to the Members application > Settings > Forms > Fields to add a new custom field.
The example below illustrates the creation of an object field in members, to link members and define a hierarchy. However, you can also create an object field from the "Forms" pages of the "Contact" or "Data" applications.
After clicking "Add field", choose the type of "Object" field and proceed to the next step.
You can now configure the field on the "Creation of a custom field" page.
Configuring the Object Field
The first section, common to all fields in Yapla, concerns general information: name, description and whether the field is required or not.
Define the connection between the objects
The connection created between the two objects is bi-directional, so you need to define restrictions in both directions.
For example, a member may have to submit only one form and a form may be submitted by one member only. It is also possible that a member can be associated with several "Cars" objects, but a car can belong to one member only.
You need to configure the object field according to the relationship you create.
Configure the parent field
The parent object is the one configured in the previous section ("Field information"). It is linked to the application in which you created it (Members, Data or Contact).
Choose with which type of object you want to associate the parent object in the drop-down list "Associated object".
You can choose a member or an object from the "Data" or "Contact" applications. This example shows the choice of another member: two members will be linked.
Then it is possible to choose the fields that will be used to display this object. Choose which information of this type of chosen object you want to display in the member's form. It can be his name, number, email or any information that will allow you to distinguish him (this information is variable depending on the type of object).
Note that it is possible to choose several fields, among all the native and personalized fields of the chosen object.
In this example, the member's email field is chosen.
You must then configure the cardinality of the relationship from the point of view of the parent object. That is to say if the parent object can have one or more relationships with the child object.
In this example, the goal is to create a hierarchy link. So we have to ask ourselves if a member can have one or more managers.
If it can have several managers, we will choose the option "Allow parent-child association to multiple records".
If there can only be one manager, then the option "Limit parent-child association to a single record" will be selected.
The next two options then allow you to define the selection modes.
- The option "Allow selection of existing records" allows you to choose the destination object from the list of existing objects.
In this example, this option is checked to allow you to find the manager from the list of existing members.
- The option "Allow to create a new object" allows you to create a new object when choosing the object.
You can also force the creation of a new object.
In this example, this option is not checked, because the creation of a member can be complex. For a simpler object, this option is useful because it allows you to stay in the editing process without leaving the application.
This gives the following configuration:
Configure the child field
The second step is to configure the child object, in order to define the inverse relationship. You have to define how the object in which the configuration is made will be managed in the other object of the relationship. (here, manager -> employee)
You must first give a name to the created object.
For example, for a manager, this field will allow him to view the employees.
The field "Child relationship name for child object" could be called "employees".
It is again necessary to choose the fields that will be used to display the record as well as to define the cardinality rules and the selection modes. (See above for more details).
In this example, you could check "Allow parent-child association to multiple records" (a manager may have several employees) and the possibility to choose only existing members.
Adding the object field in a form
You must then add the object field to a form in order to view, edit or add an object.
Go to the "Forms" sub-section of the page and choose the form you want to modify from the list.
Here, as the field concerns a link between two members, you have to add the field "line manager" and the field "employees" to your form.
Select and drag a field from the available fields to the section of the form where you want it to appear.
Using the object field
The newly created fields will now appear in the form and therefore in the contexts associated with it. For example, in the view of a member file.
When viewing the file of an existing member, you can click on the link of an object to go to the form of the object in question.
When creating a new member or editing an existing member's record, you can, depending on your configuration, choose one or more items from a drop-down list (if you have configured this option). You will be able to select a manager or an employee, if applicable:
To select an object, you must choose it from the list.
If only one record is possible, the selection list will disappear once you choose another object. You will be able to delete the linked object and choose another one if necessary.
If more than one record is possible, you can choose a second object from the drop-down list.
If you have left the possibility to create an object from the form, a "Create" link will be available.
Clicking on this link will open a new page displaying the form to create the associated object. Saving it will take you back to the parent object with the created object already selected.
This object management application is available in the Yapla administration, but also on your website, with the same behavior.
It is possible for a member to view his manager and employees once logged in to his Member area. He can also modify the information associated with these fields.