Dynamics Mobile provides an integrated cross-platform mobile environment allowing the developers to develop enterprise mobile apps targeting multiple mobile platforms with a single piece of code.

The document contains a reference to the Dynamics Mobile Javascript API, which is used within the Dynamics Mobile mobile development environment.

There is section for each javascript namespace/object which can be used during the development.

$ma

The $ma object is the root object(namespace) for the APIs provided by Mobile Affairs.

Method Description
version Returns the version of the CORE library
userName Returns the current username. The property is an alternative of the $ma.uiManager.getUserName function

$ma.uiManager

The $ma.uiManager object provides members and methods related to the user interface management

Following the list of the public methods of the $ma.uiManager instance:

Method Description
navigate(routeName) Performs navigation to the route specified by the routeName argument

 

cancel() Terminates current task and navigates UI to the tasks list. The current view validation logic will be skipped.
The code after this method will be skipped.
runTask(globalTaskId,viewId,preserveContext) Starts another task and aborts current task execution.
Note that the code after will never be executed.The function expects the developer to pass:globalId: task’s global identifier, which is a GUID string visible in the Tasks list in MA Studio
viewId: viewId:  optional ID(name) of a view , referred in the task to be used as a starting view of the task
preserveContext: optional boolean argument controling if the task’s context must be preserved and not cleared.
the task context is cleared by default when a new task is started$ma.uiManager.runTask(‘da49b38c-c3b7-4cfc-87f2-0309afccd19e’);$ma.uiManager.runTask(‘da49b38c-c3b7-4cfc-87f2-0309afccd19e’,56);$ma.uiManager.runTask(‘da49b38c-c3b7-4cfc-87f2-0309afccd19e’,56,true);$ma.uiManager.runTask(‘da49b38c-c3b7-4cfc-87f2-0309afccd19e’,undefined,true);
isTaskAllowed(globalTaskId) The function returns true if the task identified by the globalTaskId parameter is allowed for execution for the device.
The globalTaskId parameter must contain a global task identifier visible in the Tasks section of MA Studio for each task.The function can be used together with runTask function in order to hide tasks not allowed for execution by the user.
alert(message,success) [asynchronous method]
Displays alert dialog on the screen with the given message
confirm(message,success) [asynchronous method]

Displays confirm dialog with two buttons – Yes,No. Returns true if the Yes button is clicked.

 

getUserName(success,failure) [asynchronous method]
Returns the name if the current user as a string parameter of the success function
getModuleCode(success,failure) [asynchronous method]
Returns the unique identifier of the current module as a parameter of the success functionyou can also use the synchronous  $ma.moduleCode
showLoadingMessage(completed) [asynchronous method]

Displays a non-modal progress bar on the screen

 

hideLoadingMessage() [asynchronous method]

Hides the progress bar

 

hideNextButton() Hides the built-int NEXT button for the current view

 

showNextButton() Shows the built-int NEXT button for the current view

 

hideBackButton() Hides the built-int BACK button for the current view

 

showBackButton() Shows the built-int BACK button for the current view

 

hideCancelButton() Hides the built-int CANCEL button for the current view

 

showCancelButton() Shows the built-int CANCEL button for the current view

 

hideSystemButtons() Hides all built-int button for the current view

 

showSystemButtons() Shows all built-int button for the current view

 

setNextButton(caption) Changes the caption of the NEXT button – affects only  the current step

 

setBackButton(caption) Changes the caption of the BACK button – affects only  the current step

 

 getTaskAttribute(attributeKey) Returns the value (string) of a specific attribute assigned with the task currently executing. There are several system supported attributes:

$id  – returns the internal unique identifier of the task
$title – returns the untranslated title of the task
$appArea – returns the application area if the task
$description – returns the description of the task
$layer – returns the layer of the task
$globalId – returns the global identifier of the task

The developer can define own attributes by using the “Task Properties” window from MA Studio.

Note that the attribute key is case sensitive

 

logOut() Logs out the user and forces the app to navigate to the Login screen

 

Examples:

$ma.uiManager.alert('Oops, something goes wrong!');
.....
$ma.uiManager.confirm('Do you want to delete this customer?',function(yesNo){
if(yesno)//delete customer logic comes here
});
.....
$ma.uiManager.hideNextButton();
$ma.uiManager.hideCancelButton();
......
$ma.uiManager.alert($ma.userName,function(){
//alert is closed here
});
....
var title = $ma.uiManager.getTaskAttribute('$title');
alert('The task title is '+title);

