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
profile
local profile management
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
livelink
executes livelink query and print outs the result in the terminal

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
1
//set current folder to the new mobile app repository
2
> cd myapp
3
//initialize the folder with a new mobile app
4
> dms init --app MYAPPCODE --type m
Copied!
create new backend app
1
//set current folder to the new backend app repository
2
> cd myapp
3
//initialize the folder as a new mobile app
4
> dms init --app MYAPPCODE --type b
Copied!

help

The help command print outs the list of the supported commands in the command window
1
> dms help
Copied!

profile

The profile command allows management of the local profile.
Dynamics Mobile developers need to have an account on the Dynamics Mobile platform in order to be able to create apps. The development tools ( like Dynamics Mobile SDK and Dynamics Mobile CLI ) authenticate against the Dynamics Mobile Platform on behalf of the developer by using API key.
The profile command allows the developer to locally create one or more profiles where every profile contains application area and api key and then quickly switch between them from the command line allowing the developer to easily work with multiple accounts and application areas.
1
> dms profile --o [operation] [more parameters]
Copied!
The profile command takes --o parameter which determines the operation which shall be performed over the profile[s].
Creating new local profile You can create new profile locally by executing the following command:
1
dms profile --o create --a MyAppArea --k XXXXXXXX
Copied!
Login to already created profile You may activate existing profile by executing this command:
1
dms profile --o login --a MyAppArea
Copied!
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.
Delete existing profile You may delete locally stored profile by executing the following command: NOTE: this command will only delete the stored information from your local machine. It will not affect the actual application area or other machines.
1
dms profile --o delete --a MyAppArea
Copied!
Getting the list of the existing local profiles This will show a list of already created profiles on your machine.
1
dms profile --o list
Copied!
You can NOT an build and run your app via npm run build or via Visual Studio Code F5/Debug command unless the dms profile --o 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.
1
//uploads file ./Data/init.xml to the mobile simulator for the user activated with dms login
2
> dms data
3
4
//uploads file ./Data/init.xml to the mobile simulator for user [email protected]
5
> dms data --u [email protected].com
Copied!
1
//uploads file ./Data/init.xml to sandbox for the user activated with dms login
2
> dms data --f ./myfile.xml
3
4
//uploads file ./myfile.xml to sandbox for user [email protected]
5
> dms data --f ./myfile.xml --u [email protected].com
Copied!
1
//uploads file ./Data/init.xml to sandbox for the user activated with dms login
2
> dms data --m dev --f ./myfile.xml
3
4
//uploads file ./myfile.xml to sandbox for user [email protected]
5
> dms data --m dev --f ./myfile.xml --u [email protected].com
Copied!
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.
1
//uploads file ./Data/init.xml to production for the user activated with dms login
2
> dms data --m prod --f ./myfile.xml
3
4
//uploads file ./myfile.xml to production for user [email protected]
5
> dms data --m prod --f ./myfile.xml --u [email protected].com
Copied!

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)
1
> cd myapp
2
> dms info
3
4
------------------------------------
5
| Dynamics Mobile |
6
| App Framework v.0.39.570 |
7
| 2009-2019 All rights reserved |
8
| www.dynamicsmobile.com |
9
------------------------------------
10
11
Repository information:
12
Application area: MYAPPAREA
13
Username: [email protected].com
14
You can use the 'login' command to change the application area or username
15
App code: MYAPPCODE
16
App version: 1.0.120
17
App type: m
Copied!

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.
1
> dms logout
Copied!

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.
1
> cd myapp
2
> npm install [email protected]
3
> dms refresh
Copied!

livelink

