cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

502 error when attempting to update a CRM record

I'm getting a 502 error "Resource not found for the segment 'owners'." when I try to update the owner of a record in CRM.

 

Flow ID: 166f7456-23f3-47e0-a96f-a9a314002fd0/runs/08587264358205540749127884561

 

Sample run results (sanitized some parts and added braces for easier reading):

 

New leads routing
Ran at 9/29/2016 10:44:28 AM
 
When a record is created (4s) {
Inputs: {
Organization Name: dynflow.crm,
Entity Name: leads
}
Outputs:{
value
{
  "@odata.etag": "",
  "ItemInternalId": "1f450de3-6b86-e611-80ed-3863bb2b8bc8",
  "emailaddress3": null,
  "emailaddress2": null,
  "emailaddress1": "aboxman@contoso.com",
  "budgetamount_base": null,
  "_slaid_value": null,
  "budgetstatus": null,
  "modifiedon": "09/29/2016 17:41:02",
  "overriddencreatedon": null,
  "websiteurl": null,
  "yomifirstname": null,
  "donotpostalmail": false,
  "yomifullname": "ANDREW BOXMAN",
  "telephone3": null,
  "confirminterest": false,
  "estimatedamount": null,
  "pager": null,
  "_owningbusinessunit_value": "a3c602a5-a97a-e611-80ec-3863bb2e9318",
  "_owningbusinessunit_type": "businessunits",
  "mobilephone": null,
  "leadqualitycode": 2,
  "_qualifyingopportunityid_value": null,
  "_relatedobjectid_value": null,
  "_parentcontactid_value": null,
  "statuscode": 1,
  "onholdtime": null,
  "numberofemployees": null,
  "initialcommunication": null,
  "exchangerate": null,
  "companyname": null,
  "_parentaccountid_value": null,
  "createdon": "09/29/2016 17:41:02",
  "donotbulkemail": false,
  "donotfax": false,
  "firstname": "ANDREW",
  "_createdonbehalfby_value": null,
  "salesstage": null,
  "evaluatefit": false,
  "qualificationcomments": null,
  "lastusedincampaign": null,
  "_originatingcaseid_value": null,
  "description": null,
  "_modifiedby_value": "a5a3afc8-b47e-e611-80f1-3863bb349d88",
  "_modifiedby_type": "systemusers",
  "timezoneruleversionnumber": null,
  "preferredcontactmethodcode": 1,
  "_modifiedonbehalfby_value": null,
  "subject": "Dancing in the wind",
  "yomilastname": null,
  "traversedpath": "f99b4d48-7aad-456e-864a-8e7d543f7495",
  "estimatedvalue": null,
  "leadsourcecode": null,
  "revenue": null,
  "industrycode": null,
  "salesstagecode": 1,
  "schedulefollowup_qualify": null,
  "middlename": null,
  "entityimageid": null,
  "entityimage": null,
  "_customerid_value": null,
  "participatesinworkflow": false,
  "processid": "919e14d1-6489-4852-abd0-a63a6ecaac5d",
  "decisionmaker": false,
  "_slainvokedid_value": null,
  "jobtitle": null,
  "_transactioncurrencyid_value": null,
  "fax": null,
  "_masterid_value": null,
  "yomimiddlename": null,
  "_ownerid_value": "a5a3afc8-b47e-e611-80f1-3863bb349d88",
  "_ownerid_type": "systemusers",
  "revenue_base": null,
  "merged": false,
  "purchasetimeframe": null,
  "budgetamount": null,
  "donotemail": false,
  "donotphone": false,
  "lastonholdtime": null,
  "schedulefollowup_prospect": null,
  "donotsendmm": false,
  "_createdby_value": "a5a3afc8-b47e-e611-80f1-3863bb349d88",
  "_createdby_type": "systemusers",
  "salutation": null,
  "prioritycode": 1,
  "stageid": "f99b4d48-7aad-456e-864a-8e7d543f7495",
  "utcconversiontimezonecode": null,
  "leadid": "1f450de3-6b86-e611-80ed-3863bb2b8bc8",
  "_campaignid_value": null,
  "estimatedclosedate": null,
  "importsequencenumber": null,
  "telephone2": null,
  "versionnumber": 619068,
  "telephone1": null,
  "yomicompanyname": null,
  "purchaseprocess": null,
  "estimatedamount_base": null,
  "lastname": "BOXMAN",
  "fullname": "ANDREW BOXMAN",
  "need": null,
  "sic": null,
  "statecode": 0
}
}
}