$ma.uiManager.context

The $ma.uiManager.context object provides methods allowing the views within a task to pass data. The context stores JSON serialized object instances and is cleared after the task completes. It can survive the web browser’s page refresh.

Method Description
set(key,data,success,failure) [asynchronous method]
performs JSON serialization of the given data and stores it inside the context object under the provided key. The success function is called on success and has no parameters. 
get(key,defaultValue,success,failure) [asynchronous method]
returns the data stored under the given key as parameter of the success function. If the data is not found, the defaultValue is returned. The data is de-serielized from it’s JSON representation.
remove(key,success,failure) [asynchronous method]
removes the data stored under the given key from the context object. The success function does not have parameters.
clear(success,failure) [asynchronous method]
clears all data stored in the context object. The success function does not have parameters.

Examples:

//store customer to task's context
var customer = {no:'1',title:'new customer'};
$ma.uiManager.context.set('c1',customer,function(){
//value was set
});
//get stored customer from the context
$ma.uiManager.context.get('c1',undefined,function(value){
alert(value.title);
});

$ma.device

The $ma.device object provides methods related to the device, where the code is executed.

Method Description
getDeviceInfo(success,failure) [asynchronous method]
Returns a structure with information about the device as parameter of the success function. Example structure: {platform:’Android 2.2.’,browser:’Android 2.2′,version:’2.2′,isDevice:true}
error(message) emits error message in the device’s log
warn(message) emits warning message in the device’s log
info(message) emits information message in the device’s log
debug(message) emits debug message in the device’s log
openWebBrowser(url,success,failure) [asynchronous method]
opens the provided url in a new web browser window
getIPAddress(success,failure) [asynchronous method]
returns json object containing the public  IP address of the host (device or mobile browser) as parameter of the success function. The returned json object has one property ‘ip’.
fileSave(fileName,content,success,failure) [asynchronous method]
saves the data provided in the content argument in a local file specified by the fileName argument
fileLoad(fileName,success,failure) [asynchronous method]
returns the content of a local file specified by the fileName argument as parameter of the success function
fileExists(fileName,success,failure) [asynchronous method]
returns true as parameter of the success function if the local file specified by the fileName argument exists
fileDelete(fileName,success,failure) [asynchronous method]
deletes a local file specified by the fileName argument. The success function does not have parameters
location.get(precision, success,failure)  

[asynchronous method]

Returns the information about the current device’s location reported from the device’s GPS and/or WiFi location providers. The function expects 3 params , where the the first parameter is precision and is not used , yet. The next parameters are the success and failure callbacks.

The function passes a location object in the success function with the following structure:

var location = {
long:0.00 ,
lang:0.00,
altitude:0.00,
speed:0.00,
precision:0
}

 

$ma.device.location.get(0,function(location){

console.log(‘latitude:’+location.lat);

console.log(‘longitude:’+location.long);

console.log(‘altitude:’+location.altitude);

console.log(‘speed:’+location.speed);

});

sync() Navigates the app to the SYNCHRONIZATION screen, which allows the use to perform full synchronization with the server side

 

Examples:

$ma.device.error('Ooops, something wrong happended!');
...
$ma.device.getIPAddress(function(addr){
console.log('my ip is '+addr.ip);
});
...
var content = 'some content';
$ma.device.fileSave('myfiles/file.txt',content,function(){
console.log('saved with success');
});
$ma.device.fileLoad('myfiles/file.txt',function(loadedContent){
console.log('loaded from file:' +loadedContent);
});
...
$ma.device.fileExists('myfiles/file.txt',function(exists){
if(exists)
$ma.device.fileDelete('myfiles/file.txt',function(){
console.log('file was deleted');
return;
})
else {
console.log('file does not exists!');
}});

$ma.cfgManager

The $ma.cfgManager object provides methods allowing the developer to work with the server-settings defined for the device’s role. The role’s server settings are managed by the system administrator. They are set of key/value pairs which the administrator can manage. Each module can support multiple server-settings. The exact set of the supported server-settings for a given mobile module is decided by the developer and must be included in the module’s documentation.

