I have a requirement to copy case and all associated metadata record from one environment to another.
In same functionality, if a case is resolved on source environment then on target environment after copying the metadata I need to resolve the case. I am using c# console app to do this.
public static void ResolveCase(CDSWebApiService svc, string targetEnv, string caseid)
{
try
{
var caseResolution = new JObject();
caseResolution.Add("incidentid_incident@odata.bind", "/incidents(" caseid ")");
caseResolution.Add("description", "Resolved from system");
caseResolution.Add("Status ", -1);
caseResolution.Add("subject ", "Case Resolved");
// caseResolution.Add("IncidentResolution", caseResolution);
var closeincident = "https://wie" targetEnv ".crm.dynamics.com/api/data/v9.1/CloseIncident";
svc.PostCreate(closeincident, caseResolution);
}
catch (Exception ex)
{
throw;
}
}
But this code throws below error: An error occurred while validating input parameters: Microsoft.OData.ODataException: An OData property annotation was found for a parameter payload; however, parameter payloads do not support OData property annotations.