API: $getInitParams
• $getInitParams: This API provides information on instance URL and action parameters. Using this API you can pass parameters to mobile activity space. The sample $getInitParams code is as follows:
var activitySpaceInit = async function ()
{
const params = await $getInitParams();
displayFetchDetails(params);
};
var displayFetchDetails = function (params)
{
const {
recordId }
= params || {
};
const {
instanceUrl }
= (params && params.authParams) || {
};
$log(‘instanceUrl ${
instanceUrl}
’);
$log(‘recordId ${
recordId}
’);
};
The sample return JSON response for $getInitParams API is as follows:
{
"recordId": "a1d1R000006qF0FQAU",
"deviceInfo": {
"deviceModel": "iPhone 11",
"timezone": "America/Los_Angeles",
…
},
"userInfo": {
"firstName": ”John", "lastName": ”Doe",
"userAddress": {
"street": "123 Red Flag Way",
…
},
"UserId": "0051R00000IAQkSQAX",
"locale": "en_US",
…
},
"actionParams": {
"MyFieldName": "WO-00000173",
"Account": "Textiles Corp of America",
"ClosedBy_Name": {
"id": "0051R00000HJ8Z9QAL",
"value": ”Matthew Parker", "active": true },
… }, "authParams": { "loginUrl": "https://login.salesforce.com", "instanceUrl": "https://myown.salesforce.com" } }