Following the latest announcements about the end of life of Custom Activities, Microsoft has announced a new feature called Custom API. This is intended to replace Customs Activities but involves a few additional steps to introduce it, notably by creating a new type of solutio-aware component : Custom API, Custom API Request Parameter and Custom API Response Property. If you want to understand how to create a Custom API you can refer to the following link:
Based on the legendary project of Demian Adolfo Raschkovan (https://github.com/demianrasko/Dynamics-365-Workflow-Tools), I wanted to use the same concept but with the latest features. This project is intended to evolve!
As discussed above, there are severals components to be installed/initiated if you want to use this new feature. That the reason
Here is the complete list of Custom APIs included in this project:
π AddRoleToTeam
This custom API allows you to add a specific security role (using the name or reference to that security role) to a specific Team.
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_AddRoleToTeam | dtv_AddRoleToTeam | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
RoleName | String | β |
Role | EntityReference (role) | β |
TeamName | String | β |
Team | EntityReference (team) | β |
N/A
π AddRoleToUser
This custom API allows you to add a specific security role (using the name or the reference to that security role) to a specific user (or to the InitiatingUser if the parameter is not set).
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_AddRoleToUser | dtv_AddRoleToUser | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
RoleName | String | β |
Role | EntityReference (role) | β |
User | EntityReference (systemuser) | β |
N/A
π AddUserToTeam
This custom API allows you to add a specific user (or the InitiatingUser if the parameter is not set) to a specific Team (using the name or the reference to that team).
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_AddUserToTeam | dtv_AddUserToTeam | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
TeamName | String | β |
Team | EntityReference (team) | β |
User | EntityReference (systemuser) | β |
N/A
π CalculateRollUpField
This custom API allows you to force the Rollup field calculation for a specific record and field and return the result.
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_CalculateRollUpField | dtv_CalculateRollUpField | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
FieldName | String | β |
Entity | Entity (team) | β |
User | EntityReference (systemuser) | β |
-->Vérifier le paramètre Entity et si on fait bound ou pas
Name | Type |
---|---|
MoneyValue | Money |
DateTimeValue | DateTime |
WholeNumberValue | Integer |
DecimalValue | Decimal |
π CheckUserInRole
This custom API allows you to check if a specific user (or the InitiatingUser if the parameter is not set) has the role defined in parameter (using the name or the reference to that security role).
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_CheckUserInRole | dtv_CheckUserInRole | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
RoleName | String | β |
Role | EntityReference (role) | β |
User | EntityReference (systemuser) | β |
-->Vérifier l'aspect Function/Action, ici on devrait faire une fonction car on altère pas la data
Name | Type |
---|---|
IsUserInRole | Boolean |
π CheckUserInTeam
This custom API allows you to check if a specific user (or the InitiatingUser if the parameter is not set) belongs to the team defined in parameter (using the name or the reference to that security role).
Unique Name | Name/Display Name | Binding Type | Bound Entity Logical Name | Is Function | Is Private | Allowed Custom Processing Step Type | Execute privilege Name |
---|---|---|---|---|---|---|---|
dtv_CheckUserInTeam | dtv_CheckUserInTeam | Global | N/A | β | β | None |
Name | Type | Is Optional |
---|---|---|
TeamName | String | β |
Team | EntityReference (team) | β |
User | EntityReference (systemuser) | β |
-->Vérifier l'aspect Function/Action, ici on devrait faire une fonction car on altère pas la data
Name | Type |
---|---|
IsUserInTeam | Boolean |
π EmailToTeam
ContentClone record
π GetEnvironmentVariable
ContentClone record
π RemoveRoleFromTeam
ContentClone record
π RemoveRoleFromUser
ContentClone record
π RemoveUserFromTeam
ContentClone record
Request:
function RunAction() {
var parameters = {};
parameters.FieldName = "adc_rollupdecimal";
var entity = {};
entity.accountid = "95559db1-710c-eb11-a816-002248049f5d";
entity["@odata.type"] = "Microsoft.Dynamics.CRM.account";
parameters.Entity = entity;
var dtv_CalculateRollupFieldRequest = {
FieldName: parameters.FieldName,
Entity: parameters.Entity,
getMetadata: function() {
return {
boundParameter: null,
parameterTypes: {
"FieldName": {
"typeName": "Edm.String",
"structuralProperty": 1
},
"Entity": {
"typeName": "mscrm.crmbaseentity",
"structuralProperty": 5
}
},
operationType: 0,
operationName: "dtv_CalculateRollupField"
};
}
};
Xrm.WebApi.online.execute(dtv_CalculateRollupFieldRequest).then(
function success(result) {
if (result.ok) {
var results = JSON.parse(result.responseText);
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
Response:
{
"@odata.context":"https://org.crm.dynamics.com/api/data/v9.0/$metadata#Microsoft.Dynamics.CRM.dtv_CalculateRollupFieldResponse",
"MoneyValue": null ,
"DateTimeValue": null ,
"WholeNumberValue": null ,
"DecimalValue":35.67
}
OrganizationRequest request = new OrganizationRequest("dtv_AddRoleToUser")
{
["Role"] = new EntityReference("role", new Guid("182580da-7ccc-e911-a813-000d3a7ed5a2")),
["User"] = new EntityReference("systemuser", new Guid("794580da-7ccc-e911-a813-000d3a7ed5a2")),
};
OrganizationResponse response = svc.Execute(request);
Request:
https://pcfinstance.crm.dynamics.com/api/data/v9.0/dtv_CalculateRollupField()
Request Body:
{
"FieldName":"adc_rollupcurrency",
"Entity":{
"accountid":"95559db1-710c-eb11-a816-002248049f5d",
"@odata.type":"Microsoft.Dynamics.CRM.account"
}
}
Response:
{
"@odata.context": "https://org.crm.dynamics.com/api/data/v9.0/$metadata#Microsoft.Dynamics.CRM.dtv_CalculateRollupFieldResponse",
"MoneyValue": 16000.0000000000,
"DateTimeValue": null,
"WholeNumberValue": null,
"DecimalValue": null
}
Custom API functionality is still considered as a Preview feature. While unlikely, some breaking changes might occur and will be fixed ASAP.
Here is the link to the Dataverse Custom API's official documentation