I try to assign a resource (belonging to the same company, site, resource groups etc.) via API-Calls to a task in a request. Unfortinately I can’t set application constraints to false to set a resource to this task? Has anyone an idea how to do this?
The code-sequence is:
json = $"{{\n"; // Assign Work
json += $" \"ApplyConstraints\" : false , ";
json += $" \"AllowMultipleVisits\" : false , ";
json += $" \"Description\" : \"{Description}\" , ";
json += $" \"ExcludeFromScheduling\" : false , ";
json += $" \"Duration\" : {Duration} , ";
json += $" \"TaskSeq\": {TaskSeq} ";
json += $"\n}}";
endpoint = $"main/ifsapplications/projection/v1/AssignWorkHandling.svc/ExecutionInstanceSet";
response2 = await PostData2(endpoint!, json);
…..
json = $"{{\n"; // Modify Settings
json += $" \"TaskSeq\" : {TaskSeq} , ";
json += $" \"ParentTempObjkey\" : \"{ObjkeyTask}\" ";
json += $"\n}}";
endpoint = $"main/ifsapplications/projection/v1/AssignWorkHandling.svc/ModifySettings";
response2 = await PostData2(endpoint!, json, "", eTagTask);
…...
json = $"{{\n"; // Apply Constraints = false (2nd try)
json += $" \"ApplyConstraints\" : false, ";
json += $" \"Objsite\" : \"{Objsite}\" ";
json += $"\n}}";
endpoint = $"main/ifsapplications/projection/v1/AssignWorkHandling.svc/ExecutionInstanceSet(Objkey='{ObjkeyTask}')/ExecutionInstanceSelectorArray(Objkey='{ObjkeyTask}')?";
response2 = await PatchData2(endpoint!, json, "", eTagTask);
json = $"{{\n"; // Assign Resource, Date, Time
json += $" \"ApplyConstraints\" : false , ";
json += $" \"Objsite\" : \"{Objsite}\" , ";
json += $" \"TaskSite\" : \"{Objsite}\" , ";
json += $" \"TaskSeq\": {TaskSeq}, ";
json += $" \"AdjustSchedule\" : false , ";
json += $" \"AllocatedHours\" : {Duration} , ";
json += $" \"AllocatedStart\" : \"{AllocationStart}\" , ";
json += $" \"AllocatedFinish\" : \"{AllocationEnd}\" , ";
json += $" \"AllowMultipleVisitsDb\" : false , ";
json += $" \"AllowMultipleVisits\" : false , ";
json += $" \"FixedResource\" : false , ";
json += $" \"AdjustToSchedule\" : \"NoAdjustToSched\" , ";
json += $" \"ExcludeFromScheduling\" : false , ";
json += $" \"ResourceType\" : \"PERSON\" , ";
json += $" \"ResourceId\" : \"{ResourceId}\" , ";
json += $" \"ResourceSeq\" : {ResourceSeq} , ";
json += $" \"Description\" : \"{Description}\" , ";
json += $" \"TaskResourceSeq\": 1 ";
json += $"\n}}";
endpoint = $"main/ifsapplications/projection/v1/AssignWorkHandling.svc/ExecutionInstanceSet(Objkey='{ObjkeyTask}')/ExecutionInstanceSelectorArray(Objkey='{ObjkeyTask}')/TaskDemandArray(Objkey='{ObjkeyTask}')/TaskDemandAllocArray";
response2 = await PostData2(endpoint!, json,"", eTagTask);
The last Post-Call throws an execption: no resource
Any Idea how do solve this for many thousand requests?