Adapter Online Help > TDV Microsoft Dynamics CRM Adapter > Data Model > Stored Procedures
 
Stored Procedures
Stored procedures are available to complement the data available from the Data Model. It may be necessary to update data available from a view using a stored procedure because the data does not provide for direct, table-like, two-way updates. In these situations, the retrieval of the data is done using the appropriate view or table, while the update is done by calling a stored procedure. Stored procedures take a list of parameters and return back a dataset that contains the collection of tuples that constitute the response.
Microsoft Dynamics CRM Adapter Stored Procedures
Name
Description
Assigns an item to the specified user.
Executes an associate request.
Creates a custom schema file based on the CRM View name, FetchXML expression, or SQL query.
Executes a disassociate request.
Executes an workflow request.
Generates the device name and password, which are used for Dynamics CRM Online authentication.
If using a Windows application, set Authmode to App. If using a Web app, set Authmode to Web and specify the Verifier obtained by GetOAuthAuthorizationUrl.
Gets the authorization URL that must be opened separately by the user to grant access to your application. Only needed when developing Web apps.
Gets the address for the security token service.
Refreshes the OAuth access token used for authentication with AzureDataCatalog.
Sets the state and the status of the specified item.
 
Assign
Assigns an item to the specified user.
Input
Name
Type
Required
Description
Table
String
True
The table that has the item being assigned.
Id
String
True
The GUID of the item that is being assigned.
AssigneeType
String
True
The type of the assignee. Accepted types are User or Team.
The allowed values are User, Team.
AssigneeID
String
True
The GUID of the assignee.
Output
Name
Type
Description
Success
String
This field is true if the object was assigned to the new assignee, false otherwise.
AssociateRequest
Executes an associate request.
Input
Name
Type
Required
Description
RelationshipName
String
True
Name of the relationship to be used for the association.
TargetId
String
True
Id of the target to add associations to.
TargetLogicalName
String
True
The logical name of the target to add associations to.
RelatedEntityId#
String
True
Id of an entity to relate to the target.
RelatedEntityLogicalName#
String
True
Logical name of the entity to relate to the target.
CreateSchema
Creates a custom schema file based on the CRM View name, FetchXML expression, or SQL query.
Input
Name
Type
Required
Description
TableName
String
True
The name for the new table. If Query is not specified, this should be set to an existing CRM View name.
Query
String
False
The SQL query or FetchXML expression for table.
Description
String
False
An optional description for the table.
OutputFolder
String
False
The path to output the new schema file to. The value for the Location connection string property will be used by default.
Output
Name
Type
Description
Success
String
Whether or not the schema was created successfully.
SchemaFile
String
The generated schema file.
DisassociateRequest
Executes a disassociate request.
Input
Name
Type
Required
Description
RelationshipName
String
True
Name of the relationship to be used for the disassociation.
TargetId
String
True
Id of the target to remove associations from.
TargetLogicalName
String
True
The logical name of the target to remove associations from.
RelatedEntityId#
String
True
Id of an entity to disassociate from the target.
RelatedEntityLogicalName#
String
True
Logical name of the entity to disassociate from the target.
ExecuteWorkflow
Executes an workflow request.
Input
Name
Type
Required
Description
EntityId
String
True
Id of the entity to be executed for the workflow.
WorkflowId
String
True
Id of the workflow to be executed.
Output
Name
Type
Description
Id
String
Id of the AsyncOperation.
GenerateDeviceCredential
Generates the device name and password, which are used for Dynamics CRM Online authentication.
Input
Name
Type
Required
Description
DeviceCredentialLocation
String
True
The file path to store the device name and device password. This attribute is used in only Windows Live Id authentication in Dynamic CRM Online.
DeviceCredentialPassword
String
True
The password to encrypt the device password. If the password is empty, the device password will not be encrypted. This attribute is used in only Windows Live Id authentication in Dynamic CRM Online.
Output
Name
Type
Description
DeviceName
String
The user-defined Windows Live Services device Id.
DevicePassword
String
The user-defined Windows Live Services device password.
Success
String
Indicates whether the stored procedure was successful.
GetOAuthAccessToken
If using a Windows application, set Authmode to App. If using a Web app, set Authmode to Web and specify the Verifier obtained by GetOAuthAuthorizationUrl.
Input
Name
Type
Required
Description
OAuthServerUrl
String
False
The url which located the ADFS server.
CallbackUrl
String
False
The page to return the user after authorization is complete.
Grant_Type
String
False
The type of authorization to be granted for your app. If this is set to code, the stored procedure will return an authorization URL containing the verifier code in a query string parameter, which you will need to submit back with the GetOAuthAccessToken stored procedure. Implicit will cause the OAuth access token to be returned directly in the URL.
The allowed values are Code, Refresh, JWT, Credentials, Password..
Result Set Columns
Name
Type
Description
Scope
String
The scope of permissions for the app.
OAuthRefreshToken
String
A token that may be used to obtain a new access token.
OAuthAccessToken
String
The OAuth access token.
ExpiresIn
String
The remaining lifetime on the access token. A -1 denotes that it will not expire.
GetOAuthAuthorizationUrl
Gets the authorization URL that must be opened separately by the user to grant access to your application. Only needed when developing Web apps.
Input
Name
Type
Required
Description
OAuthServerUrl
String
False
The url which located the ADFS server.
CallbackUrl
String
False
The page to return the user after authorization is complete.
Grant_Type
String
False
The type of authorization to be granted for your app. If this is set to code, the stored procedure will return an authorization URL containing the verifier code in a query string parameter, which you will need to submit back with the GetOAuthAccessToken stored procedure. Implicit will cause the OAuth access token to be returned directly in the URL.
The allowed values are Implicit, Code.
State
String
False
Any value that you wish to be sent with the callback.
Result Set Columns
Name
Type
Description
Url
String
The authorization url.
GetSTSUrl
Gets the address for the security token service.
Output
Name
Type
Description
STSUrl
String
The address for the security token service.
RefreshOAuthAccessToken
Refreshes the OAuth access token used for authentication with AzureDataCatalog.
Input
Name
Type
Required
Description
OAuthRefreshToken
String
True
Set this to the token value that expired.
OAuthServerUrl
String
False
The url which located the ADFS server.
Result Set Columns
Name
Type
Description
OAuthAccessToken
String
The authentication token returned from AzureDataCatalog. This can be used in subsequent calls to other operations for this particular service.
OAuthRefreshToken
String
This is the same as the access token.
ExpiresIn
String
The remaining lifetime on the access token.
SetState
Sets the state and the status of the specified item.
Input
Name
Type
Required
Description
Table
String
True
The name of the table.
Id
String
True
The Id of the item to change the state for.
StateCode
String
True
The new state code for the item. Value must be a valid state code for the object in Dynamics CRM.
StatusCode
String
True
The new status code for the item. Value must be a valid status code for the object in Dynamics CRM.
Output
Name
Type
Description
Success
String
This field is true if the object's state code and status code were updated, false otherwise.