Get user profile (1s) {
Inputs: {
User: aboxman@contoso.com
}
Outputs:{
User id: SANITIZE-DUSE-RID1-2345-678901234567
Display name: ANDREW BOXMAN 
Given name: ANDREW
Surname: BOXMAN 
Email: aboxman@contoso.com
Nickname: aboxman
Telephone number: +5551234567
Account enabled? true
User Principal Name: aboxman@contoso.com
Department: LEGAL
Job title: SENIOR ATTORNEY
}
}

Condition (contains(Department, 'LEGAL')){

IF YES: {

List records (2s): {
Inputs{
Organization Name: dynflow.crm,
Entity Name: systemusers,
Filter Query: internalemailaddress eq 'cdarwin@contoso.com'
}
Outputs:{
value
{
  "@odata.context": "http://127.0.0.1/$metadata#datasets('dynflow.crm')/tables('systemusers')/items",
  "value": [
    {
      "@odata.etag": "",
      "ItemInternalId": "614a8cbf-ab7e-e611-80f1-3863bb349d88",
      "traversedpath": null,
      "internalemailaddress": "cdarwin@contoso.com",
      "modifiedon": "09/28/2016 00:00:11",
      "skills": null,
      "yomifirstname": null,
      "yomifullname": "Charles Darwin",
      "title": "SENIOR PROGRAM MANAGER",
      "utcconversiontimezonecode": null,
      "passporthi": null,
      "homephone": null,
      "_territoryid_value": null,
      "disabledreason": null,
      "lastname": "Darwin",
      "caltype": 0,
      "_calendarid_value": "6412b4c2-7325-4501-bf8f-be54a7a2711c",
      "_calendarid_type": "calendars",
      "setupuser": false,
      "islicensed": true,
      "userlicensetype": 3,
      "exchangerate": null,
      "preferredemailcode": 1,
      "_mobileofflineprofileid_value": null,
      "passportlo": null,
      "createdon": "09/19/2016 20:58:06",
      "_queueid_value": "664a8cbf-ab7e-e611-80f1-3863bb349d88",
      "_queueid_type": "queues",
      "yomimiddlename": null,
      "firstname": "Charles",
      "displayinserviceviews": false,
      "employeeid": null,
      "processid": null,
      "governmentid": null,
      "_modifiedby_value": null,
      "outgoingemaildeliverymethod": 2,
      "timezoneruleversionnumber": null,
      "_modifiedonbehalfby_value": null,
      "preferredphonecode": 1,
      "yomilastname": null,
      "emailrouteraccessapproval": 1,
      "systemuserid": "614a8cbf-ab7e-e611-80f1-3863bb349d88",
      "_defaultmailbox_value": "654a8cbf-ab7e-e611-80f1-3863bb349d88",
      "_defaultmailbox_type": "mailboxes",
      "middlename": null,
      "entityimageid": null,
      "entityimage": null,
      "overriddencreatedon": null,
      "mobilephone": "555.987.6543",
      "mobilealertemail": null,
      "sharepointemailaddress": null,
      "_positionid_value": null,
      "preferredaddresscode": 1,
      "incomingemaildeliverymethod": 2,
      "_createdonbehalfby_value": null,
      "jobtitle": null,
      "nickname": null,
      "_transactioncurrencyid_value": null,
      "organizationid": "a4f607bb-b874-4212-beac-81db8bf57e49",
      "yammeremailaddress": null,
      "defaultfilterspopulated": false,
      "_siteid_value": null,
      "photourl": null,
      "accessmode": 0,
      "personalemailaddress": null,
      "isintegrationuser": false,
      "domainname": "cdarwin@contoso.com",
      "_createdby_value": null,
      "windowsliveid": "cdarwin@contoso.com",
      "salutation": null,
      "_parentsystemuserid_value": null,
      "stageid": null,
      "defaultodbfoldername": "CRM",
      "yammeruserid": null,
      "importsequencenumber": null,
      "isemailaddressapprovedbyo365admin": false,
      "invitestatuscode": 0,
      "versionnumber": 616662,
      "issyncwithdirectory": true,
      "_businessunitid_value": "a3c602a5-a97a-e611-80ec-3863bb2e9318",
      "_businessunitid_type": "businessunits",
      "fullname": "Charles Darwin",
      "isdisabled": false
    }
  ]
}
value
[
  {
    "@odata.etag": "",
    "ItemInternalId": "614a8cbf-ab7e-e611-80f1-3863bb349d88",
    "traversedpath": null,
    "internalemailaddress": "cdarwin@contoso.com",
    "modifiedon": "09/28/2016 00:00:11",
    "skills": null,
    "yomifirstname": null,
    "yomifullname": "Charles Darwin",
    "title": "SENIOR PROGRAM MANAGER",
    "utcconversiontimezonecode": null,
    "passporthi": null,
    "homephone": null,
    "_territoryid_value": null,
    "disabledreason": null,
    "lastname": "Darwin",
    "caltype": 0,
    "_calendarid_value": "6412b4c2-7325-4501-bf8f-be54a7a2711c",
    "_calendarid_type": "calendars",
    "setupuser": false,
    "islicensed": true,
    "userlicensetype": 3,
    "exchangerate": null,
    "preferredemailcode": 1,
    "_mobileofflineprofileid_value": null,
    "passportlo": null,
    "createdon": "09/19/2016 20:58:06",
    "_queueid_value": "664a8cbf-ab7e-e611-80f1-3863bb349d88",
    "_queueid_type": "queues",
    "yomimiddlename": null,
    "firstname": "Charles",
    "displayinserviceviews": false,
    "employeeid": null,
    "processid": null,
    "governmentid": null,
    "_modifiedby_value": null,
    "outgoingemaildeliverymethod": 2,
    "timezoneruleversionnumber": null,
    "_modifiedonbehalfby_value": null,
    "preferredphonecode": 1,
    "yomilastname": null,
    "emailrouteraccessapproval": 1,
    "systemuserid": "614a8cbf-ab7e-e611-80f1-3863bb349d88",
    "_defaultmailbox_value": "654a8cbf-ab7e-e611-80f1-3863bb349d88",
    "_defaultmailbox_type": "mailboxes",
    "middlename": null,
    "entityimageid": null,
    "entityimage": null,
    "overriddencreatedon": null,
    "mobilephone": "555.987.6543",
    "mobilealertemail": null,
    "sharepointemailaddress": null,
    "_positionid_value": null,
    "preferredaddresscode": 1,
    "incomingemaildeliverymethod": 2,
    "_createdonbehalfby_value": null,
    "jobtitle": null,
    "nickname": null,
    "_transactioncurrencyid_value": null,
    "organizationid": "a4f607bb-b874-4212-beac-81db8bf57e49",
    "yammeremailaddress": null,
    "defaultfilterspopulated": false,
    "_siteid_value": null,
    "photourl": null,
    "accessmode": 0,
    "personalemailaddress": null,
    "isintegrationuser": false,
    "domainname": "cdarwin@contoso.com",
    "_createdby_value": null,
    "windowsliveid": "cdarwin@contoso.com",
    "salutation": null,
    "_parentsystemuserid_value": null,
    "stageid": null,
    "defaultodbfoldername": "CRM",
    "yammeruserid": null,
    "importsequencenumber": null,
    "isemailaddressapprovedbyo365admin": false,
    "invitestatuscode": 0,
    "versionnumber": 616662,
    "issyncwithdirectory": true,
    "_businessunitid_value": "a3c602a5-a97a-e611-80ec-3863bb2e9318",
    "_businessunitid_type": "businessunits",
    "fullname": "Charles Darwin",
    "isdisabled": false
  }
]
}
}

Apply to each: {

Update a record (2m): {
Inputs: {
Host: {
  "api": {
    "runtimeUrl": "https://msmanaged-na.azure-apim.net/apim/dynamicscrmonline"
  },
  "connection": {
    "name": "/providers/Microsoft.PowerApps/apis/shared_dynamicscrmonline/connections/shared-dynamicscrmon-47e18112-04ea-4c28-b1fe-aca624dc030b"
  }
}
Method: patch
Path: /datasets/dynflow.crm/tables/leads/items/1f450de3-6b86-e611-80ed-3863bb2b8bc8
Authentication: {
  "scheme": "Key",
  "parameter": "*sanitized*",
  "value": "*sanitized*",
  "type": "Raw"
}
Body: {
  "subject": "Dancing in the wind",
  "_ownerid_value": "614a8cbf-ab7e-e611-80f1-3863bb349d88",
  "lastname": "BOXMAN"
}
}
Outputs: {
Headers: {
  "Pragma": "no-cache",
  "x-ms-datasourceerror": "True",
  "x-ms-request-id": "b5ff548a-f6eb-4cdd-971b-688b176bc61a",
  "Cache-Control": "no-cache",
  "Date": "Thu, 29 Sep 2016 17:46:05 GMT",
  "Set-Cookie": "ARRAffinity=7ab1fec59f611f278bc539caf223232cbf4a073f87e005294db91b5921ad6504;Path=/;Domain=127.0.0.1",
  "Server": "Microsoft-IIS/8.0,Microsoft-HTTPAPI/2.0",
  "X-AspNet-Version": "4.0.30319",
  "X-Powered-By": "ASP.NET",
  "Content-Length": "3710",
  "Content-Type": "application/json; charset=utf-8",
  "Expires": "-1"
},
Body: {
  "status": 502,
  "message": "{\r\n  \"code\": \"\",\r\n  \"message\": \"Resource not found for the segment 'owners'.\",\r\n  \"innererror\": {\r\n    \"message\": \"Resource not found for the segment 'owners'.\",\r\n    \"type\": \"Microsoft.OData.Core.UriParser.ODataUnrecognizedPathException\",\r\n    \"stacktrace\": \"   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection`1 segments)\\r\\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\\r\\n   at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\\r\\n   at Microsoft.OData.Core.UriParser.ODataUriParser.ParsePath()\\r\\n   at Microsoft.Crm.Extensibility.OData.CrmEdmEntityReference.CreateCrmEdmEntityReference(Uri link, CrmODataExecutionContext context)\\r\\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmEntityTypeConverter.SetNavigationPropertyToXrmEntity(Entity entity, EntityMetadata entityMetadata, IEdmProperty edmProperty, EntityRelationship entityRelationship, Object propertyValue, Nullable`1 role)\\r\\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmEntityTypeConverter.ConvertToCrmTypeInternal(EdmEntityObject edmTypeValue)\\r\\n   at Microsoft.Crm.Extensibility.OData.TypeConverters.EdmTypeConverterBase`2.ConvertToCrmType(Object edmTypeValue)\\r\\n   at Microsoft.Crm.Extensibility.OData.EdmTypeConverter.ConvertToCrmEntity(EdmEntityObject edmEntity, EntityReference entityReference)\\r\\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.UpdateEdmEntity(CrmODataExecutionContext context, String edmEntityName, String entityKeyValue, EdmEntityObject entityObject)\\r\\n   at Microsoft.Crm.Extensibility.OData.EntityController.PatchEntity(String entityName, String key, EdmEntityObject entityDelta)\\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.ActionExecutor.Execute(Object instance, Object[] arguments)\\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.ExceptionServices.ExceptionDispatchInfo.Throw()\\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.ExceptionServices.ExceptionDispatchInfo.Throw()\\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.ExceptionServices.ExceptionDispatchInfo.Throw()\\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()\"\r\n  }\r\n}",
  "source": "dynflow.api.crm.dynamics.com",
  "errors": []
}
}
}
}
}

IF NO:{

List records 2 (0s)

Filter array 2 (0s)

Apply to each 2
}
}
1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft
Microsoft

Re: 502 error when attempting to update a CRM record

This issue is actually related to another issue I opened.

what needs to be happening here is the _owner_type field must also be filled.

 

However, at the time of this post there may have been other issues with Flow > CRM connection not properly doing assigns.

View solution in original post

2 REPLIES 2
Microsoft
Microsoft

Re: 502 error when attempting to update a CRM record

Hi michowl,

 

I think the error is throw by "dynflow.api.crm.dynamics.com" instead by our flow, the owners field might be missing. I'm not so familiar with CRM.

 

Thanks

Microsoft
Microsoft

Re: 502 error when attempting to update a CRM record

This issue is actually related to another issue I opened.

what needs to be happening here is the _owner_type field must also be filled.

 

However, at the time of this post there may have been other issues with Flow > CRM connection not properly doing assigns.

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (9,253)