Submit week for approval

From 3B Knowledge
Jump to navigation Jump to search

Introduced in version 2.1.

Submitting a week for approval through the timesheet submission component requires the configuration of 4 properties on the shift and expense schedulable definition like follows:

{
    "schedulable": {
        "shift": {
            ...
            "canEdit":{
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"isnull",
                         "value":true
                      }
                   ]
                }
             },
             "canDelete":{
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"isnull",
                         "value":true
                      }
                   ]
                }
             },
             "isSubmitted": {
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"equals",
                         "value": "Submitted"
                      }
                   ]
                }
             },
             "submissionFormFields":[
                {
                   "field":"b3s__Approval_Status__c",
                   "type":"field-select",
                   "required":true,
                   "disabled":true,
                   "default":"Submitted"
                }
             ]
             ...
        },
        "expense": {
            ...
            "canEdit":{
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"isnull",
                         "value":true
                      }
                   ]
                }
             },
             "canDelete":{
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"isnull",
                         "value":true
                      }
                   ]
                }
             },
             "isSubmitted": {
                "condition":{
                   "allOrSome":"all",
                   "selectors":[
                      {
                         "field":"b3s__Approval_Status__c",
                         "operator":"equals",
                         "value": "Submitted"
                      }
                   ]
                }
             },
             "submissionFormFields":[
                {
                   "field":"b3s__Approval_Status__c",
                   "type":"field-select",
                   "required":true,
                   "disabled":true,
                   "default":"Submitted"
                }
             ]
             ...
        }
    }
}

Digest:

  • canEdit - whether or not the schedulable can be edited. A safe assumption is that submitted schedulables cannot be edited
  • canDelete - whether or not the schedulable can be deleted. A safe assumption is that submitted schedulables cannot be deleted
  • isSubmitted - tells the application whether the record is already submitted or not. In the example, the field Approval Status must be "Submitted". You might need to modify this to also include "Approved", "Rejected" and "Queried"
  • submissionFormFields - an array of fields to be displayed to the user before submitting the records.


Note: The button "Submit expenses" and "Submit shifts" will become visible only if all shifts/expenses for the period are NOT submitted. If a single instance is found that is submitted, the button will be hidden. This is intentional design.