JSON.NET
を使用してJSONに動的オブジェクトをシリアル化するカスタムワークフローアクションを実行すると、以下のエラーが発生します。JSON.NET cuases Dyanmics CRM
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(閉鎖、呼び出し場所、オブジェクト、文字列)(ブールリトライ)(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 –