web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to send OData EntityReference (Lookup) values from Json

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm implementing a code within a Logic App to send data to a custom Activity in Dynamics online v8.2 web services. Everything looks like works good, all the data is making it to the custom activity and executes a plugin, but the issue is that all the EntityReferences are null at the time that reading the values.

This is the Dynamics activity field definition:

6327.Capture2.JPG

this is the Logic App.

3122.Capture1.JPG

in the ODataV4Metadata from CRM the needed field is defined this way:

<Parameter Name="leadId" Type="mscrm.lead"/>

and the way I'm sending the values from Postman to the Logic app is a simple Json field with the GUID on it:

{

"crmLeadId": "74ec5085-XXXX-e811-812e-e0071b6aaXXX",

}

does anyone knows how to define these type of values from the Json or something that could give a light?

Thank you!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    It should be something like

    "crmLeadId@odata.bind": "/leads(74ec5085-XXXX-e811-812e-e0071b6aaXXX)"

  • Community Member Profile Picture
    on at

    Hi Andrew, thank you for your fast answer, I make the change but it's showing me this exception now.

    {

     "error": {

       "code": "",

       "message": "An OData property annotation was found for a parameter payload; however, parameter payloads do not support OData property annotations.",

       "innererror": {

         "message": "An OData property annotation was found for a parameter payload; however, parameter payloads do not support OData property annotations.",

         "type": "Microsoft.Crm.CrmHttpException",

         "stacktrace": "   at Microsoft.Crm.Extensibility.OData.CrmODataUtilities.ValidateInputParameters(ModelStateDictionary controllerModelState)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.PostUnboundAction(String operationName, ODataUntypedActionParameters parameters)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"

       }

     }

    }

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Can you please post screenshot from postman? If it works in postman it should work the same way with LogicApp.

  • Community Member Profile Picture
    on at

    sure, here it is:

    7484.Capture3.JPG

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I believe you call action. Can you please provide screenshot of that action?

  • Community Member Profile Picture
    on at

    Sure, here it is, BTW I'm using the field value in a custom plugin.

    3583.Capture4.JPG

    Thank you!

  • NODAL Profile Picture
    860 on at

    Hi jairo,

    Add "Prefer" header for your xhr(xml http request) to get formatted values.

    Regards,

    NODAL

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Replace

    "crmLeadId@odata.bind": "/leads(74ec5085-XXXX-e811-812e-e0071b6aaXXX)"

    with input name as you have it in CRM

    "leadId@odata.bind": "/leads(74ec5085-XXXX-e811-812e-e0071b6aaXXX)"

    and provide the rest of arguments please.

  • Community Member Profile Picture
    on at

    Hi Nodal,

    Thanks for your reply, when I used the header "Prefer":"odata.include-annotations="*", the result is the same.

    Thank you!

  • Community Member Profile Picture
    on at

    Hi Andrew,

    yes I did it and still showing the same error:

    "message": "An OData property annotation was found for a parameter payload; however, parameter payloads do not support OData property annotations.". 

    This is the complete Json message that I'm using, the GUID values are EntityReference fields, anyway, I'm evaluating the way to make the value visible in CRM with the plugin exception trace.

    {
    "address1City": "",
    "address1Line1": "123 Main",
    "address1Line2": "",
    "address1PostalCode": "",
    "address1StateOrProvince": "",
    "billingAddressSameasInstall": true,
    "campaignId": "FC3F7A95-D864-E811-8138-E0071B6AD111",
    "desiredCallTime": "2018-06-19T16:35:05Z",
    "email": "",
    "firstName": "Jairo",
    "futureInstallReason": "",
    "installAddressCountry": "",
    "installJobNumber": "",
    "installStreetName": "",
    "installStreetNumber": "",
    "installUnitNumber": "",
    "installationFeeId": "",
    "isFirstParty": true,
    "jornayaCampaignId": "E55426E4-6570-E611-80DC-FC15B4286CB8",
    "lastName": "VR_LA0618_01",
    "leadId@odata.bind": "/leads(74ec5085-fd73-e811-812e-e0071b6aa291)",
    "leadIdData_result": 0,
    "leadIdLabsData_result": 0,
    "leadQualifierData_age": "20",
    "leadQualifierData_ageRule": false,
    "leadQualifierData_authentic": false,
    "leadQualifierData_capture": false,
    "leadQualifierData_captureRule": false,
    "leadQualifierData_dataIntegrity": 0,
    "leadQualifierData_dataIntegrityFailed": "[\"JAIRO\",\"VR_LA0618_01\",\"1020180618\"]",
    "leadQualifierData_dataIntegrityPassed": "[]",
    "leadQualifierData_dataIntegrityRule": false,
    "leadQualifierData_deviceDay": 0,
    "leadQualifierData_deviceDayRule": false,
    "leadQualifierData_deviceFiveMinutes": 0,
    "leadQualifierData_deviceFiveMinutesRule": false,
    "leadQualifierData_deviceHour": 0,
    "leadQualifierData_deviceHourRule": false,
    "leadQualifierData_deviceTwelveHours": 0,
    "leadQualifierData_deviceTwelveHoursRule": false,
    "leadQualifierData_deviceWeek": 0,
    "leadQualifierData_deviceWeekRule": false,
    "leadQualifierData_duration": "07",
    "leadQualifierData_durationRule": false,
    "leadQualifierData_entityRule": false,
    "leadQualifierData_entityValue": false,
    "leadQualifierData_ipDay": 0,
    "leadQualifierData_ipDayRule": false,
    "leadQualifierData_ipFiveMinutes": 0,
    "leadQualifierData_ipFiveMinutesRule": false,
    "leadQualifierData_ipHour": 0,
    "leadQualifierData_ipHourRule": false,
    "leadQualifierData_ipTwelveHours": 0,
    "leadQualifierData_ipTwelveHoursRule": false,
    "leadQualifierData_ipWeek": 0,
    "leadQualifierData_ipWeekRule": false,
    "leadQualifierData_leadAge": "07",
    "leadQualifierData_leadDay": 0,
    "leadQualifierData_leadDayRule": false,
    "leadQualifierData_leadDupe": false,
    "leadQualifierData_leadDupeCheck": "00",
    "leadQualifierData_leadDupeCheckRule": false,
    "leadQualifierData_leadDupeRule": false,
    "leadQualifierData_leadDupeTime": "0",
    "leadQualifierData_leadDuration": 0,
    "leadQualifierData_leadFiveMinutes": 0,
    "leadQualifierData_leadFiveMinutesRule": false,
    "leadQualifierData_leadHour": 0,
    "leadQualifierData_leadHourRule": false,
    "leadQualifierData_leadPlusDay": 0,
    "leadQualifierData_leadPlusDayRule": false,
    "leadQualifierData_leadPlusFiveMinutes": 0,
    "leadQualifierData_leadPlusFiveMinutesRule": false,
    "leadQualifierData_leadPlusHour": 0,
    "leadQualifierData_leadPlusHourRule": false,
    "leadQualifierData_leadPlusTimeFirstNotAvailable": 0,
    "leadQualifierData_leadPlusTimeFirstNotAvailableRule": false,
    "leadQualifierData_leadPlusTimeLastNotAvailable": 0,
    "leadQualifierData_leadPlusTimeLastNotAvailableRule": false,
    "leadQualifierData_leadPlusTwelveHours": 0,
    "leadQualifierData_leadPlusTwelveHoursRule": false,
    "leadQualifierData_leadPlusWeek": 0,
    "leadQualifierData_leadPlusWeekRule": false,
    "leadQualifierData_leadTwelveHours": 0,
    "leadQualifierData_leadTwelveHoursRule": false,
    "leadQualifierData_leadWeek": 0,
    "leadQualifierData_leadWeekRule": false,
    "leadQualifierData_regRule": false,
    "leadQualifierData_result": 1,
    "leadQualifierData_stored": false,
    "leadQualifierData_storedRule": false,
    "leadQualifierData_token": "45952EDD-B6D7-6278-6A5D-FBBD9ED2DB14",
    "leadQualifierData_totalEntities": 0,
    "leadQualifierData_totalEntitiesRule": false,
    "leadQualifierData_totalHops": 0,
    "leadQualifierData_totalHopsRule": false,
    "leadQualifierData_urlRule": false,
    "leadQualifierData_urlValue": false,
    "leadQualifierId": "45952EDD-B6D7-6278-6A5D-FBBD9ED2DB14",
    "primaryPhone": "1020180618",
    "providerName": "AC",
    "renterOwner": "N",
    "secondaryPhone": "",
    "spanishSpeaking": "No",
    "transactionCurrencyId": "7F4CA223-B47B-E511-80DD-3863BB2E6B80"
    }

    This is the plugin Trace.

    1781.Capture6.JPG

    These are the complete list of headers I'm using with Postman

    1781.Capture6.JPG

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans