Dynamics Mobile CLI

Command line tool for developers

Overview

Dynamics Mobile CLI is a command line tool installed together with the Dynamics Mobile NPM module.

The tool shall be used by developers during they daily activities as well in CI/CD scenarios.

Command list

The Dynamics Mobile CLI provides a set of command line commands to help the developer to initialize new project, attach apps to application area in Dynamics Mobile Platform , etc.

Following list of the supported commands

Command

Description

init

initializes new application repository, e.g. this is the way to start a new project

help

print outs the list of the supported commands with short description

login

"attaches" current environment to specific application area in Dynamics Mobile Platform

data

upload test data to the current application area

info

print outs summary for the current repository

logout

"de-attaches" the environment from the application area

refresh

similar to init, but overrides only the dynamics mobile sdk files

Commands guide

init

Do not execute the init command over existing repository ( e.g. existing app) as the app initialization process may override files

create new mobile application project

//set current folder to the new mobile app repository
> cd myapp
//initialize the folder with a new mobile app
> dms init --app MYAPPCODE --type m

create new backend app

//set current folder to the new backend app repository
> cd myapp
//initialize the folder as a new mobile app
> dms init --app MYAPPCODE --type b

help

The help command print outs the list of the supported commands in the command window

> dms help

login

The login command requires username, password and application area to attach the current environment to Dynamics Mobile Platform. Note that all other CLI commands, which requires authentication will be executed against the application area supplied for the login command

The effect of the login command is global, e.g. per machine user. This means that once the login command is executed, all subsequent CLI commands from this machine/user will be executed against this application area, no matter what is the current folder. Use dms info command to check the current application area.

> dms login --u myuser@dynamicsmobile.com --p 123somelongpass --a DEVAPPAREA

You can NOT an build and run your app via npm run build or via Visual Studio Code F5/Debug command unless the dms login command is executed.

data

The data command, uploads test data to Dynamics Mobile platform. It requires the current environment to be attached to Dynamics Mobile Platform via the login command.

//uploads file ./Data/init.xml to the mobile simulator for the user activated with dms login
> dms data
//uploads file ./Data/init.xml to the mobile simulator for user myuser@dynamicsmobile.com
> dms data --u myuser@dynamicsmobile.com

//uploads file ./Data/init.xml to sandbox for the user activated with dms login
> dms data --file ./myfile.xml
//uploads file ./myfile.xml to sandbox for user myuser@dynamicsmobile.com
> dms data --file ./myfile.xml --u myuser@dynamicsmobile.com

//uploads file ./Data/init.xml to sandbox for the user activated with dms login
> dms data --m dev --file ./myfile.xml
//uploads file ./myfile.xml to sandbox for user myuser@dynamicsmobile.com
> dms data --m dev --file ./myfile.xml --u myuser@dynamicsmobile.com

Using --m prod switch will publish the data to the production environment.

For mobile apps, this will "override" the mobile database for the given user.

For backend apps, this will "override" the entire production database, so use with caution.

//uploads file ./Data/init.xml to production for the user activated with dms login
> dms data --m prod --file ./myfile.xml
//uploads file ./myfile.xml to production for user myuser@dynamicsmobile.com
> dms data --m prod --file ./myfile.xml --u myuser@dynamicsmobile.com

info

The info command prints out the following information on the screen:

  • Current global application area ( requires dms login command to be executed)

  • Current global username

  • Current application code ( if the current folder is valid application repository)

  • Current application version ( from package.json)

  • Current application type - backend (b) or mobile (m)

> cd myapp
> dms info
------------------------------------
| Dynamics Mobile |
| App Framework v.0.39.570 |
| 2009-2019 All rights reserved |
| www.dynamicsmobile.com |
------------------------------------
Repository information:
Application area: MYAPPAREA
Username: someuser@dynamicsmobile.com
You can use the 'login' command to change the application area or username
App code: MYAPPCODE
App version: 1.0.120
App type: m

logout

"De-attaches" the current environment from the application area. The command wipes out the current authentication info, which will makes some of the CLI commands non-usable unless the dms login command is executed again.

> dms logout

refresh

The refresh command "refreshes" the current application repository with the latest sdk files. It is designed to be used after the latest version of the dynamics mobile sdk was installed.

Make sure you have commited all changes in your local application repository before executing the refresh command to avoid any data loss.

> cd myapp
> npm install dynamicsmobile@latest
> dms refresh