A basic Mobile App Config for AssetScan is as simple as adding the following XML code to your MDM:
<dict>
<key>server_url</key>
<string>$JPS_URL</string>
<key>numfields</key>
<string>1</string>
<key>name1</key>
<string>Serial</string>
<key>val1</key>
<string>$SERIALNUMBER</string>
<key>bar1</key>
<string>Yes
</string>
</dict>
This is enough to enable the most basic config and behaves the same as AssetScan Lite. That is, it shows a barcode of the serial number of the device.
Let's break this down.
We have pairs of keys and strings. The first pair is the URL of our MDM. Jamf Pro allows us to send this with $JPS_URL as seen here. You MUST provide a value for this in order for the app to pick up the remainder of the config. (Note: if your MDM does not supply an easy way to provide this you can enter it manually.)
<key>server_url</key>
<string>$JPS_URL</string>
The next thing you need to specify is the number of fields you want displayed in your app.
<key>numfields</key>
<string>1</string>
Next, you need to define the name or 'label' for your first field.
<key>name1</key>
<string>Serial</string>
In the above example the first field is called 'Serial'.
Then you set the value you want displayed in that field.
<key>val1</key>
<string>$SERIALNUMBER</string>
Here you are saying you want $SERIALNUMBER shown. OK, that looks a bit odd. It's all upper case and there is a dollar sign at the beginning. That's because you are using a Payload Variable for your MDM (more on this below).
In short, you are saying "Use the serial number for the device". (If you wanted it to say "Serial Number" explicitly you would just enter that without the $, but I can't imagine a scenario where this would be useful.)
Lastly, you are saying we want that value displayed as a barcode.
<key>bar1</key>
<string>Yes</string>
For this bit, you just need to remember that if you want the barcode to show for a field, you need to include this in your payload.
All of this is wrapped up in the following odd bit:
<dict>
<!--Important stuff-->
<\dict>
You can add up to 5 fields in the app by using keys for 'name1' through 'name5' and 'val1' through 'val5' (and assuming we want barcodes, 'bar1' through bar5'). You need to make sure that you also adjust the value for numfields to match (e.g. if you want 3 items to display, you need to set numfields to '3' and provide name1, name2, name3, as well as val1, val2 and val3 and bar1, bar2 and bar3).
You can use plain text for your field names and values, or you can use environment variables allowed by your MDM.
In the case of Jamf Pro you can currently use the following:
$MANAGEMENTID
$DEVICENAME
$ASSET_TAG
$SITENAME
$SITEID
$SERIALNUMBER
$UDID
$USERNAME
$FULLNAME or $REALNAME
$PHONE
$ROOM
$POSITION
$DEPARTMENTNAME
$DEPARTMENTID
$BUILDINGNAME
$BUILDINGID
$MACADDRESS
$JSSID
$PROFILEJSSID
$EXTENSIONATTRIBUTE_#
Extension Attribute ID Number
Note: The ID number is found in the extension attribute URL. In the example URL below, "id=2" indicates the extension attribute ID number:
https://JAMF_PRO_URL.jamfcloud.com/mobileDeviceExtensionAttributes.html?id=2&o=r
(For more information, see Mobile Device Extension Attributes in the Jamf Pro admin guide.)
Check to see the latest list of environment variables in the Mobile Device Configuration Profiles section of the Jamf Pro Admin Guide
A more complex config may look like this:
<dict>
<key>server_url</key>
<string>$JPS_URL</string>
<key>numfields</key> <string>4</string> <key>name1</key> <string>Serial</string> <key>val1</key> <string>$SERIALNUMBER</string>
<key>bar1</key> <string>Yes</string>
<key>name2</key> <string>Asset Tag</string> <key>val2</key> <string>$ASSET_TAG</string>
<key>name3</key> <string>Owners Name</string> <key>val3</key> <string>$REALNAME</string><key>name4</key> <string>UserID</string> <key>val4</key> <string>$USERNAME</string>
<key>bar4</key> <string>Yes</string> </dict>
And the result should look like this:
Lastly, you have an optional configuration item.
<key>alwaysqr</key>
<string>true</string>
Here you are saying you always want to use a QR Code instead of a barcode (the app will automatically generate a QR Code if the value is more than 15 characters, or if it has any special text that can't be displayed as a barcode, such as the pound sign '£'.)