@resconet/jsbridge 17.1.0-beta.2 → 17.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/JSBridge.d.ts +41 -1
- package/src/JSBridge.js +238 -44
package/package.json
CHANGED
package/src/JSBridge.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// JSBridge.js TypeScript definition file
|
|
2
2
|
// (c) 2023 Resco
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
/* eslint-disable @typescript-eslint/prefer-namespace-keyword */
|
|
6
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
7
|
+
/* eslint-disable no-var */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
|
|
4
10
|
declare namespace MobileCRM {
|
|
5
11
|
class Size {
|
|
6
12
|
width: string;
|
|
@@ -1588,6 +1594,40 @@ declare module MobileCRM.Services {
|
|
|
1588
1594
|
responseText: string;
|
|
1589
1595
|
responseType: string;
|
|
1590
1596
|
}
|
|
1597
|
+
|
|
1598
|
+
class GeoFencingService {
|
|
1599
|
+
/** Indicates whether the service is active. */
|
|
1600
|
+
isEnabled: boolean;
|
|
1601
|
+
/** Indicates whether the events should be delivered realtime using Resco forwarding service.*/
|
|
1602
|
+
realtimeFlushing: boolean;
|
|
1603
|
+
/** Defines logging verbosity (0=Normal, 1=Diagnostic, -1=None) */
|
|
1604
|
+
logLevel: number;
|
|
1605
|
+
/** Defines event mask for showing notifications (0=None, 1=WhenArrived, 2=WhenExited, 3=Always) */
|
|
1606
|
+
notificationMask: number;
|
|
1607
|
+
/** Business hours interval (default value is '9:00-17:00') */
|
|
1608
|
+
businessHours: string;
|
|
1609
|
+
/** Business days mask (the lowest bit is Sunday, the next Monday, ...) */
|
|
1610
|
+
businessDaysMask: number;
|
|
1611
|
+
|
|
1612
|
+
updateGeoFences(records: GeoFenceRecord[]);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
interface GeoFenceRecord {
|
|
1616
|
+
/** Defines numeric mask for geo fence events (Enter = 1, Exit = 2, Both = 3).*/
|
|
1617
|
+
eventTypeMask: number;
|
|
1618
|
+
/** Unique id of geo-fence record. If it is associated with some entity record, it must have form logicalname:id (e.g. appointment:4595AA3E-9873-4DC4-B723-C94DE27B82BE).*/
|
|
1619
|
+
id: string;
|
|
1620
|
+
/** Human-readable name of record used for notifications.*/
|
|
1621
|
+
name: string;
|
|
1622
|
+
/** Latitude of geo-fence center.*/
|
|
1623
|
+
latitude: number;
|
|
1624
|
+
/** Longitude of geo-fence center.*/
|
|
1625
|
+
longitude: number;
|
|
1626
|
+
/** Geo-fence radius in meters.*/
|
|
1627
|
+
radius: number;
|
|
1628
|
+
/** Geo-fence expiration in seconds.*/
|
|
1629
|
+
expiration: number;
|
|
1630
|
+
}
|
|
1591
1631
|
}
|
|
1592
1632
|
declare module MobileCRM.Services.AddressBookService {
|
|
1593
1633
|
class AddressBookRecord {
|
|
@@ -2776,9 +2816,9 @@ declare module MobileCRM.UI {
|
|
|
2776
2816
|
|
|
2777
2817
|
addView(entityName: string, viewName: string, isDefault?: boolean);
|
|
2778
2818
|
addEntityFilter(entityName: string, filterXML: string);
|
|
2819
|
+
addEntityFilter(entityName: string, filterXml);
|
|
2779
2820
|
show(success: (obj?: MobileCRM.Reference) => void, failed?: (err: string) => void, scope?: any);
|
|
2780
2821
|
showAsync(): Promise<Reference>;
|
|
2781
|
-
addEntityFilter(entityName: string, filterXml);
|
|
2782
2822
|
}
|
|
2783
2823
|
|
|
2784
2824
|
class MultiLookupForm {
|
package/src/JSBridge.js
CHANGED
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
};
|
|
28
|
+
var _normalizeArray = function (arr, convertCallback) {
|
|
29
|
+
var retVal = undefined;
|
|
30
|
+
if (arr instanceof Array && arr.length > 0) {
|
|
31
|
+
const normArr = [];
|
|
32
|
+
for (const o of arr) {
|
|
33
|
+
if (o) {
|
|
34
|
+
normArr.push(convertCallback(o));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (normArr.length > 0) {
|
|
38
|
+
retVal = normArr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return retVal;
|
|
42
|
+
};
|
|
28
43
|
var _addProperty = function (obj, name, writable, value) {
|
|
29
44
|
if (!obj._privVals) {
|
|
30
45
|
obj._privVals = {};
|
|
@@ -156,7 +171,7 @@
|
|
|
156
171
|
}
|
|
157
172
|
};
|
|
158
173
|
};
|
|
159
|
-
var _global = window
|
|
174
|
+
var _global = typeof window == "undefined" ? global : window;
|
|
160
175
|
var MobileCrmException = _global.MobileCrmException;
|
|
161
176
|
if (typeof MobileCrmException === "undefined") {
|
|
162
177
|
_global.MobileCrmException = MobileCrmException = function (msg) {
|
|
@@ -398,11 +413,19 @@
|
|
|
398
413
|
/// <field name="entity" type="MobileCRM.FetchXml.Entity">An entity object.</field>
|
|
399
414
|
/// <field name="page" type="int">1-based index of the data page to retrieve.</field>
|
|
400
415
|
/// <field name="distinct" type="Boolean">Whether to return only distinct (different) values.</field>
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
416
|
+
if (entity) {
|
|
417
|
+
this.entity = entity;
|
|
418
|
+
}
|
|
419
|
+
if (typeof count !== "undefined") {
|
|
420
|
+
this.count = count;
|
|
421
|
+
}
|
|
422
|
+
if (typeof page !== "undefined") {
|
|
423
|
+
this.page = page;
|
|
424
|
+
}
|
|
404
425
|
this.aggregate = false;
|
|
405
|
-
|
|
426
|
+
if (typeof distinct !== "undefined") {
|
|
427
|
+
this.distinct = distinct;
|
|
428
|
+
}
|
|
406
429
|
},
|
|
407
430
|
Entity: function (name) {
|
|
408
431
|
/// <summary>Represents a FetchXml query root entity.</summary>
|
|
@@ -412,25 +435,23 @@
|
|
|
412
435
|
/// <field name="linkentities" type="Array">An array of <see cref="MobileCRM.FetchXml.LinkEntity">MobileCRM.FetchXml.LinkEntity</see> objects.</field>
|
|
413
436
|
/// <field name="name" type="String">An entity logical name.</field>
|
|
414
437
|
/// <field name="order" type="Array">An array of <see cref="MobileCRM.FetchXml.Order">MobileCRM.FetchXml.Order</see> objects.</field>
|
|
415
|
-
|
|
438
|
+
if (name) {
|
|
439
|
+
this.name = name;
|
|
440
|
+
}
|
|
416
441
|
this.attributes = [];
|
|
417
442
|
this.order = [];
|
|
418
443
|
this.filter = null;
|
|
419
444
|
this.linkentities = [];
|
|
420
445
|
},
|
|
421
|
-
LinkEntity: function (
|
|
446
|
+
LinkEntity: function () {
|
|
422
447
|
/// <summary>Represents a FetchXml query linked entity.</summary>
|
|
423
448
|
/// <remarks>This object is derived from <see cref="MobileCRM.FetchXml.Entity">MobileCRM.FetchXml.Entity</see></remarks>
|
|
449
|
+
/// <param name="name" type="String">An entity name</param>
|
|
424
450
|
/// <field name="alias" type="String">A link alias.</field>
|
|
425
451
|
/// <field name="from" type="String">The "from" field (if parent then target entity primary key).</field>
|
|
426
452
|
/// <field name="linkType" type="String">The link (join) type ("inner" or "outer").</field>
|
|
427
|
-
/// <param name="name" type="String">An entity name</param>
|
|
428
453
|
/// <field name="to" type="String">The "to" field.</field>
|
|
429
454
|
MobileCRM.FetchXml.LinkEntity.superproto.constructor.apply(this, arguments);
|
|
430
|
-
this.from = null;
|
|
431
|
-
this.to = null;
|
|
432
|
-
this.linktype = null;
|
|
433
|
-
this.alias = null;
|
|
434
455
|
},
|
|
435
456
|
Attribute: function (name) {
|
|
436
457
|
/// <summary>Represents a FetchXml select statement (CRM field).</summary>
|
|
@@ -440,11 +461,10 @@
|
|
|
440
461
|
/// <field name="dategrouping" type="String">A date group by modifier (year, quarter, month, week, day).</field>
|
|
441
462
|
/// <field name="groupby" type="Boolean">Indicates whether to group by this attribute.</field>
|
|
442
463
|
/// <field name="name" type="String">A lower-case entity attribute name (CRM logical field name).</field>
|
|
443
|
-
|
|
444
|
-
|
|
464
|
+
if (name) {
|
|
465
|
+
this.name = name;
|
|
466
|
+
}
|
|
445
467
|
this.groupby = false;
|
|
446
|
-
this.alias = null;
|
|
447
|
-
this.dategrouping = null;
|
|
448
468
|
},
|
|
449
469
|
Order: function (attribute, descending) {
|
|
450
470
|
/// <summary>Represents a FetchXml order statement.</summary>
|
|
@@ -453,8 +473,9 @@
|
|
|
453
473
|
/// <field name="alias" type="String">Defines an order alias.</field>
|
|
454
474
|
/// <field name="attribute" type="String">An attribute name (CRM logical field name).</field>
|
|
455
475
|
/// <field name="descending" type="Boolean">true, for descending order; false, for ascending order.</field>
|
|
456
|
-
|
|
457
|
-
|
|
476
|
+
if (attribute) {
|
|
477
|
+
this.attribute = attribute;
|
|
478
|
+
}
|
|
458
479
|
this.descending = descending ? true : false;
|
|
459
480
|
},
|
|
460
481
|
Filter: function () {
|
|
@@ -462,7 +483,6 @@
|
|
|
462
483
|
/// <field name="conditions" type="Array">An array of <see cref="MobileCRM.FetchXml.Condition">Condition</see> objects.</field>
|
|
463
484
|
/// <field name="filters" type="Array">An array of <see cref="MobileCRM.FetchXml.Filter">Filter</see> objects representing child-filters.</field>
|
|
464
485
|
/// <field name="type" type="String">Defines the filter operator ("or" / "and").</field>
|
|
465
|
-
this.type = null;
|
|
466
486
|
this.conditions = [];
|
|
467
487
|
this.filters = [];
|
|
468
488
|
},
|
|
@@ -474,15 +494,10 @@
|
|
|
474
494
|
/// <field name="uitype" type="String">The lookup target entity logical name.</field>
|
|
475
495
|
/// <field name="value" type="">The value to compare to.</field>
|
|
476
496
|
/// <field name="values" type="Array">The list of values to compare to.</field>
|
|
477
|
-
this.attribute = null;
|
|
478
|
-
this.operator = null;
|
|
479
|
-
this.uitype = null;
|
|
480
|
-
this.uiname = null;
|
|
481
|
-
this.value = null;
|
|
482
497
|
this.values = [];
|
|
483
498
|
},
|
|
484
499
|
},
|
|
485
|
-
Platform: function (
|
|
500
|
+
Platform: function () {
|
|
486
501
|
/// <summary>Represents object for querying platform specific information and executing platform integrated actions.</summary>
|
|
487
502
|
/// <remarks>This object cannot be created directly. To obtain/modify this object, use <see cref="MobileCRM.Platform.requestObject">MobileCRM.Platform.requestObject</see> function.</remarks>
|
|
488
503
|
/// <field name="capabilities" type="Number">Gets the mask of capability flags supported by this device (MakePhoneCalls=1; HasMapView=2).</field>
|
|
@@ -544,7 +559,7 @@
|
|
|
544
559
|
},
|
|
545
560
|
UI: {
|
|
546
561
|
FormManager: {},
|
|
547
|
-
EntityForm: function (
|
|
562
|
+
EntityForm: function () {
|
|
548
563
|
/// <summary>Represents the Javascript equivalent of native entity form object.</summary>
|
|
549
564
|
/// <remarks>This object cannot be created directly. To obtain/modify this object, use <see cref="MobileCRM.UI.EntityForm.requestObject">MobileCRM.UI.EntityForm.requestObject</see> function.</remarks>
|
|
550
565
|
/// <field name="associatedViews" type="Array">Gets the associated views as an array of <see cref="MobileCRM.UI._EntityList">MobileCRM.UI._EntityList</see> objects.</field>
|
|
@@ -572,11 +587,11 @@
|
|
|
572
587
|
/// <field name="relationship" type="MobileCRM.Relationship">Gets the relation source and related entity. "null", if there is no relationship.</field>
|
|
573
588
|
MobileCRM.UI.QuestionnaireForm.superproto.constructor.apply(this, arguments);
|
|
574
589
|
},
|
|
575
|
-
EntityChart: function (
|
|
590
|
+
EntityChart: function () {
|
|
576
591
|
/// <summary>[13.0] Represents the Javascript equivalent of native entity chart object.</summary>
|
|
577
592
|
MobileCRM.UI.EntityChart.superproto.constructor.apply(this, arguments);
|
|
578
593
|
},
|
|
579
|
-
EntityList: function (
|
|
594
|
+
EntityList: function () {
|
|
580
595
|
/// <summary>[v9.2] Represents the Javascript equivalent of native entity list object.</summary>
|
|
581
596
|
/// <field name="allowAddExisting" type="Boolean">Gets or sets whether adding an existing entity is allowed.</field>
|
|
582
597
|
/// <field name="allowCreateNew" type="Boolean">Gets or sets whether create a new entity (or managing the N:N entities in the case of N:N list) is allowed.</field>
|
|
@@ -604,7 +619,7 @@
|
|
|
604
619
|
/// <field name="uniqueName" type="Number">Gets or sets the unique name of the list. Used to save/load list specific settings.</field>
|
|
605
620
|
MobileCRM.UI.EntityList.superproto.constructor.apply(this, arguments);
|
|
606
621
|
},
|
|
607
|
-
HomeForm: function (
|
|
622
|
+
HomeForm: function () {
|
|
608
623
|
/// <summary>[v8.0] Represents the Javascript equivalent of the home form object which contains the Home/UI replacement iFrame.</summary>
|
|
609
624
|
/// <remarks><p>This class works only from Home/UI replacement iFrame.</p><p>This object cannot be created directly. To obtain/modify this object, use <see cref="MobileCRM.UI.HomeForm.requestObject">MobileCRM.UI.HomeForm.requestObject</see> function.</p></remarks>
|
|
610
625
|
/// <field name="form" type="MobileCRM.UI.Form">Gets the top level form.</field>
|
|
@@ -1048,6 +1063,38 @@
|
|
|
1048
1063
|
this.url = "";
|
|
1049
1064
|
this.serviceType = "Azure"; // [v12.3] supports only azure service, used as default.
|
|
1050
1065
|
},
|
|
1066
|
+
GeoFencingService: function () {
|
|
1067
|
+
/// <summary>[v17.1] Represents geo-fencing service.</summary>
|
|
1068
|
+
/// <field name="isEnabled" type="Boolean">Indicates whether the service is active.</field>
|
|
1069
|
+
/// <field name="realtimeFlushing" type="Boolean">Indicates whether the events should be delivered realtime using Resco forwarding service.</field>
|
|
1070
|
+
/// <field name="logLevel" type="number">Defines logging verbosity (0=Normal, 1=Diagnostic, -1=None)</field>
|
|
1071
|
+
/// <field name="notificationMask" type="number">Defines event mask for showing notifications (0=None, 1=WhenArrived, 2=WhenExited, 3=Always)</field>
|
|
1072
|
+
/// <field name="businessHours" type="String">Business hours interval (e.g. '9:00-17:00')</field>
|
|
1073
|
+
/// <field name="businessDaysMask" type="number">Business days mask (the lowest bit is Sunday, the next Monday, ...)</field>
|
|
1074
|
+
this.isEnabled = false;
|
|
1075
|
+
this.realtimeFlushing = true;
|
|
1076
|
+
this.logLevel = 0;
|
|
1077
|
+
this.notificationMask = 1;
|
|
1078
|
+
this.businessHours = null;
|
|
1079
|
+
this.businessDaysMask = -1;
|
|
1080
|
+
},
|
|
1081
|
+
GeoFenceRecord: function (eventTypeMask, id, name, latitude, longitude, radius, expiration) {
|
|
1082
|
+
/// <summary>[v17.1] Represents geo-fence definition record.</summary>
|
|
1083
|
+
/// <field name="eventTypeMask" type="number">Defines numeric mask for geo fence events (Enter = 1, Exit = 2, Both = 3).</field>
|
|
1084
|
+
/// <field name="id" type="String">Unique id of geo-fence record. If it is associated with some entity record, it must have form logicalname:id (e.g. appointment:4595AA3E-9873-4DC4-B723-C94DE27B82BE).</field>
|
|
1085
|
+
/// <field name="name" type="String">Human-readable name of record used for notifications.</field>
|
|
1086
|
+
/// <field name="latitude" type="number">Latitude of geo-fence center.</field>
|
|
1087
|
+
/// <field name="longitude" type="number">Longitude of geo-fence center.</field>
|
|
1088
|
+
/// <field name="radius" type="number">Geo-fence radius in meters.</field>
|
|
1089
|
+
/// <field name="expiration" type="number">Geo-fence expiration in seconds.</field>
|
|
1090
|
+
this.eventTypeMask = eventTypeMask;
|
|
1091
|
+
this.id = id;
|
|
1092
|
+
this.name = name;
|
|
1093
|
+
this.latitude = latitude;
|
|
1094
|
+
this.longitude = longitude;
|
|
1095
|
+
this.radius = radius;
|
|
1096
|
+
this.expiration = expiration;
|
|
1097
|
+
},
|
|
1051
1098
|
},
|
|
1052
1099
|
};
|
|
1053
1100
|
|
|
@@ -1420,7 +1467,7 @@
|
|
|
1420
1467
|
callback.call(scope);
|
|
1421
1468
|
}
|
|
1422
1469
|
});
|
|
1423
|
-
|
|
1470
|
+
_global.setTimeout(function () {
|
|
1424
1471
|
var nextWorker = _alertQueue.splice(0, 1);
|
|
1425
1472
|
nextWorker[0]();
|
|
1426
1473
|
});
|
|
@@ -2277,7 +2324,7 @@
|
|
|
2277
2324
|
}
|
|
2278
2325
|
var cmdParams = JSON.stringify(request);
|
|
2279
2326
|
var self = this;
|
|
2280
|
-
|
|
2327
|
+
_global.MobileCRM.bridge.command(
|
|
2281
2328
|
"entitysave",
|
|
2282
2329
|
cmdParams,
|
|
2283
2330
|
function (res) {
|
|
@@ -2493,7 +2540,134 @@
|
|
|
2493
2540
|
/// <param name="success" type="function(result)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the objects array of type specified by <b>resultformat</b> XML attribute (Array, JSON, XML or DynamicEntities).</param>
|
|
2494
2541
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
2495
2542
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2496
|
-
|
|
2543
|
+
_global.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
|
|
2544
|
+
};
|
|
2545
|
+
MobileCRM.FetchXml.Condition._constructConditionParams = function (condition) {
|
|
2546
|
+
if (condition) {
|
|
2547
|
+
var conditionParams = {};
|
|
2548
|
+
if (condition.attribute) {
|
|
2549
|
+
conditionParams.attribute = condition.attribute;
|
|
2550
|
+
}
|
|
2551
|
+
if (condition.operator) {
|
|
2552
|
+
conditionParams.operator = condition.operator;
|
|
2553
|
+
}
|
|
2554
|
+
if (condition.uiname) {
|
|
2555
|
+
conditionParams.uiname = condition.uiname;
|
|
2556
|
+
}
|
|
2557
|
+
if (condition.uitype) {
|
|
2558
|
+
conditionParams.uitype = condition.uitype;
|
|
2559
|
+
}
|
|
2560
|
+
if (typeof condition.value !== "undefined") {
|
|
2561
|
+
conditionParams.value = condition.value;
|
|
2562
|
+
}
|
|
2563
|
+
if (condition.values instanceof Array && condition.values.length > 0) {
|
|
2564
|
+
conditionParams.values = condition.values;
|
|
2565
|
+
}
|
|
2566
|
+
return conditionParams;
|
|
2567
|
+
} else {
|
|
2568
|
+
return undefined;
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
MobileCRM.FetchXml.Filter._constructFilterParams = function (filter) {
|
|
2572
|
+
if (filter) {
|
|
2573
|
+
var filterParams = {};
|
|
2574
|
+
if (filter.type) {
|
|
2575
|
+
filterParams.type = filter.type;
|
|
2576
|
+
}
|
|
2577
|
+
filterParams.conditions = _normalizeArray(filter.conditions, MobileCRM.FetchXml.Condition._constructConditionParams);
|
|
2578
|
+
filterParams.filters = _normalizeArray(filter.filters, MobileCRM.FetchXml.Filter._constructFilterParams);
|
|
2579
|
+
return filterParams;
|
|
2580
|
+
} else {
|
|
2581
|
+
return undefined;
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
MobileCRM.FetchXml.Order._constructOrderParams = function (order) {
|
|
2585
|
+
if (order) {
|
|
2586
|
+
var orderParams = { attribute: order.attribute };
|
|
2587
|
+
if (typeof order.descending != "undefined") {
|
|
2588
|
+
orderParams.descending = order.descending;
|
|
2589
|
+
}
|
|
2590
|
+
if (order.alias) {
|
|
2591
|
+
orderParams.alias = order.alias;
|
|
2592
|
+
}
|
|
2593
|
+
return orderParams;
|
|
2594
|
+
} else {
|
|
2595
|
+
return undefined;
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
MobileCRM.FetchXml.Attribute._constructAttributeParams = function (attribute) {
|
|
2599
|
+
if (attribute) {
|
|
2600
|
+
var attrParams = {};
|
|
2601
|
+
if (attribute.name) {
|
|
2602
|
+
attrParams.name = attribute.name;
|
|
2603
|
+
}
|
|
2604
|
+
if (attribute.aggregate) {
|
|
2605
|
+
attrParams.aggregate = attribute.aggregate;
|
|
2606
|
+
}
|
|
2607
|
+
if (typeof attribute.groupby != "undefined") {
|
|
2608
|
+
attrParams.groupby = attribute.groupby;
|
|
2609
|
+
}
|
|
2610
|
+
if (attribute.alias) {
|
|
2611
|
+
attrParams.alias = attribute.alias;
|
|
2612
|
+
}
|
|
2613
|
+
if (attribute.dategrouping) {
|
|
2614
|
+
attrParams.dategrouping = attribute.dategrouping;
|
|
2615
|
+
}
|
|
2616
|
+
return attrParams;
|
|
2617
|
+
} else {
|
|
2618
|
+
return undefined;
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
MobileCRM.FetchXml.Entity._constructEntityParams = function (entity) {
|
|
2622
|
+
if (entity) {
|
|
2623
|
+
var entityParams = {};
|
|
2624
|
+
if (entity.name) {
|
|
2625
|
+
entityParams.name = entity.name;
|
|
2626
|
+
}
|
|
2627
|
+
entityParams.attributes = _normalizeArray(entity.attributes, MobileCRM.FetchXml.Attribute._constructAttributeParams);
|
|
2628
|
+
entityParams.order = _normalizeArray(entity.order, MobileCRM.FetchXml.Order._constructOrderParams);
|
|
2629
|
+
if (entity.filter) {
|
|
2630
|
+
entityParams.filter = MobileCRM.FetchXml.Filter._constructFilterParams(entity.filter);
|
|
2631
|
+
}
|
|
2632
|
+
entityParams.linkentities = _normalizeArray(entity.linkentities, MobileCRM.FetchXml.LinkEntity._constructLinkParams);
|
|
2633
|
+
return entityParams;
|
|
2634
|
+
} else {
|
|
2635
|
+
return undefined;
|
|
2636
|
+
}
|
|
2637
|
+
};
|
|
2638
|
+
MobileCRM.FetchXml.LinkEntity._constructLinkParams = function (linkEntity) {
|
|
2639
|
+
var linkParams = MobileCRM.FetchXml.Entity._constructEntityParams(linkEntity);
|
|
2640
|
+
if (linkParams) {
|
|
2641
|
+
if (linkEntity.alias) {
|
|
2642
|
+
linkParams.alias = linkEntity.alias;
|
|
2643
|
+
}
|
|
2644
|
+
if (linkEntity.from) {
|
|
2645
|
+
linkParams.from = linkEntity.from;
|
|
2646
|
+
}
|
|
2647
|
+
if (linkEntity.to) {
|
|
2648
|
+
linkParams.to = linkEntity.to;
|
|
2649
|
+
}
|
|
2650
|
+
if (linkEntity.linkType) {
|
|
2651
|
+
linkParams.linkType = linkEntity.linkType;
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
return linkParams;
|
|
2655
|
+
};
|
|
2656
|
+
MobileCRM.FetchXml.Fetch.prototype._constructFetchParams = function () {
|
|
2657
|
+
var reqParams = { entity: MobileCRM.FetchXml.Entity._constructEntityParams(this.entity) };
|
|
2658
|
+
if (typeof this.page !== "undefined") {
|
|
2659
|
+
reqParams.page = this.page;
|
|
2660
|
+
}
|
|
2661
|
+
if (typeof this.count !== "undefined") {
|
|
2662
|
+
reqParams.count = this.count;
|
|
2663
|
+
}
|
|
2664
|
+
if (typeof this.aggregate !== "undefined") {
|
|
2665
|
+
reqParams.aggregate = this.aggregate;
|
|
2666
|
+
}
|
|
2667
|
+
if (this.distinct) {
|
|
2668
|
+
reqParams.distinct = this.distinct;
|
|
2669
|
+
}
|
|
2670
|
+
return reqParams;
|
|
2497
2671
|
};
|
|
2498
2672
|
MobileCRM.FetchXml.Fetch.prototype.execute = function (output, success, failed, scope) {
|
|
2499
2673
|
/// <summary>Performs the asynchronous CRM Fetch request.</summary>
|
|
@@ -2501,15 +2675,11 @@
|
|
|
2501
2675
|
/// <param name="success" type="function(result)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the objects array of type specified by <b>output</b> argument.</param>
|
|
2502
2676
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
2503
2677
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2504
|
-
var reqParams =
|
|
2505
|
-
|
|
2506
|
-
resultformat
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
aggregate: this.aggregate,
|
|
2510
|
-
distinct: this.distinct,
|
|
2511
|
-
});
|
|
2512
|
-
MobileCRM.bridge.command("fetch", reqParams, success, failed, scope);
|
|
2678
|
+
var reqParams = this._constructFetchParams();
|
|
2679
|
+
if (output) {
|
|
2680
|
+
reqParams.resultformat = output;
|
|
2681
|
+
}
|
|
2682
|
+
MobileCRM.bridge.command("fetch", JSON.stringify(reqParams), success, failed, scope);
|
|
2513
2683
|
};
|
|
2514
2684
|
MobileCRM.FetchXml.Fetch.prototype.executeOnline = function (output, success, failed, scope) {
|
|
2515
2685
|
/// <summary>[v8.0] Performs the online CRM Fetch request regardless of the app online/offline mode.</summary>
|
|
@@ -2573,13 +2743,13 @@
|
|
|
2573
2743
|
/// <param name="success" type="function(String)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the XML representation of the Fetch object.</param>
|
|
2574
2744
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
2575
2745
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2576
|
-
var reqParams =
|
|
2746
|
+
var reqParams = this._constructFetchParams();
|
|
2577
2747
|
MobileCRM.bridge.command("fetchToXml", reqParams, success, failed, scope);
|
|
2578
2748
|
};
|
|
2579
2749
|
MobileCRM.FetchXml.Fetch.prototype.serializeToXmlAsync = function () {
|
|
2580
2750
|
/// <summary>[v10.0] Serializes the Fetch object to XML.</summary>
|
|
2581
2751
|
/// <returns type="Promise<string>">A Promise object which will be resolved with the XML representation of this Fetch object.</returns>
|
|
2582
|
-
var reqParams =
|
|
2752
|
+
var reqParams = this._constructFetchParams();
|
|
2583
2753
|
return MobileCRM.bridge.invokeCommandPromise("fetchToXml", reqParams);
|
|
2584
2754
|
};
|
|
2585
2755
|
// MobileCRM.FetchXml.Entity
|
|
@@ -6094,6 +6264,30 @@
|
|
|
6094
6264
|
scope
|
|
6095
6265
|
);
|
|
6096
6266
|
};
|
|
6267
|
+
|
|
6268
|
+
MobileCRM.Services.GeoFencingService.prototype.updateGeoFences = function (geoFences, errorCallback) {
|
|
6269
|
+
/// <summary>[v17.1] Updates geo-fences being monitored.</summary>
|
|
6270
|
+
/// <param name="geoFences" type="Array">An array of GeoFenceRecord objects.</field>
|
|
6271
|
+
var cfg = {
|
|
6272
|
+
isEnabled: !!this.isEnabled,
|
|
6273
|
+
realtimeFlushing: !!this.realtimeFlushing,
|
|
6274
|
+
};
|
|
6275
|
+
if (this.logLevel >= -1 && this.logLevel <= 1) {
|
|
6276
|
+
cfg.logLevel = this.logLevel;
|
|
6277
|
+
}
|
|
6278
|
+
if (this.notificationMask >= 0 && this.notificationMask <= 4) {
|
|
6279
|
+
cfg.notificationMask = this.notificationMask;
|
|
6280
|
+
}
|
|
6281
|
+
if (this.businessHours) {
|
|
6282
|
+
cfg.businessHours = this.businessHours;
|
|
6283
|
+
}
|
|
6284
|
+
if (this.businessDaysMask) {
|
|
6285
|
+
cfg.businessDaysMask = this.businessDaysMask;
|
|
6286
|
+
}
|
|
6287
|
+
cfg.geoFences = geoFences;
|
|
6288
|
+
MobileCRM.bridge.command("geofencing", JSON.stringify(cfg), null, errorCallback);
|
|
6289
|
+
};
|
|
6290
|
+
|
|
6097
6291
|
MobileCRM.Services.DynamicsReport.prototype.download = function (fileName, format, success, failed, scope) {
|
|
6098
6292
|
/// <summary>Downloads the MS Dynamics report into a file.</summary>
|
|
6099
6293
|
/// <param name="fileName" type="String">A file name for resulting file. Leave "null" to let app to safely generate the file name and extension.</param>
|
|
@@ -6192,7 +6386,7 @@
|
|
|
6192
6386
|
/// <param name="success" type="function(string)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the serialized response from the server.</param>
|
|
6193
6387
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
6194
6388
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
6195
|
-
|
|
6389
|
+
_global.MobileCRM.bridge.command(
|
|
6196
6390
|
"executeWorkflowAction",
|
|
6197
6391
|
JSON.stringify({ actionName: actionName, actionParameters: JSON.stringify(parameters) }),
|
|
6198
6392
|
success,
|