Display sum of activity duration
Hello ,
I have created custom field in contact page. This value should be calculated based on the sum of activity duration in minutes using client EntitySchemaQuery.
Thank you
Like
For this i have created the script task in business process as following :
var esqManager = UserConnection.GetSchemaManager("EntitySchemaManager") as EntitySchemaManager;
// Create instance of EntitySchemaQuery with root schema "Country".
var esqResult = new EntitySchemaQuery(esqManager, "Activity");
// Define variable for EntitySchemaQuery which will keep subquery for aggregating function result.
EntitySchemaQuery subResultEsq;
// Add subquery column, it will return instance of EntitySchemaQuery for calculation of aggregated function result (count of cities in each country).
esqResult.AddColumn("DurationInMinutes", AggregationTypeStrict.Sum, out subResultEsq);
var update = new Update(UserConnection, "Contact")
.Set("UsrRating", Column.Parameter(subResultEsq));
return true;