Post

1 follower Follow
0
Avatar

Recent changes in ResourceManagementQueryResult content structure?

Hello,

Last week I tried to use ResourceManagementQuery to fetch work on workitem with workitem hierarchy. Once the setting 8.5 "Display parent work item in the Resource Load grid" was set to "Yes", it seemed I retrieved what I wanted: from the User Node, I got intermediate WorkItems to Leaf Tasks, with some parent workitem with no ResourceUsageDetails (field was null).

This morning, the structure returned by the query is different. On Leaf Tasks 2 sub items, one Node is a link (RegularResourceLink, OwnerLink for example), and the other is the direct Parent.

Did the API changed recently, or do I need to set a specific setting to be able to get the entire hierarchy again? The minimum need is to get the Parent Milestone with a specific Custom Field value.

Thank you in advance

In case there is something obvious from my code, here is my sample code in C#:

BaseMessage[] messagesArray = new BaseMessage[0];
ResourceManagementQuery query = new ResourceManagementQuery();
EntityId[] arrayId = new EntityId[1];
EntityId entityID = new EntityId();

entityID.TypeName = "User";
entityID.Value = "xxx_UserID_xxx";// User ID;
arrayId[0] = entityID;

query.ResourceEntitiesIds = arrayId;

ResourceManagementQuerySetting qs = new ResourceManagementQuerySetting();

FieldsToBeSelected fieldstobeSelected = new FieldsToBeSelected();
FieldsToBeSelected[] fieldsArray = new FieldsToBeSelected[4];
String[] fields = new String[2];
fields[0] = "Name";
fields[1] = "C_UserOrgID";

fieldstobeSelected.FieldNames = fields;
fieldstobeSelected.TypeName = "User";
fieldsArray[0] = fieldstobeSelected;

fieldstobeSelected = new FieldsToBeSelected();
fields = new String[5];
fields[0] = "Name";
fields[1] = "C_CustomField"; // <- A custom field on Task I want to retrieve
fields[2] = "Reportable";
fields[3] = "Milestone";
fields[4] = "Milestone.C_CustomField"; // <- A custom field on Parent Milestone I want to retrieve
fieldstobeSelected.FieldNames = fields;
fieldstobeSelected.TypeName = "Task";
fieldsArray[1] = fieldstobeSelected;

fieldstobeSelected = new FieldsToBeSelected();
fields = new String[4];
fields[0] = "Name";
fields[1] = "C_CustomField"; // <- A custom field on Project I want to retrieve
fields[2] = "Reportable";
fields[3] = "Milestone";
fieldstobeSelected.FieldNames = fields;
fieldstobeSelected.TypeName = "Project";
fieldsArray[2] = fieldstobeSelected;

fieldstobeSelected = new FieldsToBeSelected();
fields = new String[4];
fields[0] = "Name";
fields[1] = "C_CustomField"; // <- A custom field on Milestone I want to retrieve
fields[2] = "Reportable";
fields[3] = "StartDate";

fieldstobeSelected.FieldNames = fields;
fieldstobeSelected.TypeName = "Milestone";
fieldsArray[3] = fieldstobeSelected;

 

// Define settings
qs.Fields = fieldsArray;
qs.HoursView = true;
qs.LoadOrAvailability = ResourceLoadValueType.Load;
qs.ReportingPeriod = ReportingPeriodType.Daily;
qs.WorkOrRemainingEffort = ResourceLoadBaseType.Work;
qs.HoursViewSpecified = true;
qs.LoadOrAvailabilitySpecified = true;
qs.WorkOrRemainingEffortSpecified = true;

ResourceManagementQueryGlobalFilters globalFilters = new ResourceManagementQueryGlobalFilters();
TimeFilter timeFilter = new TimeFilter();
timeFilter.From = Convert.ToDateTime("01/05/2017");
timeFilter.To = Convert.ToDateTime("30/06/2017");
timeFilter.FromSpecified = true;
timeFilter.ToSpecified = true;

globalFilters.TimeFilter = timeFilter;

ResourceManagementQueryDefinition qd = new ResourceManagementQueryDefinition();
qd.GlobalFilters = globalFilters;
qd.Setting = qs;

query.Definition = qd;

messagesArray = new BaseMessage[] { query };
Result[] results = clarizenClient.Execute(messagesArray);
ResourceManagementQueryResult qr = (ResourceManagementQueryResult)results[0];

if(qr.Success)
{

    // Process the result

}

Armand BOLMONT Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Your best bet with this question is to contact Clarizen support directly.

Guy 0 votes
Comment actions Permalink