Skip to content

DynamicsWebApi Promises API

Aleksandr Rogov edited this page Dec 30, 2018 · 6 revisions

Modules

dynamics-web-api

Microsoft Dynamics CRM Web API helper library written in JavaScript. It is compatible with: Dynamics 365 (online), Dynamics 365 (on-premise), Dynamics CRM 2016, Dynamics CRM Online.

Classes

DynamicsWebApi

Typedefs

DWAConfig : object

Configuration object for DynamicsWebApi

DWARequest : Object

Dynamics Web Api Request

dynamics-web-api

Microsoft Dynamics CRM Web API helper library written in JavaScript. It is compatible with: Dynamics 365 (online), Dynamics 365 (on-premise), Dynamics CRM 2016, Dynamics CRM Online.

DynamicsWebApi

Kind: global class

new DynamicsWebApi([config])

Constructor.

Param Type Description
[config] DWAConfig configuration object

Example

var dynamicsWebApi = new DynamicsWebApi();

Example

var dynamicsWebApi = new DynamicsWebApi({ webApiVersion: '9.0' });

Example

var dynamicsWebApi = new DynamicsWebApi({
   webApiUrl: 'https:/myorg.api.crm.dynamics.com/api/data/v9.0/',
   includeAnnotations: 'OData.Community.Display.V1.FormattedValue'
});

dynamicsWebApi.retrieveMultipleRequest ⇒ Promise

Sends an asynchronous request to retrieve records.

Kind: instance property of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.
[nextPageLink] string Use the value of the @odata.nextLink property with a new GET request to return the next page of data. Pass null to retrieveMultipleOptions.

dynamicsWebApi.fetch ⇒ Promise

Sends an asynchronous request to execute FetchXml to retrieve records. Returns: DWA.Types.FetchXmlResponse

Kind: instance property of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
fetchXml string FetchXML is a proprietary query language that provides capabilities to perform aggregation.
[includeAnnotations] string Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
[pageNumber] number Page number.
[pagingCookie] string Paging cookie. For retrieving the first page, pagingCookie should be null.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeFetchXml ⇒ Promise

Sends an asynchronous request to execute FetchXml to retrieve records. Returns: DWA.Types.FetchXmlResponse

Kind: instance property of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
fetchXml string FetchXML is a proprietary query language that provides capabilities to perform aggregation.
[includeAnnotations] string Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
[pageNumber] number Page number.
[pagingCookie] string Paging cookie. For retrieving the first page, pagingCookie should be null.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.fetchAll ⇒ Promise

Sends an asynchronous request to execute FetchXml to retrieve all records.

Kind: instance property of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
fetchXml string FetchXML is a proprietary query language that provides capabilities to perform aggregation.
[includeAnnotations] string Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeFetchXmlAll ⇒ Promise

Sends an asynchronous request to execute FetchXml to retrieve all records.

Kind: instance property of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
fetchXml string FetchXML is a proprietary query language that provides capabilities to perform aggregation.
[includeAnnotations] string Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.utility

DynamicsWebApi Utility helper class

Kind: instance property of DynamicsWebApi

dynamicsWebApi.utility.getCollectionName ⇒ string

Searches for a collection name by provided entity name in a cached entity metadata. The returned collection name can be null.

Kind: static property of utility
Returns: string - a collection name

Param Type Description
entityName string entity name

dynamicsWebApi.setConfig(config)

Sets the configuration parameters for DynamicsWebApi helper.

Kind: instance method of DynamicsWebApi

Param Type Description
config DWAConfig configuration object

Example

dynamicsWebApi.setConfig({ webApiVersion: '9.0' });

dynamicsWebApi.createRequest(request) ⇒ Promise

Sends an asynchronous request to create a new record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

Example

var lead = {
   subject: "Test WebAPI",
   firstname: "Test",
   lastname: "WebAPI",
   jobtitle: "Title"
};

var request = {
   entity: lead,
   collection: "leads",
   returnRepresentation: true
}

dynamicsWebApi.createRequest(request).then(function (response) {
}).catch(function (error) {
});

dynamicsWebApi.create(object, collection, [prefer], [select]) ⇒ Promise

Sends an asynchronous request to create a new record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
object Object A JavaScript object valid for create operations.
collection string The name of the Entity Collection or Entity Logical name.
[prefer] string | Array Sets a Prefer header value. For example: ['retrun=representation', 'odata.include-annotations="*"']
[select] Array An Array representing the $select Query Option to control which attributes will be returned.

Example