Method Description
get(settingName,success,failure) [asynchronous method]
returns the value of the setting with name defined in the settingName parameter. The server-setting’s values are always of type string. If the setting is not defined, the result will be indefined
set(settingName,settingValue,,success,failure) [asynchronous method]
sets the value of the setting with name specified in the settingName parameter. Note that the setitngValue parameter must be of type string or can contain undefined value. The value is set only in the device’s  storage. It will not be sent to server and will “live” until the application is uninstalled. It is visible for all users using the device.

The setting’s name consists of two elements – module’s code and setting-name separated with dot.
if we our module has unique module identifier SLA and if we want to support a server-setting called activateFancyFeature which can have values of “true” and “false” the administrator will manage the setting by specifying the setting like:

SLA.activateFancyFeature = true

Note that other modules can support the same server-setting, but the administrator will have to prepend the other’s module unique identifier:

PLP.activateFancyFeature = false

If the developer wants to check the value of the setting at the mobile side using the javascript API in order to detect if specific feature must be activated or not he will use the following code:

Example:

$ma.cfgManager.get('activateFancyfeature',function(value){
if(value=='true') {
$ma.uiManager.alert('The feature is activated');
}
else{
$ma.uiManager.alert('The feature is NOT activated');
}});
//Note that the developer does not need to prepend the server-setting name with the module's code. It is automatically done behind the scene from the framework.
//If the developer needs to store specific key-value pairs for the particular device the $ma.cfManager object is the ideal candidate:
$ma.cfgManager.get('lastDocumentNumber',function(lastDocumentNumber){
if(lastDocumentNumber){
lastDocumentNumber = parseInt(lastDocumentNumber);
}
else{
lastDocumentNumber=0;
}
//increase the number and use it in some document releated operations
lastDocumentNumber++;
//....
$ma.uiManager.alert('this is {0} the new "last" number, now ').format(lastDocumentNumber);
//save the lastDocumentNumber setting in the mobile device's memory
$ma.cfgManager.set('lastDocumentNumber', lastDocumentNumber.toString());
});

$ma.dataManager

The $ma.dataManager object provides methods allowing the developer to work with data stored in the mobile storage of the device via raw SQL queries. The underlying storage engine is based on SqLite. The developers can read the SqLite documentation for more info about the format of the queries.

Method Description
fetchsql(sql,success,failure) [asynchronous method]
Executes SELECT SQL query supplied in the sql parameter and 
returns array of objects as parameter of the success function.Each object in the array represent a table row. Each row has a number of fields which can be accessed as jabascript members
execsql(sql,success,failure) [asynchronous method]
Executes sql without returning a result. Used it with INSERT, UPDATE and DELETE queries. The actual query is passed in the sql parameter. The success function has no parameters.

If the developer wants to fetch all customers from the SL_Customer database table, he can use he following code:

$ma.dataManager.fetchsql('select * from SL_Customer order by fName',function(rows){
console.log('{0} rows fetched'.format(rows.length));
for(var i=0;i<rows.length;i++){
console.log('{0} customer'.format(rows[i].fName));
}});
//The develloper can insert execute sql queries using the following approach:
$ma.dataManager.execSql("delete from SL_Customer where no='123131' ",function(){
console.log('success')
},function(errorMessage){
console.log('failure:'+errorMessage)
});

$ma.printManager

The $ma.printManager object provides methods allowing the developer to work with printers connected to the device via Bluetooth.

Method Description
getPrinters(success,failure) [asynchronous method]
The function is used to obtain the list of the currently Bluetooth-paired devices. Note that the function returns all devices not matter if it is a printer or not. The developer can implement additional functionality to remember the names of devices which are identified by the mobile user as printer and stored in $ma.cfgManager$ma.printManager.getPrinters(function(printers){foreach(var i in printers){console.log(printers[i].name);}
}
)
print(printerName, textToPrint,
pageWidth, pageHeight,
encoding,insecure,
success,failure)
[asynchronous method]
The function  prints the text passed into the textToPrint parameter  to the printer specified by the printerName parameter. Following description of the parameters:
– printerName  – contains the name of the printer where the text must be printed. The printerName is a valid name returned by the getPritners function. The printer must be paired and ready to print.
– textToPrint – the actual text sent to the printer.
– pageWidth – page width in printable characters
– pageHeight – page height in printable characters
– encoding – the encoding of the text
– insecure – true or false  which specify if secured Bluetooth connection must be established between the device and the printer. Note that some old mobile devices may not support secured Bluetooth connections , which may cause printing errors. This can be solved by passing false into the insecure parameter

