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.
Hi,
Actually first i was following the same link, but it was not working. now. as you pointed out the same i tweak again my code to follow same. In below code first i create an entry of IncidentResolution entry and in this function now i am passing incidentResolutionid.
public static void ResolveCase1(CDSWebApiService svc, string targetEnv, string resolutionid)
{
try
{
JObject incidentResolution = new JObject()
{
{ "subject", "Case Resolved" },
{ "activityid@odata.bind", "/incidentresolutions(" + resolutionid + ")" }
};
JObject closeIncidentRequest = new JObject()
{
{ "Status", -1 },
{ "IncidentResolution", incidentResolution }
};
svc.PostCreate("CloseIncident", closeIncidentRequest);
}
catch (Exception ex)
{
throw;
}
}
But it's throwing this error
An error occurred while validating input parameters: Microsoft.OData.ODataException: A property 'activityid' which only has property annotations in the payload but no property value is declared to be of type 'Edm.Guid'. In OData, only navigation properties and named streams can be represented as properties without values.
Could you please help me to reach a conclusion?
Hi,
Closing/Resolving a case requires two step process. First we need to create Incident Resolution record and then second step is to use action Close Incident .
Please see below blog for your reference.
xrmdynamicscrm.wordpress.com/.../
Andrew, it's closing the case behind the scene, but on code side it throws this error "The given header was not found."
I can handle the error but if we can solve this issue then it would be great.
public static void ResolveCase(CDSWebApiService svc, string targetEnv, string caseid)
{
try
{
JObject incidentResolution = new JObject()
{
{ "subject", "Case Resolved" },
{ "incidentid@odata.bind", "/incidents(" + caseid + ")" }
};
JObject closeIncidentRequest = new JObject()
{
{ "Status", -1 },
{ "IncidentResolution", incidentResolution }
};
svc.PostCreate("CloseIncident", closeIncidentRequest);
}
catch (Exception ex)
{
throw;
}
}
Hello,
The following line is incorrect:
caseResolution.Add("incidentid_incident@odata.bind", "/incidents(" + caseid + ")");
it should look like:
caseResolution.Add("incidentid@odata.bind", "/incidents(" + caseid + ")");
Also, the structure of the request object is incorrect. It should look like:
{
"IncidentResolution": {
"subject": "Put Your Resolve Subject Here",
"incidentid@odata.bind": "/incidents(put your guid here)",
"description": "description here"
},
"Status": -1
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156