-
-
Couldn't load subscription status.
- Fork 63
callbacks Class.DynamicsWebApi
dynamics-web-api-wiki / DynamicsWebApi
Please use DynamicsWebApi with Promises. Will be fully removed in v2.
new DynamicsWebApi(
config?):DynamicsWebApi
DynamicsWebApi constructor
DynamicsWebApi configuration
DynamicsWebApi
utility:
Utility
Utility functions
please use dynamicsWebApi.Utility instead
Utility:
Utility
Utility functions
associate(
collection,primaryKey,relationshipName,relatedCollection,relatedKey,successCallback?,errorCallback?,impersonateUserId?):void
Associate for a collection-valued navigation property. (1:N or N:N)
string
Primary Entity Collection name or Entity Name.
string
Primary entity record id.
string
Relationship name.
string
Related Entity Collection name or Entity Name.
string
Related entity record id.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
associateSingleValued(
collection,key,singleValuedNavigationPropertyName,relatedCollection,relatedKey,successCallback?,errorCallback?,impersonateUserId?):void
Associate for a single-valued navigation property. (1:N)
string
The name of the Entity Collection or Entity Logical name.
string
Entity record Id that contains an attribute.
string
Single-valued navigation property name (usually it's a Schema Name of the lookup attribute).
string
Related collection name that the lookup (attribute) points to.
string
Related entity record id that needs to be associated.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
count(
collection,successCallback?,errorCallback?,filter?):void
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
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use the $filter system query option to set criteria for which entities will be returned.
void
countAll(
collection,successCallback,errorCallback?,filter?,select?):void
Sends an asynchronous request to count records. Returns: Number
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use the $filter system query option to set criteria for which entities will be returned.
string[]
An Array representing the $select Query Option to control which attributes will be returned.
void
create<
T>(object,collection,successCallback?,errorCallback?,prefer?,select?):void
Sends an asynchronous request to create a new record.
T = any
T
A JavaScript object valid for create operations.
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
Sets a Prefer header value. For example: ['retrun=representation', 'odata.include-annotations="*"'].
string | string[]
string[]
An Array representing the $select Query Option to control which attributes will be returned.
void
var lead = {
subject: "Test WebAPI",
firstname: "Test",
lastname: "WebAPI",
jobtitle: "Title"
};
dynamicsWebApi.create(lead, "leads", function (id) {
}, function (error) {
});createAttribute<
T>(entityKey,attributeDefinition,successCallback?,errorCallback?):void
Sends an asynchronous request to create an attribute.
T = any
string
The Entity MetadataId or Alternate Key (such as LogicalName).
Object
Object that describes the attribute.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
createEntity<
T>(entityDefinition,successCallback?,errorCallback?):void
Sends an asynchronous request to create an entity definition.
T = any
Object
Entity Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
createGlobalOptionSet<
T>(globalOptionSetDefinition,successCallback?,errorCallback?):void
Sends an asynchronous request to create a Global Option Set definition
T = any
Object
Global Option Set Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
createRelationship<
T>(relationshipDefinition,successCallback?,errorCallback?):void
Sends an asynchronous request to create a relationship definition.
T = any
Object
Relationship Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
createRequest<
T>(request,successCallback?,errorCallback?):void
Sends an asynchronous request to create a new record.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
var lead = {
subject: "Test WebAPI",
firstname: "Test",
lastname: "WebAPI",
jobtitle: "Title"
};
var request = {
entity: lead,
collection: "leads",
returnRepresentation: true
}
dynamicsWebApi.createRequest(request, function (response) {
}, function (error) {
});deleteGlobalOptionSet(
globalOptionSetKey,successCallback?,errorCallback?):void
Sends an asynchronous request to delete a Global Option Set.
string
A String representing the GUID value or Alternate Key (such as Name).
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
deleteRecord(
key,collection,successCallback?,errorCallback?,propertyName?):void
Sends an asynchronous request to delete a record.
string
A String representing the GUID value or Alternate Key(s) for the record to delete.
string
The name of the Entity Collection or Entity Logical name.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
The name of the property which needs to be emptied. Instead of removing a whole record only the specified property will be cleared.
void
deleteRelationship(
metadataId,successCallback?,errorCallback?):void
Sends an asynchronous request to delete a relationship definition.
string
A String representing the GUID value.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
deleteRequest(
request,successCallback?,errorCallback?):void
Sends an asynchronous request to delete a record.
An object that represents all possible options for a current request.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
disassociate(
collection,primaryKey,relationshipName,relatedKey,successCallback?,errorCallback?,impersonateUserId?):void
Disassociate for a collection-valued navigation property.
string
Primary Entity Collection name or Entity Name.
string
Primary entity record id.
string
Relationship name.
string
Related entity record id.
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
disassociateSingleValued(
collection,key,singleValuedNavigationPropertyName,successCallback?,errorCallback?,impersonateUserId?):void
Removes a reference to an entity for a single-valued navigation property. (1:N)
string
The name of the Entity Collection or Entity Logical name.
string
Entity record Id that contains an attribute.
string
Single-valued navigation property name (usually it's a Schema Name of the lookup attribute).
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
downloadFile(
request,successCallback,errorCallback):void
Downloads a file from a file attribute
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
executeBatch(
successCallback,errorCallback,request?):void
Executes a batch request. Please call DynamicsWebApi.startBatch() first to start a batch request.
Function
The function that will be passed through and be called by a successful response.
Function
The function that will be passed through and be called by a failed response.
void
executeBoundAction<
T>(id,collection,actionName,requestObject,successCallback?,errorCallback?,impersonateUserId?):void
Executes a bound Web API action (bound to a particular entity record)
T = any
string
A String representing the GUID value for the record (pass "null" for an optional parameter)
string
The name of the Entity Collection or Entity Logical name.
string
The name of the Web API action.
Object
Action request body object.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
executeBoundFunction<
T>(id,collection,functionName,successCallback?,errorCallback?,parameters?,impersonateUserId?):void
Executes a bound function
T = any
string
A String representing the GUID value for the record.
string
The name of the Entity Collection or Entity Logical name.
string
The name of the function.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
Object
Function's input parameters. Example: { param1: "test", param2: 3 }.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
executeFetchXml<
T>(collection,fetchXml,successCallback?,errorCallback?,includeAnnotations?,pageNumber?,pagingCookie?,impersonateUserId?):void
Sends an asynchronous request to count records. Returns: DWA.Types.FetchXmlResponse
T = any
string
The name of the Entity Collection or Entity Logical name.
string
FetchXML is a proprietary query language that provides capabilities to perform aggregation.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
number
Page number.
string
Paging cookie. For retrieving the first page, pagingCookie should be null.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
executeFetchXmlAll<
T>(collection,fetchXml,successCallback,errorCallback,includeAnnotations?,impersonateUserId?):void
Sends an asynchronous request to execute FetchXml to retrieve all records.
T = any
string
The name of the Entity Collection or Entity Logical name.
string
FetchXML is a proprietary query language that provides capabilities to perform aggregation.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
executeUnboundAction<
T>(actionName,requestObject,successCallback?,errorCallback?,impersonateUserId?):void
Executes an unbound Web API action (not bound to a particular entity record)
T = any
string
The name of the Web API action.
Object
Action request body object.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
executeUnboundFunction<
T>(functionName,successCallback?,errorCallback?,parameters?,impersonateUserId?):void
Executes an unbound function (not bound to a particular entity record)
T = any
string
The name of the function.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
Object
Function's input parameters. Example: { param1: "test", param2: 3 }.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
fetch<
T>(collection,fetchXml,successCallback?,errorCallback?,includeAnnotations?,pageNumber?,pagingCookie?,impersonateUserId?):void
Sends an asynchronous request to count records. Returns: DWA.Types.FetchXmlResponse
T = any
string
The name of the Entity Collection or Entity Logical name.
string
FetchXML is a proprietary query language that provides capabilities to perform aggregation.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
number
Page number.
string
Paging cookie. For retrieving the first page, pagingCookie should be null.
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
fetchAll<
T>(collection,fetchXml,successCallback,errorCallback,includeAnnotations?,impersonateUserId?):void
Sends an asynchronous request to execute FetchXml to retrieve all records.
T = any
string
The name of the Entity Collection or Entity Logical name.
string
FetchXML is a proprietary query language that provides capabilities to perform aggregation.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
string
A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
void
initializeInstance(
config?):DynamicsWebApi
Creates a new instance of DynamicsWebApi
configuration object.
DynamicsWebApi
retrieve<
T>(key,collection,successCallback?,errorCallback?,select?,expand?):void
Sends an asynchronous request to retrieve a record.
T = any
string
A String representing the GUID value or Alternate Key(s) for the record to retrieve.
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string[]
An Array representing the $select Query Option to control which attributes will be returned.
Expand[]
A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.
void
retrieveAll<
T>(collection,successCallback,errorCallback,select?,filter?):void
Sends an asynchronous request to retrieve all records.
T = any
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string[]
Use the $select system query option to limit the properties returned.
string
Use the $filter system query option to set criteria for which entities will be returned.
void
retrieveAllRequest<
T>(request,successCallback,errorCallback):void
Sends an asynchronous request to retrieve all records.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
retrieveAttribute<
T>(entityKey,attributeKey,successCallback?,errorCallback?,attributeType?,select?,expand?):void
Sends an asynchronous request to retrieve a specific attribute metadata for a specified entity definition.
T = any
string
The Entity MetadataId or Alternate Key (such as LogicalName).
string
The Attribute Metadata id.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast the Attribute to a specific type.
string[]
Use the $select system query option to limit the properties returned.
Expand[]
A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.
void
retrieveAttributes<
T>(entityKey,successCallback?,errorCallback?,attributeType?,select?,filter?,expand?):void
Sends an asynchronous request to retrieve attribute metadata for a specified entity definition.
T = any
string
The Entity MetadataId or Alternate Key (such as LogicalName).
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast the Attributes to a specific type.
string[]
Use the $select system query option to limit the properties returned.
string
Use the $filter system query option to set criteria for which attribute definitions will be returned.
Expand[]
A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.
void
retrieveEntities<
T>(successCallback?,errorCallback?,select?,filter?):void
Sends an asynchronous request to retrieve entity definitions.
T = any
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string[]
Use the $select system query option to limit the properties returned.
string
Use the $filter system query option to set criteria for which entity definitions will be returned.
void
retrieveEntity<
T>(entityKey,successCallback?,errorCallback?,select?,expand?):void
Sends an asynchronous request to retrieve a specific entity definition.
T = any
string
The Entity MetadataId or Alternate Key (such as LogicalName).
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string[]
Use the $select system query option to limit the properties returned.
Expand[]
A String or Array of Expand Objects representing the $expand Query Option value to control which related records need to be returned.
void
retrieveGlobalOptionSet<
T>(globalOptionSetKey,successCallback?,errorCallback?,castType?,select?):void
Sends an asynchronous request to retrieve Global Option Set definitions.
T = any
string
The Global Option Set MetadataID or Alternate Key (such as Name).
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast a Global Option Set to a specific type.
string[]
Use the $select system query option to limit the properties returned
void
retrieveGlobalOptionSets<
T>(successCallback?,errorCallback?,castType?,select?):void
Sends an asynchronous request to retrieve Global Option Set definitions.
T = any
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast a Global Option Set to a specific type.
string[]
Use the $select system query option to limit the properties returned
void
retrieveMultiple<
T>(collection,successCallback?,errorCallback?,select?,filter?,oDataLink?):void
Sends an asynchronous request to retrieve records.
T = any
string
The name of the Entity Collection or Entity Logical name.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string[]
Use the $select system query option to limit the properties returned.
string
Use the $filter system query option to set criteria for which entities will be returned.
string
Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
void
retrieveMultipleRequest<
T>(request,successCallback?,errorCallback?,oDataLink?):void
Sends an asynchronous request to retrieve records.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
void
retrieveRelationship<
T>(metadataId,successCallback?,errorCallback?,relationshipType?,select?):void
Sends an asynchronous request to retrieve a specific relationship definition.
T = any
string
String representing the Metadata Id GUID.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast a Relationship to a specific type: 1:M or M:M.
string[]
Use the $select system query option to limit the properties returned.
void
retrieveRelationships<
T>(successCallback?,errorCallback?,relationshipType?,select?,filter?):void
Sends an asynchronous request to retrieve relationship definitions.
T = any
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast a Relationship to a specific type: 1:M or M:M.
string[]
Use the $select system query option to limit the properties returned.
string
Use the $filter system query option to set criteria for which relationships will be returned.
void
retrieveRequest<
T>(request,successCallback?,errorCallback?):void
Sends an asynchronous request to retrieve a record.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
setConfig(
config):void
Sets DynamicsWebApi configuration parameters.
configuration object
void
dynamicsWebApi.setConfig({ webApiVersion: '9.1' });startBatch():
void
Starts a batch request.
void
update<
T>(key,collection,object,successCallback?,errorCallback?,prefer?,select?):void
Sends an asynchronous request to update a record.
T = any
string
A String representing the GUID value or Alternate Key(s) for the record to update.
string
The name of the Entity Collection or Entity Logical name.
T
A JavaScript object valid for update operations.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
If set to "return=representation" the function will return an updated object
string | string[]
string[]
An Array representing the $select Query Option to control which attributes will be returned.
void
updateAttribute<
T>(entityKey,attributeDefinition,successCallback?,errorCallback?,attributeType?,mergeLabels?):void
Sends an asynchronous request to update an attribute.
T = any
string
The Entity MetadataId or Alternate Key (such as LogicalName).
Object
Object that describes the attribute.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast the Attribute to a specific type.
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.
void
updateEntity<
T>(entityDefinition,successCallback?,errorCallback?,mergeLabels?):void
Sends an asynchronous request to update an entity definition.
T = any
Object
Entity Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
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.
void
updateGlobalOptionSet<
T>(globalOptionSetDefinition,successCallback?,errorCallback?,mergeLabels?):void
Sends an asynchronous request to update a Global Option Set.
T = any
Object
Global Option Set Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
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.
void
updateRelationship<
T>(relationshipDefinition,successCallback?,errorCallback?,relationshipType?,mergeLabels?):void
Sends an asynchronous request to update a relationship definition.
T = any
Object
Relationship Definition.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
string
Use this parameter to cast the Relationship to a specific type.
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.
void
updateRequest<
T>(request,successCallback?,errorCallback?):void
Sends an asynchronous request to update a record.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
updateSingleProperty(
key,collection,keyValuePair,successCallback?,errorCallback?,prefer?,select?):void
Sends an asynchronous request to update a single value in the record.
string
A String representing the GUID value or Alternate Key(s) for the record to update.
string
The name of the Entity Collection or Entity Logical name.
keyValuePair object with a logical name of the field as a key and a value to update with. Example: {subject: "Update Record"}
Function
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
If set to "return=representation" the function will return an updated object
string | string[]
string[]
An Array representing the $select Query Option to control which attributes will be returned.
void
uploadFile(
request,successCallback,errorCallback):void
Uploads a file to a file attribute
An object that represents all possible options for a current request.
() => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void
upsert<
T>(key,collection,object,successCallback?,errorCallback?,prefer?,select?):void
Sends an asynchronous request to upsert a record.
T = any
string
A String representing the GUID value or Alternate Key(s) for the record to upsert.
string
The name of the Entity Collection or Entity Logical name.
T
A JavaScript object valid for update operations.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
If set to "return=representation" the function will return an updated object
string | string[]
string[]
An Array representing the $select Query Option to control which attributes will be returned.
void
upsertRequest<
T>(request,successCallback?,errorCallback?):void
Sends an asynchronous request to upsert a record.
T = any
An object that represents all possible options for a current request.
(result) => void
The function that will be passed through and be called by a successful response.
(error) => void
The function that will be passed through and be called by a failed response.
void