Extending 360Degree
The 360Degree_entity (module 360degree) models the relations between specific Entities and enables the user to work with these dependencies via the 360DegreeFilter_view, which includes the ViewTemplates Tree and Timeline.
Currently, the 360Degree logic is restricted to relations of Contact_entity (i.e., of companies and persons), see module contact. This means that
- the 360Degree view can only be referenced in the MainViews of the Contexts "Organisation" and "Person" (appearing as tab "360 Degree"), see module contact;
- the 360Degree view can only include datasets (records) of Contexts having a relation to Context "Contact" (directly or via a "junction Context") * such as the Contexts "Salesproject" (module opportunity), "Offer" (module offer), or "Order" (module receipt) do.
In the following chapters you can find a comprehensive explanation of the basics and of how to extend the 360Degree view.
Introduction
This documentation requires you to be familiar with the "ADITO xRM" project's data model, especially the data structure for managing datasets of persons and companies - i.e., the function of the database tables PERSON, ORGANISATION, and CONTACT (all module contact) (see chapter Tables of ADITO xRM).
This documentation will
- explain the basics of the 360Degree logic, using examples of the ADITO xRM project;
- teach you how you can include further Contexts in the existing 360Degree view implementations, using a plain and hands-on example.
This documentation does not include a description of how to implement a 360Degree view in the MainView of Contexts other than Organisation and Person. Nevertheless, in principle, you can customize this by yourself, according to you requirements, using the 360 Degree logic as pattern.
Basics
To understand how to modify the behavior of the 360DegreeFilter_view in existing implementations or how to add them to further Contexts, you need to be aware of some basics regarding specific mandatory fields as well as the configuration of specific Providers, Consumers, and Parameters.
RecordContainer
The core of the 360Degree_entity's logic is the contentProcess of its jDitoRecordContainer. There, a Tree or Timeline structure is created, with
- the Entities' titles as root nodes;
- (if configured, see below:) specific sub-nodes, used for grouping;
- the datasets of the Entities on 2nd or, if a grouping applies, on 3rd level.
Mandatory settings
The logic of the jDitoRecordContainer's contentProcess requires the Contexts, which are to be included in the 360Degree view, to have specific EntityFields and properties well-configured.
EntityFields
The following EntityFields must be present and configured in all Entities whose datasets are to be included in the 360Degree view:
- ACTIVE
The value of this EntityField determines whether or not a dataset will be shown. Often, the value of this EntityField is being calculated in property "expression" of the corresponding RecordFieldMapping (e.g., via a CASE/WHEN SQL statement). - DATE_NEW
The value of this EntityField will be used in the ViewTemplate "Timeline". Its calculation follows the standard logic for this EntityField.
Both EntityFields must be present and named exactly as shown above. Otherwise the logic will fail.
Properties
The following properties are not essential, but if they are missing, the appearance of the Context's datasets will be suboptimal:
- Entity properties:
contentTitleProcess:
The result of this process will appear as "headlines" of the datasets shown in the 360Degree view, including a hyperlink to the datasets' MainView. If this property is not set, the datasets' primary keys will be displayed.contentDescriptionProcess:
The result of this process will appear as "sub-headlines" of the datasets shown in the 360Degree view.
- Context properties:
icon/iconProcess:
Specifies the icon that will be shown to the left of the headline/sub-headline. Usually, this should be the same icon as the icon of the Entity – except when a grouping is configured.
Providers and Consumers
The dependencies (relations) between the 360Degree Context and the Contexts referencing the 360Degree view in their MainViews are, as usual in ADITO, established via a Provider and a Consumer (one for each dependency).
Providers
The 360Degree Context must have a Provider for each dependency, named according to the Pattern <Context name>Objects. Examples:
OrganisationObjectsPersonObjects
Required property values for each Provider:
targetContextField:TARGET_CONTEXTtargetidField:TARGET_IDinitFilterMergeMode:AND
All other Provider properties should usually remain in default state.
Consumers
The Consumers reference the Providers and are named 360DegreeObjects (naming convention). Set these properties:
entityName:360Degree_entityfieldName: name of specific Provider (e.g.OrganisationObjects)
Parameters
The 360Degree_entity has these Parameters, with property expose set to "true" (checkbox checked):
BaseContextId_paramObjectRowId_paramObjectStatus_paramObjectType_param
Never rename or reconfigure these original Parameters under Parameters. Only modify their instances under Providers or Consumers.
Provider Parameter settings
Set only on Provider side:
BaseContextId_paramObjectType_param
Example for BaseContextId_param:
import { result } from "@aditosoftware/jdito-types";
result.string("Organisation");
Example for ObjectType_param:
import { result } from "@aditosoftware/jdito-types";
result.string(JSON.stringify({
"Salesproject": {},
"Offer": {},
"Contract": {}
}));
Optional features via JSON:
"Order": {
"setGroupBy": "ORDERTYPE",
"groupByKeyword": "OrderType"
}
Junction configuration:
"BulkMail": {
"subContext": "BulkMailRecipient",
"childField": "BULKMAIL_ID",
"parentField": "BULKMAILID",
"contactIdField": "CONTACT_ID"
}
Consumer Parameter settings
ObjectRowId_param – Person
import { result, vars } from "@aditosoftware/jdito-types";
result.string(JSON.stringify([vars.getString("$field.CONTACTID")]));
ObjectRowId_param – Organisation
import { result, vars } from "@aditosoftware/jdito-types";
import { SqlMaskingUtils } from "SqlMaskingUtils_lib";
import { newSelect } from "SqlBuilder_lib";
var contactids = newSelect("CONTACTID")
.from("CONTACT")
.where("CONTACT.ORGANISATION_ID", vars.getString("$field.ORGANISATIONID"))
.orderBy(new SqlMaskingUtils().isNull("PERSON_ID", "'0'"))
.arrayColumn();
result.string(JSON.stringify(contactids));
ObjectStatus_param (für beide):
import { result, vars } from "@aditosoftware/jdito-types";
result.string(vars.get("$field.STATUS"));
Example
Here is an example for extending the 360Degree view.
Example goal: Include Activity datasets (module activity) in the 360Degree view of the Contexts Person and Organisation (both module contact).
Activity_entity: Mandatory settings
contentTitleProcessalready set toSUBJECTcontentDescriptionProcess:
import { result, vars } from "@aditosoftware/jdito-types";
result.string(vars.get("$field.INFO"));
ACTIVEEntityField:
import { result } from "@aditosoftware/jdito-types";
result.string("'true'");
- Icon:
"VAADIN:HOURGLASS_END"
360Degree_entity: Extend ObjectType_param
For both Organisation and Person (both module contact):
import { result, vars } from "@aditosoftware/jdito-types";
var res = {
"Activity": {
"setGroupBy:": "CATEGORY",
"groupByKeyword": "ActivityCategory",
"subContext": "ActivityLink",
"childField": "ACTIVITY_ID",
"parentField": "ACTIVITYID",
"contactIdField": "OBJECT_ROWID"
},
"Salesproject": {},
"Offer": {}
// etc.
}
result.string(JSON.stringify(res));
Now, our task is completed. All other 360Degree-related settings explained in the chapters further above do not require any changes.