The command executes livelink request and prints or saves the result in a file. It allows the developer to craft and play with ODATA queries right into the terminal and export data to CSV, JSON and SyncPacket (XML) files.
All command livelink queries are executed against the current application area with the user credentials acquired with the dms login command beforehand.
All command livelink queries are also executed against the sandbox storage of the current user ( the sandbox storage is a temporary storage separated for each user). The sandbox mode can be overridden with switch --mode prod
All command livelink queries are executed against the current application - the application code written in package.json in the dms.appCode property. This can be overridden with the --app XXX switch, where XXX must be another valid application code , which exists in the current application area.
All command livelink queries are executed against entity, which is defined in the current application - e.g. there must be a corresponding entity bo.json file in ./src/Business Objects or ./ext/Business Objects/ folders
1
> cd myapp
2
3
//gets records for the Customer entity prints up to 5 fields
4
> dms livelink --entity Customer
5
|---------------------------|
6
| DMS_ROWID | no | name |
7
|------------|------|-------|
8
|xyz-abv-cde | C001 | Cust1 |
9
|------------|------|-------|
10
|123-abv-cde | C002 | Cust2 |
11
|---------------------------|
12
13
//gets records for the Customer entity and prints 2 fields
14
> dms livelink --entity Customer --fields DMS_ROWID,no
15
|-------------------|
16
| DMS_ROWID | no |
17
|------------|------|
18
|xyz-abv-cde | C001 |
19
|------------|------|
20
|123-abv-cde | C002 |
21
|-------------------|
22
23
//gets records for the Customer entity sorted descending by field no
24
> dms livelink --entity Customer --sort "no desc" --fields DMS_ROWID,no
25
|-------------------|
26
| DMS_ROWID | no |
27
|------------|------|
28
|123-abv-cde | C002 |
29
|------------|------|
30
|xyz-abv-cde | C001 |
31
|-------------------|
32
33
34
//gets records for the Customer entity filtered by field no and name
35
> dms livelink --entity Customer --filter "no eq 'C002' and name eq 'Cust2'" --fields DMS_ROWID,no
36
|-------------------|
37
| DMS_ROWID | no |
38
|------------|------|
39
|123-abv-cde | C002 |
40
|------------|------|
41
42
//gets records for the Customer entity and joins/expands Address and Payments entities
43
> dms livelink --entity Customer --expand "Addres, Payments" --fields DMS_ROWID,no
44
|-------------------|
45
| DMS_ROWID | no |
46
|------------|------|
47
|123-abv-cde | C002 |
48
|------------|------|
49
|xyz-abv-cde | C001 |
50
|-------------------|
51
52
//gets records for the Customer entity and groups by field DMS_ROWID and no
53
> dms livelink --entity Customer --group "DMS_ROWID, no"
54
|-------------------|
55
| DMS_ROWID | no |
56
|------------|------|
57
|123-abv-cde | C002 |
58
|------------|------|
59
|xyz-abv-cde | C001 |
60
|-------------------|
61
62
63
//gets records for the Customer entity and displays them in json format
64
> dms livelink --entity Customer --format json --fields DMS_ROWID,no
65
{
66
"DMS_ROWID":"123-abv-cde",
67
"no":"C002"
68
},
69
{
70
"DMS_ROWID":"xyz-abv-cde",
71
"no":"C002"
72
}
73
74
75
//gets records for the Customer entity and displays the result as sync packet fragment
76
> dms livelink --entity Customer --format xml --fields DMS_ROWID,no
77
<table tablename="Customer">
78
<r>
79
<DMS_ROWID>123-abv-cde</DMS_ROWID>
80
<no>C002</no>
81
</r>
82
<r>
83
<DMS_ROWID>xyz-abv-cde</DMS_ROWID>
84
<no>C002</no>
85
</r>
86
</table>
87
88
//gets records for the Customer entity and displays the result CSV
89
> dms livelink --entity Customer --format csv --fields DMS_ROWID,no
90
"DMS_ROWID","no"
91
"123-abv-cde","C002"
92
"xyz-abv-cde","C001"
93
94
//gets records for the Customer entity and writes the result as CSV
95
//in file called myfile.csv
96
> dms livelink --entity Customer --format csv --fields DMS_ROWID,no --file myfile.csv
97
98
//gets records for the Customer entity from another application called MOBFL
99
> dms livelink --entity Customer --fields "DMS_ROWID, no" --app MOBFL
100
|-------------------|
101
| DMS_ROWID | no |
102
|------------|------|
103
|123-abv-cde | C002 |
104
|------------|------|
105
|xyz-abv-cde | C001 |
106
|-------------------|
107
108
//gets records for the Customer entity from another application called MOBFL
109
//from the production storage.
110
> dms livelink --entity Customer --fields "DMS_ROWID, no" --app MOBFL --mode prod
111
|-------------------|
112
| DMS_ROWID | no |
113
|------------|------|
114
|123-abv-cde | C002 |
115
|------------|------|
116
|xyz-abv-cde | C001 |
117
|-------------------|
118
119
120
121
122
123
124
Copied!
Last modified 8mo ago