WfmHistoricalAdherenceBulkQuery

I am trying to run a query
var body = new WfmHistoricalAdherenceQuery();
body.UserIds = ids;
body.StartDate= DateTime.Now.AddDays(-7);
body.EndDate= DateTime.Now;
but I get
"message":"The requested management unit was not found"
How do I set the management unit and where do I find its value on the Genesys site?

ManagementUnitListing list = wfmApi.GetWorkforcemanagementBusinessunitManagementunits(_BU);
foreach (string MU_ID in ManagementUnits.Keys)
{
	foreach (DateRange dateRange in dateRanges)
	{
		WfmHistoricalAdherenceQuery query = new WfmHistoricalAdherenceQuery(dateRange.Begins, dateRange.Ends.Date.AddDays(1), timeZone);
		WfmHistoricalAdherenceResponse response = wfmApi.PostWorkforcemanagementManagementunitHistoricaladherencequery(MU_ID, query);
	}
}

You can find individual MU's from the Admin interface in the UI
/admin/wfm/managementUnits

Click on any MU you have access to and it's ID is in the URL;
/admin/wfm/managementUnits/{BU_ID}/{MU_ID}

Can you give me that in c# code?

That is in C#. :face_with_raised_eyebrow:

Can you show me how to create the wfmApi object and any using statement

You may want to read through the SDK documentation -

https://developer.genesys.cloud/devapps/sdk/dotnet

They cover the appropriate using statements at least three times, and Invoking the API

I have the code running but I am getting the following error message:
"Unable to perform the requested action. You must have at least one of the following permissions assigned: [wfm:historicalAdherence:view]"
Where in the Genesys portal, do I set this?
Does setting this permission affect other tables?
How do I rollback if this permission affects other tables?
How long does it take for the changes in table permissions to take effect?

You can read about permissions here: About people and permissions - Genesys Cloud Resource Center

For further discussion about general system setup, like how to manage your permissions, I would recommend posting on the Genesys Cloud Community Forum. This forum is focused on customizations and API usage; the community forum is a lot more active for general configuration questions.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.