var lead = {
   subject: "Test WebAPI",
   firstname: "Test",
   lastname: "WebAPI",
   jobtitle: "Title"
};

dynamicsWebApi.create(lead, "leads").then(function (id) {
}).catch(function (error) {
});

dynamicsWebApi.retrieveRequest(request) ⇒ Promise

Sends an asynchronous request to retrieve a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

Example

var request = {
   key: '7d577253-3ef0-4a0a-bb7f-8335c2596e70',
   collection: "leads",
   select: ["fullname", "subject"],
   ifnonematch: 'W/"468026"',
   includeAnnotations: "OData.Community.Display.V1.FormattedValue"
};

dynamicsWebApi.retrieveRequest(request).then(function (response) {

}).catch(function (error) {

});

dynamicsWebApi.retrieve(key, collection, [select], [expand]) ⇒ Promise

Sends an asynchronous request to retrieve a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
key string A String representing the GUID value or Aternate Key for the record to retrieve.
collection string The name of the Entity Collection or Entity Logical name.
[select] Array An Array representing the $select Query Option to control which attributes will be returned.
[expand] string | Array A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.

dynamicsWebApi.updateRequest(request) ⇒ Promise

Sends an asynchronous request to update a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

dynamicsWebApi.update(key, collection, object, [prefer], [select]) ⇒ Promise

Sends an asynchronous request to update a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
key string A String representing the GUID value or Alternate Key for the record to update.
collection string The name of the Entity Collection or Entity Logical name.
object Object A JavaScript object valid for update operations.
[prefer] string If set to "return=representation" the function will return an updated object
[select] Array An Array representing the $select Query Option to control which attributes will be returned.

dynamicsWebApi.updateSingleProperty(key, collection, keyValuePair, [prefer], [select]) ⇒ Promise

Sends an asynchronous request to update a single value in the record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
key string A String representing the GUID value or Alternate Key for the record to update.
collection string The name of the Entity Collection or Entity Logical name.
keyValuePair Object keyValuePair object with a logical name of the field as a key and a value to update with. Example: {subject: "Update Record"}
[prefer] string | Array If set to "return=representation" the function will return an updated object
[select] Array An Array representing the $select Query Option to control which attributes will be returned.

dynamicsWebApi.deleteRequest(request) ⇒ Promise

Sends an asynchronous request to delete a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

dynamicsWebApi.deleteRecord(key, collection, [propertyName]) ⇒ Promise

Sends an asynchronous request to delete a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
key string A String representing the GUID value or Alternate Key for the record to delete.
collection string The name of the Entity Collection or Entity Logical name.
[propertyName] string The name of the property which needs to be emptied. Instead of removing a whole record only the specified property will be cleared.

dynamicsWebApi.upsertRequest(request) ⇒ Promise

Sends an asynchronous request to upsert a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

dynamicsWebApi.upsert(key, collection, object, [prefer], [select]) ⇒ Promise

Sends an asynchronous request to upsert a record.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
key string A String representing the GUID value or Alternate Key for the record to upsert.
collection string The name of the Entity Collection or Entity Logical name.
object Object A JavaScript object valid for update operations.
[prefer] string | Array If set to "return=representation" the function will return an updated object
[select] Array An Array representing the $select Query Option to control which attributes will be returned.

dynamicsWebApi.retrieveAllRequest(request) ⇒ Promise

Sends an asynchronous request to retrieve all records.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
request DWARequest An object that represents all possible options for a current request.

dynamicsWebApi.count(collection, [filter]) ⇒ Promise

Sends an asynchronous request to count records. IMPORTANT! The count value does not represent the total number of entities in the system. It is limited by the maximum number of entities that can be returned. Returns: Number

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
[filter] string Use the $filter system query option to set criteria for which entities will be returned.

dynamicsWebApi.countAll(collection, [filter], [select]) ⇒ Promise

Sends an asynchronous request to count records. Returns: Number

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
[filter] string Use the $filter system query option to set criteria for which entities will be returned.
[select] Array An Array representing the $select Query Option to control which attributes will be returned.

dynamicsWebApi.retrieveMultiple(collection, [select], [filter], [nextPageLink]) ⇒ Promise

Sends an asynchronous request to retrieve records.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
[select] Array Use the $select system query option to limit the properties returned.
[filter] string Use the $filter system query option to set criteria for which entities will be returned.
[nextPageLink] string Use the value of the @odata.nextLink property with a new GET request to return the next page of data. Pass null to retrieveMultipleOptions.

dynamicsWebApi.retrieveAll(collection, [select], [filter]) ⇒ Promise

