Samo-notes
Level: Beginner
Keywords: notes
The result: module for adding notes in entity Information Detail
How to implement samo-notes module?
1. LIDS metadata
If we want to be able to assign notes to specific existing SAMO Entity, at first, we need to define the data model for notes including featureType, featureRefRelationAssoc and relationRole. In the beginning, it's good to think about which entities we want to work with notes for. Then it is advisable to include parent features in the featureRefRelationAssoc, or create multiple featureRefRelationAssoc at once.
<ber:featureType id="ft_exampleNote" name="Example Note" parentId="ft_5000002" abstract="false">
<ber:container refId="ct_exampleNote"/>
<ber:featureAttributeArray>
<ber:attribute id="at_exampleNote__note" name="Note" dbName="NOTE" nillable="true">
<ber:dataType>
<ber:string maxLength="4000"/>
</ber:dataType>
</ber:attribute>
<ber:attribute id="at_exampleNote__title" name="Title" dbName="TITLE" nillable="true">
<ber:dataType>
<ber:string maxLength="32"/>
</ber:dataType>
</ber:attribute>
<ber:featureRefAttribute id="at_exampleNote__exampleSID" name="Example ft" dbName="EXAMPLE_SID" nillable="true">
<ber:dataType>
<ber:featureRef>
<ber:attribute refId="sid"/>
<ber:featureRefRelationAssoc refId="as_example_exampleNote"/>
</ber:featureRef>
</ber:dataType>
</ber:featureRefAttribute>
</ber:featureAttributeArray>
<ber:formArray>
<ber:form id="fmd_exampleNote_detail" name="Example Note">
<ber:fieldGroup>
<ber:field refId="at_exampleNote__title" readOnly="false" length="100"/>
<ber:field refId="at_exampleNote__note" readOnly="false" length="100"/>
</ber:fieldGroup>
</ber:form>
<ber:assignedForms>
<ber:assignedForm usage="default" refId="fmd_exampleNote_detail"/>
</ber:assignedForms>
</ber:formArray>
</ber:featureType>
<ber:featureRefRelationAssoc id="as_example_exampleNote" name="Example feature -> Example note">
<ber:masterRole refId="rt_example"/>
<ber:childRole refId="rt_exampleNote"/>
</ber:featureRefRelationAssoc>
<ber:relationRole id="rt_exampleNote" name="Note" dbName="NOTE_SID">
<ber:ftItem refId="ft_exampleNote"/>
</ber:relationRole>
2. SAMO metadata
Now we can include samo-notes module in the Information detail of chosen entity. In this case the configuration options are pretty straightforward. Following example contains only required properties, all options are available in Dynamic-App Module Catalog.
{
"detail" : {
"default" : {
"sections" : [
{
"icon": "cbu-icons:report-notes"
"module": {
"type": "component:entity-modules/notes/samo-notes",
"titleProperty": "at_exampleNote__title",
"contentProperty": "at_exampleNote__note",
"entity": "ft_exampleNote",
"relation": "as_example_exampleNote",
"role": "rt_exampleNote"
}
}
]
}
}
}