📁 Showcase
Backend

Backend

1. Variables

ensure var VarSetOfTextTaskPriority kind: setOfText 
  deploy: fixedOnDeploy 
  value: "<root>
      <node key='High'>High</node>
      <node key='Normal'>Normal</node>
      <node key='Low'>Low</node>
    </root>"
  
ensure var VarSetOfTextTaskStatus kind: setOfText 
  deploy: fixedOnDeploy 
  value: "<root>
      <node key='Not Started'>Not Started</node>
      <node key='In Progress'>In Progress</node>
      <node key='Completed'>Completed</node>
      <node key='Waiting on someone else'>Waiting on someone else</node>
      <node key='Deferred'>Deferred</node>
    </root>"

2. TaskSheet

ensure spreadsheet: TaskSheet
  withFields: [
    "RelatedTo",
    "Refresh",
    "Id", 
    "Subject", 
    "Description", 
    "DueDate*", 
    "Status*", 
    "Priority", 
    "AssignedTo", 
    "RelatedToId", 
    "RelatedToValue"
  ]
  ofTypes: [pcikText, button, text, text, paragraph, date, pcikText, pcikText, pickText, text, text]
  removeRoleSet: [Owner]
  readRoleSet: [Owner]
  insertRoleSet: [Owner]
  updateRoleSet: [Owner]

ensure spreadsheet TaskSheet 
  userForwardRolePermissionMap: {
      'Owner': [
        'Owner'
      ]
    }
  searchables: [Subject, Description, DueDate] 
  queryables: [Id]  

ensure form EntityTask commentRoleSet: [Owner]
ensure section: Details
ensure field RelatedTo 
  plugIn: SalesforcePlugin 
  pluginApi: GetOpportunitiesDropdownList
ensure field Refresh 
  icon: "RefreshRounded" 
  btnPosDoNotInline: true 
  btnPosToolbar: true 
  buttonKind: normal 
  actionCloseAside: true 
  targetType: invokePlugin 
  plugIn: SalesforcePlugin 
  pluginApi: SyncDetail 
  pluginInputMappingVar: VarMappingTaskToSyncDetailInputForm 
  pluginOutputMappingVar: VarMappingTaskDetailToTask1
ensure field Id
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field DueDate defaultValue: "now"
ensure field Status  
  pluginInputMappingVar: VarMappingTaskToDropObjectDownPicklistInput2 
  sourceVar: VarSetOfTextTaskStatus
ensure field Priority  
  pluginInputMappingVar: VarMappingTaskToDropObjectDownPicklistInput1 
  sourceVar: VarSetOfTextTaskPriority
ensure field AssignedTo 
  plugIn: SalesforcePlugin 
  pluginApi: GetUsers
ensure field RelatedToId
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field RelatedToValue
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }

// composite, section, Other
ensure section: Other 
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field FormMode kind: text 
ensure field RowId kind: rowId 
  permissionMatrix: {
      'defaultPermission': 'invisible'
    }
ensure field GetTaskDetailButton kind: button 
  permissionMatrix: {
      'defaultPermission': 'invisible'
    } 
  buttonKind: normal 
  targetType: invokePlugin 
  plugIn: SalesforcePlugin 
  pluginApi: GetTaskDetails 
  pluginInputMappingVar: VarMappingTaskToRecordIdInputForm2 
  pluginOutputMappingVar: VarMappingTaskDetailToTask1

ensure var VarConditionHasRelatedToIdAndValue kind: condition 
  deploy: fixedOnDeploy
  sourceForm: EntityTask
  value: "<root>
      <and>
        <stmt>${f:Other.FormMode} == ${var:VarTextFormModeCreate}</stmt>
        <stmt>${f:Details.RelatedToId} has value</stmt>
        <stmt>${f:Details.RelatedToValue} has value</stmt>
      </and>
    </root>" 

ensure form EntityTask 
ensure formula RelatedTo 
    conditionVar: VarConditionHasRelatedToIdAndValue 
    assignToField: Details.RelatedTo 
    formula: "var d = {};
    d['optionId'] = ${f:Details.RelatedToId};
    d['value'] = ${f:Details.RelatedToValue};
    d
  "
