cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Assigning connection (role) throws error

Following scenario:

An entity has a required Contact field. During creation of new items this value should be used for a new connection role.

 

Flow (last step fails):

> Trigger on item creation
> Initialize variable as string for Role-Id
> Get all Connection Roles
> Find the right role and store ID in variable initialized before
> Create a new Connection record with ID variable set for "Role (from)" "Role (to)"

 

Issue:

Something seems to be missing and I receive following error if I try to create a new entity Connection:

There are no ConnectionRoleId and AssociatedObjectTypeCode pairs present.

I think I have set all relevant and available fields, but something is missing I guess.

 

Any help is really appreciated here.

 

Inputs:

{
  "host": {
    "apiId": "subscriptions/[SUBSCRIPTION-ID]/providers/Microsoft.Web/locations/westeurope/runtimes/europe-001/apis/commondataservice",
    "connectionReferenceName": "shared_commondataservice",
    "operationId": "PostItem_V2"
  },
  "parameters": {
    "dataset": "default.cds",
    "table": "connections",
    "item/statuscode": 1,
    "item/_ownerid_type": "",
    "item/_record2roleid_value": "[ROLE-ID]",
    "item/_record1roleid_value": "[ROLE-ID]",
    "item/_record2id_value": "[CONTACT-ID]",
    "item/_record2id_type": "contacts",
    "item/_record1id_value": "[ENTITY-ID]",
    "item/_record1id_type": "[CUSTOM-ENTITY-TYPE]"
  }
}

Outputs:

{
  "statusCode": 400,
  "headers": {
    "Pragma": "no-cache",
    "x-ms-request-id": "***",
    "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
    "X-Content-Type-Options": "nosniff",
    "X-Frame-Options": "DENY",
    "Timing-Allow-Origin": "*",
    "x-ms-apihub-cached-response": "false",
    "Cache-Control": "no-store, no-cache",
    "Date": "Tue, 01 Oct 2019 13:29:38 GMT",
    "Set-Cookie": "ARRAffinity=****;Path=/;HttpOnly;Domain=commondataservice-we.azconn-we.p.azurewebsites.net",
    "Content-Length": "504",
    "Content-Type": "application/json",
    "Expires": "-1"
  },
  "body": {
    "status": 400,
    "message": "There are no ConnectionRoleId and AssociatedObjectTypeCode pairs present. Entities being connected: ([CUSTOM-ENTITY-TYPE],contact); Entity Records being connected: (null,null); Record1ConnectionRoleName: null, Record2ConnectionRoleName: null. ConnectionRoleIds: [ROLE-ID], [ROLE-ID];",
    "source": "***.crm4.dynamics.com",
    "errors": [],
    "debugInfo": "clientRequestId: ***"
  }
}
2 REPLIES 2
Community Support
Community Support

 

Hi @tohms ,

 

Have you checked that every action in the Flow run history is executed as expected and gets a valid value?

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes @v-bacao-msft, the values themselves are fine, but it seems something is missing as a settable value for the "Create record" action.

What makes me thinking that is the following:

 

The error shows that some values seem to be missing and the relating entities (custom entity and Contact) seem not to be set:

Entity Records being connected: (null,null); 
Record1ConnectionRoleName: null, Record2ConnectionRoleName: null

Whereas all available values inside advanced options are set with following:

Role(To): [ConnectionRole1Id as String]
Role(From): [ConnectionRole1Id as String]
ConnectedWith: [ContactId as String]
ConnectedWithType: contacts
ConnectedBy: [CustomEntityId as String]
ConnectedByType: custom_entity

These are all fields that can be set and I'm pretty sure about the correct values and their formats.

 

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (7,050)