Skip to content

Commands

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  
   }  
}  

Supported Command Properties

  • emphasis
  • enabled
  • execute
  • icon
  • label
  • style
  • variable
  • visible

Executions

Call (Action or Function)

Partially supported

call CompletionAction(CompletionTemp, FocusIdTemp) into TempVar;  

Limitations

  • All calls are asynchronous so cannot return results. We cannot wait for data to come back from the server. If the app is offline we cannot get a response.
  • Call using the ‘into’ statement is only supported if an offline procedure has been implemented which returns a value.

Partially supported

navigate TimeReportsPage(WoNo);  
navigate back;  
navigate "ifs-map://location?lat=123&long=123";  
navigate "ifs-map://location?address=abcefg";  

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
  • If for example you have navigated through to a full screen list, this will return to that list
  • Back
  • If you have navigated through to a full screen list, this option will take you back to the page that opened that list
  • Forward (default)
  • This is effectively the same as doing: navigate WorkOrderListsPage;

Limitations

  • Only the declarative format is supported. Using URLs* is not applicable within a native app since the application is not ran within a web browser.
  • *Map URLs which are defined in the format above will open the native map application (Bing maps for Windows, Google maps for Android and Apple / Google maps for iOS) to display the location specified. Must have either latitude and longitude, or address parameters.
  • If navigating Back or BackRetainFullscreen to a page you have not visited before, the command will not do anything.

Print

See the Reporting documentation for more information on how to use the print keyword.

Upload

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.

Media

// 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.

Documents

// 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.

Binary Attributes

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.

Barcode

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.

Transfer and Receive

See Transfer and Receive documentation for more information

Location

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");  
   }  
}  

Other Supported Executions

  • dialog
  • toast
  • exit
  • confirm
  • inquire
  • alert
  • set
  • if
  • set