Hi,
I have a webhook that is registered on post creation of Contact record , I have an azure function as an endpoint. My Azure function receives the execution context as JSON.
for example , this how the JSON looks:
{ "BusinessUnitId":"**", "CorrelationId":"d168cad7-0d78-42c9-9373-cf39e067d78c", "Depth":1, "InitiatingUserAzureActiveDirectoryObjectId":"00000000-0000-0000-0000-000000000000", "InitiatingUserId":"**", "InputParameters":[ { "key":"Target", "value":{ "__type":"Entity:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Attributes":[ { "key":"new_founderscontact", "value":false }, { "key":"new_mailingaddress", "value":false }, { "key":"new_isproctor", "value":false }, { "key":"modifiedby", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"e7e585ba-a5cf-e811-a96b-000d3a144aa2", "KeyAttributes":[ ], "LogicalName":"systemuser", "Name":null, "RowVersion":null } }, { "key":"new_newlydeactivated", "value":false }, { "key":"new_donor", "value":false }, { "key":"haschildrencode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_subcontact", "value":false }, { "key":"preferredappointmenttimecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_education", "value":false }, { "key":"new_donatingexistingcoursematerials", "value":false }, { "key":"new_instructor", "value":true }, { "key":"new_research", "value":false }, { "key":"new_developingworld", "value":false }, { "key":"new_isstudent", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000000 } }, { "key":"msdyn_orgchangestatus", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":0 } }, { "key":"new_centers", "value":false }, { "key":"new_resources", "value":false }, { "key":"createdby", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"e7e585ba-a5cf-e811-a96b-000d3a144aa2", "KeyAttributes":[ ], "LogicalName":"systemuser", "Name":null, "RowVersion":null } }, { "key":"isbackofficecustomer", "value":false }, { "key":"new_offline", "value":false }, { "key":"new_global", "value":false }, { "key":"new_donotsendmarketingemails", "value":false }, { "key":"new_viassessingtestsandothercoursework", "value":false }, { "key":"new_journalistauthor", "value":false }, { "key":"new_mentoringstudents", "value":false }, { "key":"new_managerialconsultancy", "value":false }, { "key":"new_defaultproctor", "value":false }, { "key":"new_mathematics", "value":false }, { "key":"new_undeliverable", "value":false }, { "key":"new_33acceptedvolunteersagreement", "value":false }, { "key":"new_academic", "value":false }, { "key":"lastname", "value":"test" }, { "key":"donotpostalmail", "value":false }, { "key":"isprivate", "value":false }, { "key":"marketingonly", "value":false }, { "key":"donotphone", "value":false }, { "key":"new_ilearningplatformsupport", "value":false }, { "key":"preferredcontactmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_us", "value":false }, { "key":"educationcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"ownerid", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"e7e585ba-a5cf-e811-a96b-000d3a144aa2", "KeyAttributes":[ ], "LogicalName":"systemuser", "Name":null, "RowVersion":null } }, { "key":"createdon", "value":"\/Date(1611660385000)\/" }, { "key":"new_media", "value":false }, { "key":"new_dateofbirth", "value":"\/Date(1610773200000)\/" }, { "key":"customersizecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_newslettersubscriber", "value":false }, { "key":"firstname", "value":"mongo" }, { "key":"new_partner", "value":false }, { "key":"new_africa", "value":false }, { "key":"new_online", "value":false }, { "key":"new_signedproctoragreement", "value":false }, { "key":"yomifullname", "value":"mongo test" }, { "key":"new_ivansweringstudentquestionsinclassforums", "value":false }, { "key":"owningbusinessunit", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"8bb4eef0-efea-e311-8a35-6c3be5a8cc5c", "KeyAttributes":[ ], "LogicalName":"businessunit", "Name":null, "RowVersion":null } }, { "key":"new_socialnaturalsciences", "value":false }, { "key":"new_iiireviewingandeditingcourses", "value":false }, { "key":"donotemail", "value":false }, { "key":"new_countryofbirth", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"26c5cf1c-e1ec-e311-aec3-6c3be5a8a258", "KeyAttributes":[ ], "LogicalName":"new_country", "Name":null, "RowVersion":null } }, { "key":"new_generalacademic", "value":false }, { "key":"new_maincontact", "value":false }, { "key":"new_recruitmentship", "value":false }, { "key":"new_press", "value":false }, { "key":"timezoneruleversionnumber", "value":0 }, { "key":"msdyn_gdproptout", "value":false }, { "key":"address2_freighttermscode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"statuscode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_ally", "value":false }, { "key":"new_fullname", "value":false }, { "key":"new_mailingaddress2", "value":false }, { "key":"new_gender", "value":false }, { "key":"new_accounting", "value":false }, { "key":"new_other2", "value":false }, { "key":"donotfax", "value":false }, { "key":"leadsourcecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_division", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"6abb5273-4259-ea11-a811-000d3a1b1a80", "KeyAttributes":[ ], "LogicalName":"new_division", "Name":null, "RowVersion":null } }, { "key":"new_committeemember", "value":false }, { "key":"new_formal", "value":false }, { "key":"donotsendmm", "value":false }, { "key":"msa_webuser", "value":false }, { "key":"new_employee", "value":false }, { "key":"fullname", "value":"mongo test" }, { "key":"new_computerprogramming", "value":false }, { "key":"new_unsubscribefromdonationcampaign", "value":false }, { "key":"modifiedon", "value":"\/Date(1611660385000)\/" }, { "key":"new_legalconsultancy", "value":false }, { "key":"new_internship", "value":false }, { "key":"new_humanities", "value":false }, { "key":"new_addresstype", "value":false }, { "key":"new_recruitment", "value":false }, { "key":"participatesinworkflow", "value":false }, { "key":"transactioncurrencyid", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"fac60738-73c3-e211-8945-ac162db45c32", "KeyAttributes":[ ], "LogicalName":"transactioncurrency", "Name":null, "RowVersion":null } }, { "key":"merged", "value":false }, { "key":"new_experiencewithonlineuniversities", "value":false }, { "key":"new_deceased", "value":false }, { "key":"new_istest", "value":false }, { "key":"new_synctomkto", "value":false }, { "key":"new_undefined", "value":false }, { "key":"donotbulkemail", "value":false }, { "key":"creditonhold", "value":false }, { "key":"new_stars", "value":false }, { "key":"new_computers", "value":false }, { "key":"new_socialnetworking", "value":false }, { "key":"new_pr", "value":false }, { "key":"new_women", "value":false }, { "key":"new_technology", "value":false }, { "key":"address2_shippingmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"followemail", "value":true }, { "key":"shippingmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_cataloguinglibrarytextsandarchives2", "value":false }, { "key":"contactid", "value":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0" }, { "key":"donotbulkpostalmail", "value":false }, { "key":"territorycode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_isapplicant", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000000 } }, { "key":"new_space", "value":false }, { "key":"new_languageinterpretertranslator", "value":false }, { "key":"new_contactnumber", "value":"C310033" }, { "key":"statecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":0 } }, { "key":"new_funding", "value":false }, { "key":"new_connector", "value":false }, { "key":"modifiedonbehalfby", "value":null }, { "key":"new_iicreatingnewopensourcecourseware", "value":false }, { "key":"new_marketing", "value":false }, { "key":"new_bypassreturningcustomerlogic", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000001 } }, { "key":"new_advisorycommittee2", "value":false }, { "key":"new_finance2", "value":false }, { "key":"new_volunteer", "value":false }, { "key":"isautocreate", "value":false }, { "key":"new_asia", "value":false }, { "key":"new_economics", "value":false }, { "key":"new_iiendusertechnicalsupport", "value":false }, { "key":"new_promotion", "value":false }, { "key":"exchangerate", "value":1.0000000000 } ], "EntityState":null, "FormattedValues":[ { "key":"new_founderscontact", "value":"No" }, { "key":"new_mailingaddress", "value":"No" }, { "key":"new_isproctor", "value":"No" }, { "key":"new_newlydeactivated", "value":"No" }, { "key":"new_donor", "value":"No" }, { "key":"haschildrencode", "value":"Default Value" }, { "key":"new_subcontact", "value":"No" }, { "key":"preferredappointmenttimecode", "value":"Morning" }, { "key":"new_education", "value":"No" }, { "key":"new_donatingexistingcoursematerials", "value":"No" }, { "key":"new_instructor", "value":"Yes" }, { "key":"new_research", "value":"No" }, { "key":"new_developingworld", "value":"No" }, { "key":"new_isstudent", "value":"Yes" }, { "key":"msdyn_orgchangestatus", "value":"No Feedback" }, { "key":"new_centers", "value":"No" }, { "key":"new_resources", "value":"No" }, { "key":"isbackofficecustomer", "value":"No" }, { "key":"new_offline", "value":"No" }, { "key":"new_global", "value":"No" }, { "key":"new_donotsendmarketingemails", "value":"No" }, { "key":"new_viassessingtestsandothercoursework", "value":"No" }, { "key":"new_journalistauthor", "value":"No" }, { "key":"new_mentoringstudents", "value":"No" }, { "key":"new_managerialconsultancy", "value":"No" }, { "key":"new_defaultproctor", "value":"No" }, { "key":"new_mathematics", "value":"No" }, { "key":"new_undeliverable", "value":"No" }, { "key":"new_33acceptedvolunteersagreement", "value":"No" }, { "key":"new_academic", "value":"No" }, { "key":"donotpostalmail", "value":"Allow" }, { "key":"isprivate", "value":"No" }, { "key":"marketingonly", "value":"No" }, { "key":"donotphone", "value":"Allow" }, { "key":"new_ilearningplatformsupport", "value":"No" }, { "key":"preferredcontactmethodcode", "value":"Any" }, { "key":"new_us", "value":"No" }, { "key":"educationcode", "value":"Default Value" }, { "key":"createdon", "value":"2021-01-26T06:26:25-05:00" }, { "key":"new_media", "value":"No" }, { "key":"new_dateofbirth", "value":"2021-01-16T00:00:00-05:00" }, { "key":"customersizecode", "value":"Default Value" }, { "key":"new_newslettersubscriber", "value":"No" }, { "key":"new_partner", "value":"No" }, { "key":"new_africa", "value":"No" }, { "key":"new_online", "value":"No" }, { "key":"new_signedproctoragreement", "value":"No" }, { "key":"new_ivansweringstudentquestionsinclassforums", "value":"No" }, { "key":"new_socialnaturalsciences", "value":"No" }, { "key":"new_iiireviewingandeditingcourses", "value":"No" }, { "key":"donotemail", "value":"Allow" }, { "key":"new_generalacademic", "value":"No" }, { "key":"new_maincontact", "value":"No" }, { "key":"new_recruitmentship", "value":"No" }, { "key":"new_press", "value":"No" }, { "key":"timezoneruleversionnumber", "value":"0" }, { "key":"msdyn_gdproptout", "value":"No" }, { "key":"address2_freighttermscode", "value":"Default Value" }, { "key":"statuscode", "value":"Active" }, { "key":"new_ally", "value":"No" }, { "key":"new_fullname", "value":"No" }, { "key":"new_mailingaddress2", "value":"No" }, { "key":"new_gender", "value":"Male" }, { "key":"new_accounting", "value":"No" }, { "key":"new_other2", "value":"No" }, { "key":"donotfax", "value":"Allow" }, { "key":"leadsourcecode", "value":"Default Value" }, { "key":"new_committeemember", "value":"No" }, { "key":"new_formal", "value":"No" }, { "key":"donotsendmm", "value":"Send" }, { "key":"msa_webuser", "value":"No" }, { "key":"new_employee", "value":"No" }, { "key":"new_computerprogramming", "value":"No" }, { "key":"new_unsubscribefromdonationcampaign", "value":"No" }, { "key":"modifiedon", "value":"2021-01-26T06:26:25-05:00" }, { "key":"new_legalconsultancy", "value":"No" }, { "key":"new_internship", "value":"No" }, { "key":"new_humanities", "value":"No" }, { "key":"new_addresstype", "value":"Home" }, { "key":"new_recruitment", "value":"No" }, { "key":"participatesinworkflow", "value":"No" }, { "key":"merged", "value":"No" }, { "key":"new_experiencewithonlineuniversities", "value":"No" }, { "key":"new_deceased", "value":"No" }, { "key":"new_istest", "value":"No" }, { "key":"new_synctomkto", "value":"No" }, { "key":"new_undefined", "value":"No" }, { "key":"donotbulkemail", "value":"No" }, { "key":"creditonhold", "value":"No" }, { "key":"new_stars", "value":"No" }, { "key":"new_computers", "value":"No" }, { "key":"new_socialnetworking", "value":"No" }, { "key":"new_pr", "value":"No" }, { "key":"new_women", "value":"No" }, { "key":"new_technology", "value":"No" }, { "key":"address2_shippingmethodcode", "value":"Default Value" }, { "key":"followemail", "value":"Allow" }, { "key":"shippingmethodcode", "value":"Default Value" }, { "key":"new_cataloguinglibrarytextsandarchives2", "value":"No" }, { "key":"donotbulkpostalmail", "value":"No" }, { "key":"territorycode", "value":"Default Value" }, { "key":"new_isapplicant", "value":"Yes" }, { "key":"new_space", "value":"No" }, { "key":"new_languageinterpretertranslator", "value":"No" }, { "key":"statecode", "value":"Active" }, { "key":"new_funding", "value":"No" }, { "key":"new_connector", "value":"No" }, { "key":"new_iicreatingnewopensourcecourseware", "value":"No" }, { "key":"new_marketing", "value":"No" }, { "key":"new_bypassreturningcustomerlogic", "value":"No" }, { "key":"new_advisorycommittee2", "value":"No" }, { "key":"new_finance2", "value":"No" }, { "key":"new_volunteer", "value":"No" }, { "key":"isautocreate", "value":"No" }, { "key":"new_asia", "value":"No" }, { "key":"new_economics", "value":"No" }, { "key":"new_iiendusertechnicalsupport", "value":"No" }, { "key":"new_promotion", "value":"No" } ], "Id":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0", "KeyAttributes":[ ], "LogicalName":"contact", "RelatedEntities":[ ], "RowVersion":null } } ], "IsExecutingOffline":false, "IsInTransaction":false, "IsOfflinePlayback":false, "IsolationMode":1, "MessageName":"Create", "Mode":1, "OperationCreatedOn":"\/Date(1611660385000 0000)\/", "OperationId":"e9ebb251-c95f-eb11-a812-000d3a1a6fe0", "OrganizationId":"**", "OrganizationName":"**", "OutputParameters":[ { "key":"id", "value":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0" } ], "OwningExtension":{ "Id":"e24a5c0e-c95f-eb11-a812-000d3a1a6fe0", "KeyAttributes":[ ], "LogicalName":"sdkmessageprocessingstep", "Name":null, "RowVersion":null }, "ParentContext":{ "BusinessUnitId":"**", "CorrelationId":"d168cad7-0d78-42c9-9373-cf39e067d78c", "Depth":1, "InitiatingUserAzureActiveDirectoryObjectId":"00000000-0000-0000-0000-000000000000", "InitiatingUserId":"**", "InputParameters":[ { "key":"Target", "value":{ "__type":"Entity:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Attributes":[ { "key":"new_dateofbirth", "value":"\/Date(1610773200000)\/" }, { "key":"lastname", "value":"test" }, { "key":"firstname", "value":"mongo" }, { "key":"preferredcontactmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_istest", "value":false }, { "key":"new_other2", "value":false }, { "key":"new_space", "value":false }, { "key":"new_recruitment", "value":false }, { "key":"new_marketing", "value":false }, { "key":"new_funding", "value":false }, { "key":"new_computers", "value":false }, { "key":"new_resources", "value":false }, { "key":"new_research", "value":false }, { "key":"new_recruitmentship", "value":false }, { "key":"new_promotion", "value":false }, { "key":"new_academic", "value":false }, { "key":"new_technology", "value":false }, { "key":"new_women", "value":false }, { "key":"new_education", "value":false }, { "key":"new_developingworld", "value":false }, { "key":"new_global", "value":false }, { "key":"new_us", "value":false }, { "key":"new_asia", "value":false }, { "key":"new_africa", "value":false }, { "key":"new_bypassreturningcustomerlogic", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000001 } }, { "key":"new_maincontact", "value":false }, { "key":"new_unsubscribefromdonationcampaign", "value":false }, { "key":"donotbulkemail", "value":false }, { "key":"new_undeliverable", "value":false }, { "key":"new_press", "value":false }, { "key":"new_synctomkto", "value":false }, { "key":"new_ally", "value":false }, { "key":"new_newslettersubscriber", "value":false }, { "key":"new_connector", "value":false }, { "key":"new_partner", "value":false }, { "key":"new_volunteer", "value":false }, { "key":"new_instructor", "value":true }, { "key":"new_donor", "value":false }, { "key":"new_employee", "value":false }, { "key":"new_isstudent", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000000 } }, { "key":"new_founderscontact", "value":false }, { "key":"new_isproctor", "value":false }, { "key":"new_isapplicant", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":100000000 } }, { "key":"statuscode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"donotphone", "value":false }, { "key":"new_division", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"6abb5273-4259-ea11-a811-000d3a1b1a80", "KeyAttributes":[ ], "LogicalName":"new_division", "Name":null, "RowVersion":null } }, { "key":"new_countryofbirth", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"26c5cf1c-e1ec-e311-aec3-6c3be5a8a258", "KeyAttributes":[ ], "LogicalName":"new_country", "Name":null, "RowVersion":null } }, { "key":"transactioncurrencyid", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"fac60738-73c3-e211-8945-ac162db45c32", "KeyAttributes":[ ], "LogicalName":"transactioncurrency", "Name":null, "RowVersion":null } }, { "key":"ownerid", "value":{ "__type":"EntityReference:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Id":"e7e585ba-a5cf-e811-a96b-000d3a144aa2", "KeyAttributes":[ ], "LogicalName":"systemuser", "Name":null, "RowVersion":null } }, { "key":"participatesinworkflow", "value":false }, { "key":"new_iicreatingnewopensourcecourseware", "value":false }, { "key":"new_ivansweringstudentquestionsinclassforums", "value":false }, { "key":"new_mailingaddress2", "value":false }, { "key":"customersizecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_experiencewithonlineuniversities", "value":false }, { "key":"new_languageinterpretertranslator", "value":false }, { "key":"new_newlydeactivated", "value":false }, { "key":"new_accounting", "value":false }, { "key":"new_viassessingtestsandothercoursework", "value":false }, { "key":"donotemail", "value":false }, { "key":"new_ilearningplatformsupport", "value":false }, { "key":"address2_shippingmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"donotsendmm", "value":false }, { "key":"donotfax", "value":false }, { "key":"new_33acceptedvolunteersagreement", "value":false }, { "key":"followemail", "value":true }, { "key":"address2_freighttermscode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_economics", "value":false }, { "key":"msdyn_orgchangestatus", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":0 } }, { "key":"new_subcontact", "value":false }, { "key":"new_humanities", "value":false }, { "key":"donotpostalmail", "value":false }, { "key":"msa_webuser", "value":false }, { "key":"msdyn_gdproptout", "value":false }, { "key":"new_addresstype", "value":false }, { "key":"new_computerprogramming", "value":false }, { "key":"new_gender", "value":false }, { "key":"preferredappointmenttimecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_fullname", "value":false }, { "key":"new_socialnetworking", "value":false }, { "key":"merged", "value":false }, { "key":"creditonhold", "value":false }, { "key":"territorycode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_formal", "value":false }, { "key":"isprivate", "value":false }, { "key":"new_committeemember", "value":false }, { "key":"new_centers", "value":false }, { "key":"new_mathematics", "value":false }, { "key":"new_signedproctoragreement", "value":false }, { "key":"new_socialnaturalsciences", "value":false }, { "key":"new_deceased", "value":false }, { "key":"new_donotsendmarketingemails", "value":false }, { "key":"new_finance2", "value":false }, { "key":"new_undefined", "value":false }, { "key":"new_cataloguinglibrarytextsandarchives2", "value":false }, { "key":"new_media", "value":false }, { "key":"new_pr", "value":false }, { "key":"haschildrencode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_generalacademic", "value":false }, { "key":"educationcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_advisorycommittee2", "value":false }, { "key":"new_internship", "value":false }, { "key":"marketingonly", "value":false }, { "key":"new_offline", "value":false }, { "key":"new_managerialconsultancy", "value":false }, { "key":"new_online", "value":false }, { "key":"donotbulkpostalmail", "value":false }, { "key":"new_mentoringstudents", "value":false }, { "key":"new_stars", "value":false }, { "key":"new_iiendusertechnicalsupport", "value":false }, { "key":"new_journalistauthor", "value":false }, { "key":"new_legalconsultancy", "value":false }, { "key":"leadsourcecode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"isbackofficecustomer", "value":false }, { "key":"new_mailingaddress", "value":false }, { "key":"isautocreate", "value":false }, { "key":"new_donatingexistingcoursematerials", "value":false }, { "key":"shippingmethodcode", "value":{ "__type":"OptionSetValue:http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts", "Value":1 } }, { "key":"new_iiireviewingandeditingcourses", "value":false }, { "key":"new_defaultproctor", "value":false }, { "key":"new_contactnumber", "value":"C310033" }, { "key":"contactid", "value":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0" } ], "EntityState":null, "FormattedValues":[ ], "Id":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0", "KeyAttributes":[ ], "LogicalName":"contact", "RelatedEntities":[ ], "RowVersion":null } }, { "key":"SuppressDuplicateDetection", "value":false } ], "IsExecutingOffline":false, "IsInTransaction":false, "IsOfflinePlayback":false, "IsolationMode":1, "MessageName":"Create", "Mode":1, "OperationCreatedOn":"\/Date(1611660385000 0000)\/", "OperationId":"e9ebb251-c95f-eb11-a812-000d3a1a6fe0", "OrganizationId":"**", "OrganizationName":"**", "OutputParameters":[ ], "OwningExtension":{ "Id":"e24a5c0e-c95f-eb11-a812-000d3a1a6fe0", "KeyAttributes":[ ], "LogicalName":"sdkmessageprocessingstep", "Name":null, "RowVersion":null }, "ParentContext":null, "PostEntityImages":[ ], "PreEntityImages":[ ], "PrimaryEntityId":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0", "PrimaryEntityName":"contact", "RequestId":"0795c5e3-a173-4732-a6e6-3630e2197d5f", "SecondaryEntityName":"none", "SharedVariables":[ { "key":"IsAutoTransact", "value":true }, { "key":"DefaultsAddedFlag", "value":true }, { "key":"ChangedEntityTypes", "value":[ { "__type":"KeyValuePairOfstringstring:#System.Collections.Generic", "key":"contact", "value":"Update" } ] } ], "Stage":30, "UserAzureActiveDirectoryObjectId":"00000000-0000-0000-0000-000000000000", "UserId":"399a3178-590e-e311-b858-b4b52f675466" }, "PostEntityImages":[ { "key":"AsynchronousStepPrimaryName", "value":{ "Attributes":[ { "key":"fullname", "value":"mongo test" }, { "key":"contactid", "value":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0" } ], "EntityState":null, "FormattedValues":[ ], "Id":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0", "KeyAttributes":[ ], "LogicalName":"contact", "RelatedEntities":[ ], "RowVersion":null } } ], "PreEntityImages":[ ], "PrimaryEntityId":"e3ebb251-c95f-eb11-a812-000d3a1a6fe0", "PrimaryEntityName":"contact", "RequestId":"0795c5e3-a173-4732-a6e6-3630e2197d5f", "SecondaryEntityName":"none", "SharedVariables":[ { "key":"IsAutoTransact", "value":true }, { "key":"DefaultsAddedFlag", "value":true } ], "Stage":40, "UserAzureActiveDirectoryObjectId":"00000000-0000-0000-0000-000000000000", "UserId":"399a3178-590e-e311-b858-b4b52f675466" }
this is how I parse the JSON context:
string requestJsonContext = req.Content.ReadAsStringAsync().Result; RemoteExecutionContext context = DeserializeJsonString(requestJsonContext); //DeserializeJsonString function private static RemoteContextType DeserializeJsonString(string jsonString) { //create an instance of generic type object RemoteContextType obj = Activator.CreateInstance(); MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(jsonString)); System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(obj.GetType()); obj = (RemoteContextType)serializer.ReadObject(ms); ms.Close(); return obj; }
the issue that I have is in parsing datetime field value. For example, I have createdon in target entity like this:
{
"key":"createdon",
"value":"\/Date(1611660385000)\/"
}
when I try to access it in code , an exception occurs : Specified cast is invalid, here is the code:
var target = (Entity)context.InputParameters["Target"]; var createdon = (DateTime)target.Attributes["createdon"];
how can I parse this date ?
Hi, Khaled.
You can use JsonConvert from NewtonSoftJson and parsing the MS JSON format to DateTime C#
//you can use like //... var createdon = MSJsonToDateTime(target.Attributes["createdon"]); public DateTime MSJsonToDateTime(string input) { if(string.IsNullOrEmpty(input)) return null; input = @"""" input @""""; DateTime dt = JsonConvert.DeserializeObject(input); return dt; }
Hope it helps.
Regards.
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... 290,900 Super User 2024 Season 2
Martin Dráb 229,275 Most Valuable Professional
nmaenpaa 101,156