Hi,
I'm trying to add a field - User Rating on the contacts page which is calculated as a sum of a user’s activity duration in minutes, for all activities in the last 60 days. I've added the field, and i understand I must use ESQ to retrieve data and calculate, but I'm unable to find an implementation example in the documentation of BPM Online.
Could someone possibly suggest? Or atleast provide me a similar implementation which I can use as an example and proceed ahead?
I made an attempt with the ESQ code, but not sure where to place this.
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addColumn("DurationInMinutes", "ActivityDuration");
var contact = this.get("Name").value;
var esqFirstFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,"Activity.Contact", contact);
esq.filters.add("esqFirstFilter", esqFirstFilter);
esq.addAggregationSchemaColumn("DurationInMinutes",Terrasoft.AggregationType.SUM, "ActivitiesDurationSum", Terrasoft.AggregationEvalType.ALL);
esq.getEntity(function(result) {
if (!result.success) {
this.showInformationDialog("Data query error");
return;
}
return (result.entity.get("ActivitiesDurationSum"));
}, this);
Thanks and Regards,
Sushanth.
Like
Hello Sushanth,
The similar functionality was implemented by one of our customers. You can find the example of the implementation in this post.
Lisa
Hi Lisa,
I went through the implementation you recommended. However, if I were not to use a business process for this implementation and did it at the client module, how would I be able to achieve this?
Regards,
Sushanth.
Please use the code from the comment below as an example.
https://community.bpmonline.com/discussion/10914#comment-48258