[Solved] Resource not found for the segment in Power Automate

When using the current environment CDS connector, and try to populate a lookup field and get the error message below. One must specify the plural name of the entity and the record GUID as shown in the example below the error messages.

The image below shows the value inputs without specifying the Lookup entity names, and causes the flow to fail.

Resource not found for the segment
Error message: Resource not found for the segment

If you receive the above error message the entity plural name is not specified and it doesn’t recognize the GUID as a segment, which causes the flow to fail.

Below is the lookup field specified and the related record GUID and this should solve the issue. Remember to use the plural name and not the single tense. For instance, use systemusers not systemuser, and accounts not account. With entity lookup single name it will give a similiar error message like below, and can be solved by adding the plural name of the entity instead.

{
  "error": {
    "code": "0x0",
    "message": "Resource not found for the segment 'account'."
  }
}

This is how it should look like to make it work.

How can I find the lookup logical name?

One way you can find it is by getting the information from the entity you are using in the flow before performing the action. For instance if you are using the trigger When a record is created, updated or deleted or the action Get a record you will get a JSON body with information about that record.

Lets say you have a HTTP flow for creating a task on an account. Where you post an account id to the endpoint and create a task. In the image below you can see an example.

After the flow has ran take the Get Account body and copy the body into notepad or Visual Studio Code for better formatting and color visualization. And look for the owner of the record. This might look like below and in the images below you can see the lookup logical name underlined in red. An example from both notepad and visual studio code. And this name must be used to solve the issue “Resource not found for the segment in Power Automate”.

In Notepad:

In Visual Studio Code:

When the lookup logical name is found for the record you want it to relate to, you must specify the lookup field with the related record GUID.

Hope this helps you in solving the problem with “Resource not found for the segment in Power Automate”.