...
@Core.Computed: false
virtual hideEmployee : Boolean default false;
...
annotate service.Employees with @(
...
UI.Facets : [
{
$Type : 'UI.CollectionFacet',
Label : 'Employee Information',
ID : 'GeneralInformation',
Facets : [
{
$Type : 'UI.ReferenceFacet',
Label : 'Personal Details',
ID : 'EmployeeDetails',
Target : '@UI.FieldGroup#EmployeeDetails',
},
{
$Type : 'UI.ReferenceFacet',
Label : 'Additional Details',
ID : 'AdditionalDetails',
Target : '@UI.FieldGroup#AdditionalDetails',
},
],
![@UI.Hidden] : hideEmployee,
},
{
$Type : 'UI.ReferenceFacet',
Label : 'Org Details',
ID : 'OrgDetails',
Target : '@UI.FieldGroup#OrgDetails',
![@UI.Hidden] : hideEmployee,
},
]);
...
this.after(['READ'], 'Employees.drafts', employeeHandler.hideEmployeeFacet);
this.after(['READ'], 'Employees', employeeHandler.hideEmployeeFacet);
this.before(['CREATE'], 'Employees.drafts', employeeHandler.hideEmployeeFacetDraft);
...
async function hideEmployeeFacet(req) {
for(let reqData of req){
switch (reqData.employeeType) {
...
case "Internal":
reqData.hideEmployee = false;
break;
case "External":
reqData.hideEmployee = true;
break;
...
default:
// code block
}
}
}
async function hideEmployeeFacetDraft(req) {
if(req.data.employeeType === "Internal"){
req.data.hideEmployee = false;
}
if(req.data.employeeType === "External"){
req.data.hideEmployee = true;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
32 | |
13 | |
13 | |
12 | |
11 | |
9 | |
8 | |
7 | |
7 | |
6 |