var document = "Hello World\n";
docment+="Line2\n";
document+="Line3\n";
$ma.printerManager.getPrinters(function(printers){
$ma.printManager.print(printers[0].name,document,80,999,
'utf-8',false,
function() {
console.log('printed');
},
function(error){
console.log('print error:'+error);
}
)
});

$ma.bo.[module-id].BusinessObjectType

The $ma.bo namespace allows the developer to work with the mobile data using a simple Object Relational Management (ORM) style syntax. It allows the developer to query and create/update/insert data using the business object concept supported by MACloud Studio.

Each mobile module has unique two or three letter identifier specified by the developer. Each module can have many business objects defined via MACloud Studio. Let’s assume the developer develops a module with unique module identifier SLA. The developer can refer to the declared business objects in the SLA module by using the $ma.bo.SLA namespace like this:

$ma.bo.SLA.Customer

$ma.bo.SLA.Item

$ma.bo.SLA.Payment

In the example above we have 3 business objects – Customer, Item and Payment. These three business objects actually corresponds to database tables. Each business object instance corresponds to a table row.

Each business object type has the following static ( class level ) methods.

Method Description
fetch(primaryKey,success,failure) [asynchronous method]
Retrieves a single business object instance from the mobile storage. The retrieved object is passed as parameter of the success function.The system will try to retrieve a business object instance with the specified primary key. If  the corresponding business object instance is not found, the method will return value of undefined
fetchAll(whereClause, orderClause, limit,success,failure) [asynchronous method]
Retrieves an array of business objects filtered with the expression supplied in the whereClause parameter. The retrieved business objects are passed as single array parameter to the success function.The retrieved business objects will be ordered according to the expression supplied in the orderClause parameter. The limit parameter will limit the maximum number of instance retrieved.

So, if we want to query a list of customer business object instances and filter them by name, we can use the following code:

Example:

var pattern = '%sometext%';
$ma.bo.SLA.fetchAll('fName like "'+pattern+'"','no descending',50,function(customers){
//iterate over the resulting list of customers
for(var i=0;i<customers.length;i++){
//display the value of the someProperty property for each customer
console.log(customers[i].someProperty);
}});

In the example above we filter only the customers, which contains some text in their fName property ( or column). We provide a sql-where clause to filter the customers by their fName property. We also limit the maximum number of the returned customers to 50 by supplying it as parameter to the fetchAll method. The result from the fetchAll method is an array of customer business object instances referred as customers variable. We can then iterate over the array and access each of the Customer instances and make anything with them – reading a property and displaying the value on the screen in this case.

Each business object instance has the following instance level methods:

Method Description
add(success,failure) [asynchronous method]
Inserts the business object instance as new record in the device storage. The success function does not have parameters
update(success,failure) [asynchronous method]
Updates the changes of the business object instance in the device storage. The success function does not have parameters.
del(success,failure) [asynchronous method]
Deletes the business object from the device storage. The success function does not have parameters.

We can use these methods to insert, update or delete the business object from the database. Let’s fetch a list of existing customers , change something for each fo them and save them back to the mobile database:

