Commands provide a generic way of defining a button which can have an execute behaviour.
If a page command uses a single navigate execution it will display as a related page to the side rather than with the rest of the commands at the top of the page.
command AcceptTaskCommand { label = "Accept"; style = IconOnly; icon = "mail"; variable VarTaskMsgAccept; variable VarAcceptTaskOrgId; enabled = [(Objstate = "Queued" or Objstate = "New")]; execute { // execute here } }
Partially supported
call CompletionAction(CompletionTemp, FocusIdTemp) into TempVar;
Partially supported
navigate TimeReportsPage(WoNo); navigate back; navigate "ifs-map://location?lat=123&long=123"; navigate "ifs-map://location?address=abcefg";
If the string inside a navigate
command contains the prefix 'ifs-apk://' followed by the Application package name and if the required app is installed on the device, the application will be launched.
navigate "ifs-apk://com.ifsworld.quickfacts";
To navigate back to a specific page, follow the example below
navigate { page WorkOrderListsPage { mode = BackRetainFullscreen; } }
The mode
can be set to either one of the following
BackRetainFullscreen
Back
Forward
(default)navigate WorkOrderListsPage;
Back
or BackRetainFullscreen
to a page you have not visited before, the command will not do anything.See the Reporting documentation for more information on how to use the print keyword.
Upload from commands support uploading to media, documents and binary attributes. The upload does not happen straight away and instead is queued to be done during the sync processes.
The name of the file being uploaded can be accessed in the call using component.FileSelectorName.UploadingFile
.
// variable MediaKeys { // type = Structure(FndMediaKeys); // } upload "MediaItemSet(ItemId=$[MediaKeys.ItemId])/MediaObject" from MediaFileSelector { call CreateAndConnectMedia(LuName, KeyRef, "Name") into MediaKeys; }
When the above specific upload location is detected it is treated as a media attachment.
The CreateAndConnectMedia
call should be implemented from an offline procedure using the Attachment.CreateAndConnectMedia
system call. See the procedures documentation for more information.
// variable DocumentKeys { // type = Structure(FndDocumentKeys); // } upload "DocIssueSet(DocClass=$[DocumentKeys.DocClass],DocNo=$[DocumentKeys.DocNo],DocSheet=$[DocumentKeys.DocSheet],DocRev=$[DocumentKeys.DocRev])/EdmFileReferenceArray(DocClass=$[DocumentKeys.DocClass],DocNo=$[DocumentKeys.DocNo],DocSheet=$[DocumentKeys.DocSheet],DocRev=$[DocumentKeys.DocRev],DocType='ORIGINAL',FileNo=1)/FileData" from DocumentFileSelector { call CreateAndConnectDoc(LuName, KeyRef, "Title") into DocumentKeys; }
When the above specific upload location is detected it is treated as a document attachment.
The CreateAndConnecDoc
call should be implemented from an offline procedure using the Attachment.CreateAndConnectDoc
system call. See the procedures documentation for more information.
upload "WorkOrders(WoNo=$[WoNo])/Image";
Sets the binary attribute in the specified record to be the file data. The data in the client database is updated and a message is queued to update the server attribute at the next sync.
command CommandBarcode { variable VarA; label = "Barcode Test"; enabled = [true]; execute { barcode into VarA { when OK { alert("${VarA}"); } when CANCEL { alert("Cancel"); } } } }
Sets the value from a barcode scan into a variable.
See Transfer and Receive documentation for more information
command ShowLocation { label = "Show Location"; enabled = [true]; variable Latitude Number; variable Longitude Number; execute { location into (Latitude, Longitude); } }
Gets the users device location (latitude and longitude) using GPS.
The expanded form can be used to see if retrieving the location succeeded. This will return CANCEl if location tracking has been disabled by the user or application parameters.
location into (Latitude, Longitude) { when OK { alert("${Latitude}, ${Longitude}"); } when CANCEL { alert("Unable to get location"); } }