Understanding mApp Permission Levels
Admin: Same as Editor unless unless this app does not allow creation of new records (ie: mApp.restrictNewRecords = true)
Editor: Can edit most fields including the yes/no field to denote that the coordinator/PM has reviewed the report (ie: mApp.dnReviewed)
User: Can edit most fields Except the yes/no field to denote that the coordinator/PM has reviewed the report (ie: mApp.dnReviewed)
Viewer: Cannot edit any fields.
Remember to Update the actual Data Event functions
The mApp module needs to be started ON load with the mApp.start method. The typical default starting data events functions would look like:
ON('load-record', mApp.start);
//ON('new-record', clearNew) //Not part of mApp, write this custom for each app
ON('new-record', mApp.enterReportID)
ON('change', mApp.dnSubmit, mApp.updateStatus)
ON('change', mApp.dnReviewed, mApp.updateStatus)
ON('change', mApp.dnReviewed, mApp.addCoordinatorInitials)
ON('change', 'date', mApp.enterReportID)
Mixins
Mixins include preformatted boilerplate setups for various scenarios. The StatusMixins is a frequently used one that contains the function to update the record status for commonly used Status set ups.
Status Mixins
active_resolved:
active_resolved_pd:
draft_complete:
p_s_complete:
p_s_c_f_resolved:
p_s_c_f_resolved_date:
MerjentApp Cheat Sheet
Quick reference for all MerjentApp configuration properties.
Set these in your data event script before calling mApp.start().
const mApp = module.exports.MApp
mApp.dnSubmit = 'submit_report'
mApp.statusMethod = StatusMixins.p_s_complete
// ... set properties below ...
ON('load-record', mApp.start);
Permission Settings
| Property | Type | Default | Description |
|---|---|---|---|
restrictNewRecords |
boolean | false |
Disable creation of new records except for permission levels in newRecordCreators |
newRecordCreators |
string[] | ['Admin'] |
Permission levels allowed to create new records (only used when restrictNewRecords is true) |
adminNames |
string[] | ['Jason Hendricks', 'Amanda Johnson'] |
User names with Admin privileges. Names must match exactly (case-sensitive). |
editorNames |
string[] | [] |
User names with Editor privileges |
userNames |
string[] | [] |
User names with User privileges |
viewerNames |
string[] | ['Field User 1', 'Field User 2'] |
User names with Viewer (read-only) privileges |
adminRoles |
string[] | [] |
Fulcrum role names that get Admin privileges |
editorRoles |
string[] | [] |
Fulcrum role names that get Editor privileges |
userRoles |
string[] | [] |
Fulcrum role names that get User privileges |
viewerRoles |
string[] | [] |
Fulcrum role names that get Viewer privileges |
defaultPermissionLevel |
string | 'User' |
Default permission level for users not listed in any Names/Roles array. Options: Admin, Editor, User, Viewer |
Lock Settings
| Property | Type | Default | Description |
|---|---|---|---|
lockOnLoad |
boolean | true |
Check for fieldLock conditions when record loads. Set to false to skip automatic locking. |
fieldLockCondition |
string[] | ['Submitted'] |
Status values that trigger partial field lock. Use [] to disable. |
fieldLockExclude |
string[] | [] |
Data names of fields excluded from field lock (remain editable). Runtime default: [dnSubmit]. |
completeLockCondition |
string[] | ['Complete', 'Resolved'] |
Status values that trigger complete record lock (all fields). Use [] to disable. |
completeLockExclude |
string[] | [] |
Data names excluded from complete lock (Admin only). Runtime default: [dnSubmit, dnReviewed]. |
Photo Settings
| Property | Type | Default | Description |
|---|---|---|---|
photoCapMax |
integer | 1258 |
Maximum characters allowed in a photo caption before warning |
requireLandscape |
boolean | false |
Require landscape orientation for photos in dnPhotoLoc field |
setLocoff1photo |
boolean | false |
Set record location from first photo's GPS coordinates in dnPhotoLoc field |
disableLocationEdit |
boolean | false |
Prevent User and Editor from manually editing record location |
dnPhotoLoc |
string | 'site_photos' |
Data name of primary photo field for location setting and landscape validation |
allPhotos |
string[] | ['site_photos'] |
Data names of all photo fields to validate for captions and character limits |
Data Name Mappings
| Property | Type | Default | Description |
|---|---|---|---|
dnAutoName |
string/null | null |
Data name of field to auto-populate with user's full name on new records. Set to null to disable. |
dnDt |
string | 'date' |
Data name of the primary report date field |
dnDueDate |
string | 'due_date' |
Data name of the due date field. Used by active_resolved_pd status method. |
dnReportID |
string | 'report_id' |
Data name of the report ID field (auto-generated identifier) |
dnSubmit |
string/null | 'submit_report' |
Data name of submit field. Checked for 'yes' to trigger field lock. Set to null to disable updateStatus. |
dnReviewed |
string | 'coordinator_reviewed' |
Data name of coordinator reviewed field. Checked for 'yes' to trigger complete lock. |
dnCoordinatorInitials |
string | 'coordinator_initials' |
Data name of field to store coordinator's initials when dnReviewed is checked |
dnFollowUp |
string | 'follow_up_required' |
Data name of follow-up required yes/no field |
dnResolved |
string | 'resolved_date' |
Data name of follow-up resolved field (yes/no or date) |
dnFollowUpRepeatable |
string | 'follow_up_report' |
Data name of the follow-up repeatable section |