var pattern = '%somename%';
$ma.bo.SLA.fetchAll('fName like "'+pattern+'"','no descending',50,function(customers){
for(var i=0;i<customers.length;i++){
//assign some value to a property, e.g. making a change in-memory
customers[i].someProperty=124.5;
//update the mobile storage with the changes and send update message to the connected ERP with a single line
//the message will be sent whenever connection is detected
customers[i].update(function(){
console.log('customer saved')
}
);
}}
//create new business object instance
var newCustomer = new $ma.bo.SLA.Customer();
//assign values to the customer's property
newCustomer.no='1234';
newCustomer.fName='';
//insert the new customer instance into the mobile storage database - e.g. inserting a new record into the mobile database
// and send insert message to the connected ERP - the message will be sent whenever connection is detected
newCustomer.add(function(){
console.log('customer was saved');
});
//fetch a single business object instance
$ma.bo.SLA.Customer.fetch('1234',function(oldCustomer){
if(oldCustomer){
//delete the business object instance from the mobile storage
// and send delete message to the connected ERP
oldCustomer.del(function(){
console.log('customer was deleted');
});
}});

$ma.liveLink

The $ma.liveLink object allows the developer to communicate with the MACloud service via the standard communication channel. Most of the methods found within the $ma.liveLink object require online connection from the mobile device to MACloud.

Method Description
postToSyncLog(businessObjectInstanceOrAarray,success,failure) [asynchronous method]
Sends the business object instance supplied in the  businessObjectInstanceOrArray parameter  formatted as SyncPacket to MACloud.This operation will force MACloud to send the packet to the application’s area connector, which in turn will merge the SyncPacket into the ERP’s database.The method will try to send the business object over the wire. If connection fails, the business object will be cached on the device and sent later automatically, when possible.The  businessObjectInstanceOrArray can hold a single business object instance or array of business object instances. The business object instances are converted to JSON and sent over the wire. They are converted to XML based SyncPacket from the MACloud service and sent to the ERP via the connector. The success function does not have parameters.
execCommand(commandName,success,failure) [asynchronous method]

Executes a command from the ERP system  – allows the developer to invoke server-side code residing in the ERP system. Returns data fro the ERP represented as javascript objects

Make sure you have assigned a valid company name in:

$ma.uiManager.CompanyName

The name of the company will be forwarded to the underlying ERP.

fetchAll(entityName, where, order, success, failure) [asynchronous method]

Performs query against the remote data storage (ERP) and returns a set of business objects based on the given [where] clause

Example:

//create new invoice document
var invoice = $ma.bo.SLA.Invoice();
//assign some values of the invoice's properties
invoice.no='1234';
invoice.customerName = 'some customer';
nvoice.customerTaxNo='123456789';
invoice.amount = 100;
invoice.amountWithVAT = 120;
invoice.lines=[];
//attach a line object to the invoice
var line = $ma.bo.SLA.InvoiceLinw();
line.no = 'SF-0001';
line.title='red car';
line.quantity=1;
line.amount=50;
invoice.lines.push(line);
//attach another line object to the invoice
line = $ma.bo.SLA.InvoiceLinw();
line.no = 'SF-0002';
line.title='green car';
line.quantity=1;
line.amount=50;
invoice.lines.push(line);
//send the new invoice including the lines to the ERP
//the operation requires the Invoice and InvoiceLine objects to be declared in MACloud Studio Business Object Desginer
$ma.liveLink.postToSyncLog(invoice,function(){
console.log('packet was sent');
});
//invoking on-line code, which runs inside the ERP and receive the result
//for example this can be used to run Microsoft Dynamics NAV codeunit or Microsoft Dynamics AX class method
$ma.uiManager.CompanyName = 'CRONUS International Ltd.'
$ma.liveLink.execCommand("CalcPrice",{customerNo:"123",ItemNo:"45678",Quantity:123},function(result){
alert("The price is"+result.Price);
},
function(err){
alert(err);
});
//selecting records from a local ( on-device) database table
$ma.liveLink.fetchAll($ma.bo.ITA.Customer,'[Balance]>0','[No] asc',100,function(customers){
alert(customers.length+' customers were found');
});

$ma.liveLink.syncPacket

The $ma.liveLink.syncPacket object allows the developer to perform a fine-grained control over the SyncPacket generation process in response to changes in the mobile storage.

Method Description
start() Initializes a new SyncPacket. This method will throw away the existing pending changes.
addEntity(entity) adds business object instance to the sync packet. The business object instance will be sent over the wire as part of the sync packet once the post method is invoked
addEntityArray(arrayOfEntityes) adds an array of business objects to the sync packet. The business object instances added will be sent over the wire as part of the sync packet once the post method is invoked
post(success,failure) Completes the pending SyncPacket and schedules it for sending to MACloud. The actual moment when the packet will sent depends on various conditions. the success function does not have parameters.
cancel() Cancels the current SyncPacket.This method will throw away the existing pending changes.

Example:

try{
$ma.liveLink.syncPacket.start();
var customerBusinessObject2 = new $ma.bo.SLA.Customer();
customerBusinessObject.no="1";
customerBusinessObject.name="someCustomer";
//add the business object in the local storage and queue it for sending to the backend
customerBusinessObject.Add();
var customerBusinessObject2 = new $ma.bo.SLA.Customer();
customerBusinessObject2.no="2";
customerBusinessObject2.name="anotherCustomer";
//add the business object in the local storage and queue it for sending to the backend
customerBusinessObject2.Add();
var customerBusinessObject3 = new $ma.bo.SLA.Customer();
customerBusinessObject3.no="3";
customerBusinessObject3.name="yetanotherCustomer";
//queue the business object for sending to the backend without storing it in the local storage
$ma.liveLink.syncPacket.addEntity(customerBusinessObject3);
// send the packet to server
$ma.liveLink.syncPacket.post(function(){
console.log('success');
});
}
catch(error){
$ma.liveLink.syncPacket.cancel();
$ma.uiManager.alert(error);
}

$ma.docSeries

The $ma.docSeries object allows the developer to work with document numbers tracked on the device/browser.

They can be used to generate and track unique numbers of documents created on the device/browser such as invoices, orders, contracts and others.

The administrator can define a document series using the Application Area Management Console. Each document series contains the following attributes:

  • documentType
    a string defininng the document type. Any string can be used. The following ‘standard’ strings in the standard mobile modules are defined by default:

    • DT0 – order
    • DT1 – invoice
    • DT2 – transfer
    • DT100 – customer
  • current
    integer value containing the last number for the specific document type.
    calls to $ma.docSeries.increaseNumber actually increments the current attribute
  • mask
    a string defining how the document number is actually composed.
    it allows the document numbers to contain leading zeroes or characters.
    Let’s assume we have document series with current value of 999;
    Following some examples about the composed document number using different masks:

{0} , generates 999
{0:00000} , generates 00999
{0:0000} , generates 0999
SF-{0:00000} , generates SF-00999
SF-{0:00000}OR , generates SF-00999OR

invoking $ma.docSeries.getNextNumber will returned the actual number composed from the current value and the mask of the document series for the specified document type

  • max
    specifies the maximum allowed number for the specific document series. Currently it is not forced from the API and is only informational attribute which can be used by the developer
Method Description
getNextNumber(documentType,success,failure) [asynchronous method]

Returns the next number for the document type specified by the documentType argument. The function only returns the next number without actually to persist the new number.

increaseNumber(documentType,success,failure) [asynchronous method]

Returns the next number for the document type specified by the documentType argument. The function  returns the next number and persist the new number on the device/browser.

Flow

The flow of the events regarding the document series goes like this:

Web browser:

  • The user starts a task from the UI
  • The browser retrieves all document series from the server over the network
  • The first step of the task is rendered
  • The next number for a specific document type is retrieved by invoking $ma.docSeries.getNextNumber method
  • The number returned is used in certain way by the developer
  • The next number is persisted in memory by invoking $ma.docSeries.increaseNumber method
  • All changes ( the new number increased ) is persisted to server by invoking $ma.docSeries.saveAll

Mobile device ( Android, iOS):

  • The user starts a task from the UI
  • The device retrieves all document series from device’s local storage
  • The first step of the task is rendered
  • The next number for a specific document type is retrieved by invoking $ma.docSeries.getNextNumber method
  • The number returned is used in certain way by the developer
  • The next number is persisted in memory by invoking $ma.docSeries.increaseNumber method
  • All changes ( the new number increased ) is persisted to the device local storage by invoking $ma.docSeries.saveAll
  • The changes in the document series in the device local storage are sent to the server whenever it launches the synchronization process either manually or automatic

Example:

//create some document using business object
$ma.docSeries.getNextNumber("DT1",function(newDocNo){
var invoice = new $ma.bo.SLA.SalesHeader();
//assign a new document number for the invoice, assuming the invoice document number
//is tracked under DT1 document type
invoice.No = newDocNo;
// modify some of the invoice attributes
invoice.amount = 10.00;
//save the invoice in the storage
invoice.add();
//increase the document serie current value after successfull persistance of the invoice
$ma.docSeries.increaseNextNumber();
//persist all document series changes in the storage
},function(error){
alert('error');
});

$ma.utils

The $ma.utils object provides a set of general tools.

Method Description
trim(str,char) Trims the character given in the char parameter from the string given in the str parameter from the both ends.
ltrim(str,chars) Trims the character given in the char parameter from the string given in the str parameter from the left side only
rtrim(str,chars) Trims the character given in the char parameter from the string given in the str parameter from the right side only
isInteger(number) Returns true if the given number is integer
isFloat(number) Returns true if the given number is float
extendInstance(instance, superClass) Returns new object instance containing the properties from instance  “inheriting” the superClass

Example

var str = "-12345-";
var x = $ma.utils.trim(str,'-');
console.log(x);// prints 12345
var str = "-12345-";
var x = $ma.utils.ltrim(str,'-');
console.log(x); // prints 12345-
var str = "-12345-";
var x = $ma.utils.rtrim(str,'-');
console.log(x);// prints -12345

$ma.utils.dates

The $ma.utils.dates object provides a set of date related tools

Method Description
convert(d) Converts the date in d to a date-object. The input can be:
a date object: returned without modification
an array : Interpreted as [year,month,day]. NOTE: month is 0-11.
a number : Interpreted as number of milliseconds
since 1 Jan 1970 (a timestamp)
a string : Any format supported by the javascript engine, like
“YYYY/MM/DD”, “MM/DD/YYYY”, “Jan 31 2009” etc.
an object : Interpreted as an object with year, month and date
attributes. **NOTE** month is 0-11.
eq(a,b) Returns true if the dates passed in a and b are equal
lt Returns true if the date passed in a is before b
gt Returns true if the date passed in a is after b
between(d,start,end) Returns true if the date given in d is between start and end

Example:

var d1 = $ma.utils.dates.convert('01/01/2013');
var d2 = $ma.utils.dates.convert('01/01/2014');
if($ma.utils.dates.eq(d1,d2))
alert("equal");
if($ma.utils.dates.lt(d1,d2))
alert("lower");
if($ma.utils.dates.gt(d1,d2))
alert('greater');
var d3 = $ma.utils.dates.convert('5/5/2013');
if($ma.utils.dates.between(d3,d1,d2))
alert('between');

$ma.utils.utf8

The $ma.utils.utf8 object provides a set of date related tools

Method Description
encode(url) Returns encoded url
decode(url) Returns decoded url

Extensions

There are several extensions over the standard javascript objects/types

Method Description
String.padLeft(len,char) Adds the given char to the left side of the string, so that the total length of the string to be equal to len
String.padRight(len,char) Adds the given char to the right side of the string, so that the total length of the string to be equal to len
String.format(stringFormat,args) Returns a formatted string by given stringFormat and args
Date.toSqLiteFormat() Returns a string representation of the date suitable for usage in SqlLite queries
Date.format(format) Returns a string representation of the date by given format
String.dateFromSqLiteFormat(date) Converts a SqLite string date to javascript date object

Example

var x = "1234";
var y = x.padLeft(x,'0');
console.log(y); //prints 001234
y = x.padRight(x,'0');
console.log(y); //prints 123400
var y = "My name is {0} {1}".format('John','MCloud');
console.log(y); //prints My name is John MCloud
var d = new DateTime();
var query = "select * from mytable where startdate>'"+d.toSqLiteFormat()+"'";
var d = new DateTime();
console.log(d.format('DD/MM/YYYY'));

Other

Method Description
$.base64.encode(plainText) Returns base64 encoded string generated from the string passed in stringContent
$.base64.decode(base64Text) Returns decoded string from the base64 encoded string
ko.observableArray.fromArray(array) Returns ko.observableArray from a given normal array

Example

var encoded = $.base64.encode("1234");
var decoded = $.base64.decode(encoded);
//-------------------------------------------------
var standardArray = [1,2,3];
var observableArray = ko.observableArray();
observableArray.fromArray(standardArray);

Last Updated: Dec 1, 2015

We provide public releases of our products once a year or more and commit to 12 months support for all public releases. We also provide releases to support the new versions of Microsoft Dynamics NAV and Microsoft Dynamics AX within 12 months after a new version of the ERP is released.

We envision the support as a major component of our effort to provide our customers with mission critical software solutions. We provide support services to customers in order to guarantee their business continuity. Our customer shall report issues or other cases, which requires support. The reporting is performed by authorized personnel from the Customer’s side via the standard support channels described below.

The support is provided in order to:

  • Solve current problems reported by authorized representatives of the Customer on occasion and in connection with Dynamics Mobile
  • Diagnose problems in connection with the standard system functionality
  • Diagnose problems in connection with the functionality customized by Dynamics Mobile team
  • Analyze and eliminate of any “defect” – a mistake in the program code of functionality, whcih affects the Client’s operations

The support services are only provided in response to a support request submitted by authorized personnel from the Customer’s side via any of the support channels:

  • -e-mail: support@dynamcsmobile.com
  • -phone: 00359 2 817 33 63

We provide different response times to support requests based on the request priority as follows:

Priority Reaction time Description
Critical to 2 hour Causes business process block.
Medium up to 8 hours Affects the business process as there are no work around actions.
Low up to 2 business days Low impact issues and requests, which does not affect the system.