Sends an asynchronous request to retrieve all records.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
[select] Array Use the $select system query option to limit the properties returned.
[filter] string Use the $filter system query option to set criteria for which entities will be returned.

dynamicsWebApi.associate(collection, primaryKey, relationshipName, relatedCollection, relatedKey, [impersonateUserId]) ⇒ Promise

Associate for a collection-valued navigation property. (1:N or N:N)

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
primaryKey string Primary entity record id.
relationshipName string Relationship name.
relatedCollection string Related name of the Entity Collection or Entity Logical name.
relatedKey string Related entity record id.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.disassociate(collection, primaryKey, relationshipName, relatedKey, [impersonateUserId]) ⇒ Promise

Disassociate for a collection-valued navigation property.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
primaryKey string Primary entity record id.
relationshipName string Relationship name.
relatedKey string Related entity record id.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.associateSingleValued(collection, key, singleValuedNavigationPropertyName, relatedCollection, relatedKey, [impersonateUserId]) ⇒ Promise

Associate for a single-valued navigation property. (1:N)

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
key string Entity record Id that contains an attribute.
singleValuedNavigationPropertyName string Single-valued navigation property name (usually it's a Schema Name of the lookup attribute).
relatedCollection string Related collection name that the lookup (attribute) points to.
relatedKey string Related entity record id that needs to be associated.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.disassociateSingleValued(collection, key, singleValuedNavigationPropertyName, [impersonateUserId]) ⇒ Promise

Removes a reference to an entity for a single-valued navigation property. (1:N)

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
collection string The name of the Entity Collection or Entity Logical name.
key string Entity record Id that contains an attribute.
singleValuedNavigationPropertyName string Single-valued navigation property name (usually it's a Schema Name of the lookup attribute).
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeUnboundFunction(functionName, [parameters], [impersonateUserId]) ⇒ Promise

Executes an unbound function (not bound to a particular entity record)

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
functionName string The name of the function.
[parameters] Object Function's input parameters. Example: { param1: "test", param2: 3 }.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeBoundFunction(id, collection, functionName, [parameters], [impersonateUserId]) ⇒ Promise

Executes a bound function

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
id string A String representing the GUID value for the record.
collection string The name of the Entity Collection or Entity Logical name.
functionName string The name of the function.
[parameters] Object Function's input parameters. Example: { param1: "test", param2: 3 }.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeUnboundAction(actionName, [requestObject], [impersonateUserId]) ⇒ Promise

Executes an unbound Web API action (not bound to a particular entity record)

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
actionName string The name of the Web API action.
[requestObject] Object Action request body object.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.executeBoundAction(id, collection, actionName, [requestObject], [impersonateUserId]) ⇒ Promise | function

Executes a bound Web API action (bound to a particular entity record)

Kind: instance method of DynamicsWebApi
Returns: Promise | function - D365 Web Api result

Param Type Description
id string A String representing the GUID value for the record.
collection string The name of the Entity Collection or Entity Logical name.
actionName string The name of the Web API action.
[requestObject] Object Action request body object.
[impersonateUserId] string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.

dynamicsWebApi.createEntity(entityDefinition) ⇒ Promise

Sends an asynchronous request to create an entity definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityDefinition string Entity Definition.

dynamicsWebApi.updateEntity(entityDefinition, [mergeLabels]) ⇒ Promise

Sends an asynchronous request to update an entity definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityDefinition string Entity Definition.
[mergeLabels] boolean Sets MSCRM.MergeLabels header that controls whether to overwrite the existing labels or merge your new label with any existing language labels. Default value is false.

dynamicsWebApi.retrieveEntity(entityKey, [select], [expand]) ⇒ Promise

Sends an asynchronous request to retrieve a specific entity definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityKey string The Entity MetadataId or Alternate Key (such as LogicalName).
[select] Array Use the $select system query option to limit the properties returned.
[expand] string | Array A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.

dynamicsWebApi.retrieveEntities([select], [filter]) ⇒ Promise

Sends an asynchronous request to retrieve entity definitions.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
[select] Array Use the $select system query option to limit the properties returned.
[filter] string Use the $filter system query option to set criteria for which entity definitions will be returned.

dynamicsWebApi.createAttribute(entityKey, attributeDefinition) ⇒ Promise

Sends an asynchronous request to create an attribute.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityKey string The Entity MetadataId or Alternate Key (such as LogicalName).
attributeDefinition Object Object that describes the attribute.

dynamicsWebApi.updateAttribute(entityKey, attributeDefinition, [attributeType], [mergeLabels]) ⇒ Promise

Sends an asynchronous request to update an attribute.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityKey string The Entity MetadataId or Alternate Key (such as LogicalName).
attributeDefinition Object Object that describes the attribute.
[attributeType] string Use this parameter to cast the Attribute to a specific type.
[mergeLabels] boolean Sets MSCRM.MergeLabels header that controls whether to overwrite the existing labels or merge your new label with any existing language labels. Default value is false.

dynamicsWebApi.retrieveAttributes(entityKey, [attributeType], [select], [filter], [expand]) ⇒ Promise

Sends an asynchronous request to retrieve attribute metadata for a specified entity definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityKey string The Entity MetadataId or Alternate Key (such as LogicalName).
[attributeType] string Use this parameter to cast the Attributes to a specific type.
[select] Array Use the $select system query option to limit the properties returned.
[filter] string Use the $filter system query option to set criteria for which attribute definitions will be returned.
[expand] string | Array A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.

dynamicsWebApi.retrieveAttribute(entityKey, attributeKey, [attributeType], [select], [expand]) ⇒ Promise

Sends an asynchronous request to retrieve a specific attribute metadata for a specified entity definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
entityKey string The Entity MetadataId or Alternate Key (such as LogicalName).
attributeKey string The Attribute Metadata id.
[attributeType] string Use this parameter to cast the Attribute to a specific type.
[select] Array Use the $select system query option to limit the properties returned.
[expand] string | Array A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.

dynamicsWebApi.createRelationship(relationshipDefinition) ⇒ Promise

Sends an asynchronous request to create a relationship definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
relationshipDefinition string Relationship Definition.

dynamicsWebApi.updateRelationship(relationshipDefinition, [relationshipType], [mergeLabels]) ⇒ Promise

Sends an asynchronous request to update a relationship definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
relationshipDefinition string Relationship Definition.
[relationshipType] string Use this parameter to cast the Relationship to a specific type.
[mergeLabels] boolean Sets MSCRM.MergeLabels header that controls whether to overwrite the existing labels or merge your new label with any existing language labels. Default value is false.

dynamicsWebApi.deleteRelationship(metadataId) ⇒ Promise

Sends an asynchronous request to delete a relationship definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
metadataId string A String representing the GUID value.

dynamicsWebApi.retrieveRelationships([relationshipType], [select], [filter]) ⇒ Promise

Sends an asynchronous request to retrieve relationship definitions.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
[relationshipType] string Use this parameter to cast a Relationship to a specific type: 1:M or M:M.
[select] Array Use the $select system query option to limit the properties returned.
[filter] string Use the $filter system query option to set criteria for which relationships will be returned.

dynamicsWebApi.retrieveRelationship(metadataId, [relationshipType], [select]) ⇒ Promise

Sends an asynchronous request to retrieve a specific relationship definition.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
metadataId string String representing the Metadata Id GUID.
[relationshipType] string Use this parameter to cast a Relationship to a specific type: 1:M or M:M.
[select] Array Use the $select system query option to limit the properties returned.

dynamicsWebApi.createGlobalOptionSet(globalOptionSetDefinition) ⇒ Promise

Sends an asynchronous request to create a Global Option Set definition

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
globalOptionSetDefinition string Global Option Set Definition.

dynamicsWebApi.updateGlobalOptionSet(globalOptionSetDefinition, [mergeLabels]) ⇒ Promise

Sends an asynchronous request to update a Global Option Set.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
globalOptionSetDefinition string Global Option Set Definition.
[mergeLabels] boolean Sets MSCRM.MergeLabels header that controls whether to overwrite the existing labels or merge your new label with any existing language labels. Default value is false.

dynamicsWebApi.deleteGlobalOptionSet(globalOptionSetKey) ⇒ Promise

Sends an asynchronous request to delete a Global Option Set.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
globalOptionSetKey string A String representing the GUID value or Alternate Key (such as Name).

dynamicsWebApi.retrieveGlobalOptionSet(globalOptionSetKey, [castType], [select]) ⇒ Promise

Sends an asynchronous request to retrieve Global Option Set definitions.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
globalOptionSetKey string The Global Option Set MetadataID or Alternate Key (such as Name).
[castType] string Use this parameter to cast a Global Option Set to a specific type.
[select] Array Use the $select system query option to limit the properties returned

dynamicsWebApi.retrieveGlobalOptionSets([castType], [select]) ⇒ Promise

Sends an asynchronous request to retrieve Global Option Set definitions.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

Param Type Description
[castType] string Use this parameter to cast a Global Option Set to a specific type.
[select] Array Use the $select system query option to limit the properties returned

dynamicsWebApi.startBatch()

Starts a batch request.

Kind: instance method of DynamicsWebApi

dynamicsWebApi.executeBatch() ⇒ Promise

Executes a batch request. Please call DynamicsWebApi.startBatch() first to start a batch request.

Kind: instance method of DynamicsWebApi
Returns: Promise - D365 Web Api result

dynamicsWebApi.initializeInstance([config]) ⇒ DynamicsWebApi

Creates a new instance of DynamicsWebApi

Kind: instance method of DynamicsWebApi
Returns: DynamicsWebApi - The new instance of a DynamicsWebApi

Param Type Description
[config] DWAConfig configuration object.

DWAConfig : object

Configuration object for DynamicsWebApi

Kind: global typedef
Properties

Name Type Description
webApiUrl string A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
webApiVersion string The version of Web API to use, for example: "8.1"
impersonate string A String representing a URL to Web API (webApiVersion not required if webApiUrl specified) [not used inside of CRM]
onTokenRefresh function A function that is called when a security token needs to be refreshed.
includeAnnotations string Sets Prefer header with value "odata.include-annotations=" and the specified annotation. Annotations provide additional information about lookups, options sets and other complex attribute types.
maxPageSize string Sets the odata.maxpagesize preference value to request the number of entities returned in the response.
returnRepresentation boolean Sets Prefer header request with value "return=representation". Use this property to return just created or updated entity in a single request.
useEntityNames boolean Indicates whether to use Entity Logical Names instead of Collection Logical Names.

DWARequest : Object

Dynamics Web Api Request

Kind: global typedef
Properties

Name Type Description
async boolean XHR requests only! Indicates whether the requests should be made synchronously or asynchronously. Default value is 'true' (asynchronously).
collection string The name of the Entity Collection or Entity Logical name.
id string A String representing the Primary Key (GUID) of the record.
select Array An Array (of Strings) representing the $select OData System Query Option to control which attributes will be returned.
expand Array An array of Expand Objects (described below the table) representing the $expand OData System Query Option value to control which related records are also returned.
key string A String representing collection record's Primary Key (GUID) or Alternate Key(s).
filter string Use the $filter system query option to set criteria for which entities will be returned.
maxPageSize number Sets the odata.maxpagesize preference value to request the number of entities returned in the response.
count boolean Boolean that sets the $count system query option with a value of true to include a count of entities that match the filter criteria up to 5000 (per page). Do not use $top with $count!
top number Limit the number of results returned by using the $top system query option. Do not use $top with $count!
orderBy Array An Array (of Strings) representing the order in which items are returned using the $orderby system query option. Use the asc or desc suffix to specify ascending or descending order respectively. The default is ascending if the suffix isn't applied.
includeAnnotations string Sets Prefer header with value "odata.include-annotations=" and the specified annotation. Annotations provide additional information about lookups, options sets and other complex attribute types.
ifmatch string Sets If-Match header value that enables to use conditional retrieval or optimistic concurrency in applicable requests.
ifnonematch string Sets If-None-Match header value that enables to use conditional retrieval in applicable requests.
returnRepresentation boolean Sets Prefer header request with value "return=representation". Use this property to return just created or updated entity in a single request.
entity Object A JavaScript object with properties corresponding to the logical name of entity attributes (exceptions are lookups and single-valued navigation properties).
impersonate string Impersonates the user. A String representing the GUID value for the Dynamics 365 system user id.
navigationProperty string A String representing the name of a single-valued navigation property. Useful when needed to retrieve information about a related record in a single request.
navigationPropertyKey string v.1.4.3+ A String representing navigation property's Primary Key (GUID) or Alternate Key(s). (For example, to retrieve Attribute Metadata).
metadataAttributeType string v.1.4.3+ Casts the AttributeMetadata to a specific type. (Used in requests to Attribute Metadata).
noCache boolean If set to 'true', DynamicsWebApi adds a request header 'Cache-Control: no-cache'. Default value is 'false'.
savedQuery string A String representing the GUID value of the saved query.
userQuery string A String representing the GUID value of the user query.
mergeLabels boolean If set to 'true', DynamicsWebApi adds a request header 'MSCRM.MergeLabels: true'. Default value is 'false'.
isBatch boolean If set to 'true', DynamicsWebApi treats a request as a part of a batch request. Call ExecuteBatch to execute all requests in a batch. Default value is 'false'.
Clone this wiki locally