JSON.NET
을 사용하여 JSON에 다이나믹 오브젝트를 직렬화하는 사용자 정의 워크 플로우 작업을 실행할 때 아래 오류가 발생합니다.다이나믹스 CRM에서 JSON.NET cuases System.TypeAccessException
CRM Dynamics 고객 워크 플로우 활동/플러그인에서 리플렉션 사용에 제한이 있습니까?
변수가 dynamic
이므로 사용하고 있습니까?
이전에이 문제를 해결 한 사람이 있습니까?
System.TypeAccessException : 방법 'DynamicClass.CallSite.Target (System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite,은 System.Object, 선택 System.String)'에 의한 액세스를 시도 'Newtonsoft.Json.Linq.JObject + JObjectDynamicProxy'이 (가) 실패했습니다. WSWA.CRM.Workflows.MyobJob.MyobIntegrationTester.Execute에서 WSWA.CRM.Logic.MyobIntegrationLogic.CreateInvoice에서 CallSite.Target (폐쇄, CallSite, 객체, 문자열) (부울 재시도) (CodeActivityContext 컨텍스트)에서
dynamic account = new JObject();
account.UID = GetAccount("Undeposited Funds Account");
dynamic job = new JObject();
job.UID = GetJob("JFC Interiors");
dynamic gstTaxCode = new JObject();
gstTaxCode.UID = GetTaxUidByCode("GST");
dynamic customer = new JObject();
customer.UID = GetCustomerUid("Bar001.test");
dynamic line1 = new JObject();
line1.Total = 22.55;
line1.Account = account;
line1.Job = job;
line1.TaxCode = gstTaxCode;
dynamic line2 = new JObject();
line1.Total = 23.55;
line1.Account = account;
line1.Job = job;
line1.TaxCode = gstTaxCode;
var lines = new JArray();
lines.Add(line1);
lines.Add(line2);
dynamic invoice = new JObject();
invoice.Date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
invoice.Customer = customer;
invoice.CustomerPurchaseOrderNumber = "PO Number";
invoice.Number = "INV-1000";
invoice.Lines = lines;
var content = new StringContent(contact.ToString());
content.Headers.ContentType = MediaTypeHeaderValue.Parse("text/json");
var responseTask = httpClient.PostAsync(url, content);
Task.WaitAll(responseTask);
http://www.crmanswers.net/2015/02/json-and-crm-sandbox-plugins.html –