ensure visibilityRule TaskIdChangeVisibilityRule 
  condition: "<root>
      <and>
        <stmt>Details.Id has changed</stmt>
        <stmt>Details.Id has value</stmt>
        <stmt>Other.FormMode has value</stmt>
        <stmt>Other.FormMode == ${var:VarTextFormModeEdit}</stmt>
      </and>
    </root>"

ensure actionMapIfTrue MakeGetTaskDetailButtonClick 
  comp: Other.GetTaskDetailButton 
  visibilityAction: click 
  visibilityActionOn: field

ensure visibilityRule RefreshButtonVisibilityRule 
  condition: "<root>
      <and>
        <stmt>Details.Id has value</stmt>
        <stmt>Other.FormMode has no value</stmt>
      </and>
    </root>"

ensure actionMapIfTrue MakeRefreshVisible 
  comp: Details.Refresh 
  visibilityAction: visible 
  visibilityActionOn: field
ensure actionMapIfFalse MakeRefreshInvisible 
  comp: Details.Refresh 
  visibilityAction: invisible 
  visibilityActionOn: field

ensure visibilityRule AssignToFieldVisibilityRule 
  condition: "<root>
      <or>
        <stmt>Other.FormMode has no value</stmt>
        <stmt>Other.FormMode == ${var:VarTextFormModeCreate}</stmt>
        <stmt>Details.Id has value</stmt>
      </or>
    </root>"

ensure actionMapIfTrue MakeAssignedToInvisible 
  comp: Details.AssignedTo 
  visibilityAction: invisible 
  visibilityActionOn: field
ensure actionMapIfFalse MakeAssignedToVisible 
  comp: Details.AssignedTo 
  visibilityAction: visible 
  visibilityActionOn: field
ensure var VarMappingTaskToSyncDetailInputForm kind: mapping
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: SyncDetailInputForm 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id',
        '${var:VarTextObjectTypeTask}': 'ObjectType'
      }
    }

ensure var VarMappingTaskDetailToTask1 kind: mapping
  deploy: fixedOnDeploy
  fromPlugin: SalesforcePlugin 
  fromForm: TaskDetail 
  toForm: EntityTask 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Details.Id',
        '${f:Details.Subject}': 'Details.Subject',
        '${f:Details.Description}': 'Details.Description',
        '${f:Details.DueDate}': 'Details.DueDate',
        '${f:Details.Status}': 'Details.Status',
        '${f:Details.Priority}': 'Details.Priority',
        '${f:Details.AssignedTo}': 'Details.AssignedTo',
        '${f:Details.RelatedTo}': 'Details.RelatedTo'
      }
    }

ensure var VarMappingTaskToDropObjectDownPicklistInput2 kind: mapping
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: DropObjectDownPicklistInput 
  fieldMappingMap: {
      'map': {
        '${var:VarTextObjectTypeTask}': 'ObjectType',
        '${constant:text.Status}': 'DropdownFieldName'
      }
    }

ensure var VarMappingTaskToDropObjectDownPicklistInput1 kind: mapping
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: DropObjectDownPicklistInput 
  fieldMappingMap: {
      'map': {
        '${var:VarTextObjectTypeTask}': 'ObjectType',
        '${constant:text.Priority}': 'DropdownFieldName'
      }
    }

ensure var VarMappingTaskToRecordIdInputForm2 kind: mapping
  deploy: fixedOnDeploy
  fromForm: EntityTask 
  toPlugin: SalesforcePlugin 
  toForm: RecordIdInputForm 
  fieldMappingMap: {
      'map': {
        '${f:Details.Id}': 'Id'
      }
    }

ensure form EntityTask
ensure section: Details
ensure field Refresh 
  pluginInputMappingVar: VarMappingTaskToSyncDetailInputForm 
  pluginOutputMappingVar: VarMappingTaskDetailToTask1
ensure field Status  
  pluginInputMappingVar: VarMappingTaskToDropObjectDownPicklistInput2 
ensure field Priority  
  pluginInputMappingVar: VarMappingTaskToDropObjectDownPicklistInput1 

ensure section: Other 
ensure field GetTaskDetailButton 
  pluginInputMappingVar: VarMappingTaskToRecordIdInputForm2 
  pluginOutputMappingVar: VarMappingTaskDetailToTask1