Business Central 2024 wave 1 (BC24): Find a matching record in a Power Automate flow (“Find one record” action)

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2024 wave 1 (BC24) is generally available. More details: General availability: Dynamics 365 Business Central 2024 release wave 1 (BC24).

I will continue to test and share some new features that I hope will be helpful.
Find a matching record in a Power Automate flow:

Business value:
Using Power Automate to build flows is already relatively easy, but from time to time, makers are stumbling into this common element of a given process: querying Business Central for a single record that matches certain criteria.

https://learn.microsoft.com/en-us/dynamics365/release-plan/2024wave1/smb/dynamics365-business-central/find-matching-record-power-automate?wt.mc_id=DX-MVP-5004336

Currently, the Find records action always returns a collection or list of records, even if there’s only one record that matches specific criteria, such as the unique record ID. The current action also requires that Power Automate makers understand the syntax of the OData query. For example, enter filter query.

displayName eq 'Microsoft'

“$filter” is already included in parameters, there is no need to add it manually. More details: filter in API

And because there is not only one value in the Find records (V3) step, the system will automatically add an Apply to each loop to the next step.

We use this action in the following discussion.

With this wave (BC24), Microsoft releases a new action, Find one record (V3). (I regularly check whether this action has been released, and today I confirmed that it is available😁)

Find one record (V3)
Retrieves a single record that matches provided filter criteria and offers a friendly way to define conditions (for instance a customer record which name is Contoso). Makers can select several conditions for various fields in the requested API and add sorting conditions so that the proper record is found and retrieved. Ensures that all subsequent actions in the flow can operate on it, without requiring the Apply to each loop. Learn more

The new Find one record action not only lets makers find a single record that matches their criteria, but also gives them a more friendly user interface to provide parameters and define conditions. Makers can select several conditions for various fields in the requested API, add sorting conditions so that the proper record is found, and the Power Automate connector transforms these settings into an OData query.

Parameters:

NameKeyRequiredTypeDescription
EnvironmentbcenvironmentTruestringThe Dynamics 365 Business Central environment.
CompanycompanyTruestringThe Dynamics 365 Business Central company.
API categorydatasetTruestringName of the Dynamics 365 Business Central API category (also called API route)
Table nametableTruestringName of the Dynamics 365 Business Central table
Type of orderOrderstringSelect field/column to order by.
Order results byOrderFieldstringImportant: determines returned record order – if more results are present this action will return the first one.
Continue with empty result when no record was foundNoThrowErrorbooleanDefines if the flow should terminate with an error if the result is empty. (Default is No)
on this fieldFilterFieldTruestringSelect field/column to filter on. Available fields are based on the values selected above.
operatorFilterOperatorTruestringSelect the type of filter. This will be used as OData operator.
valueFilterValueTruestringValue or variable to filter on. Note that OData filtering is case sensitive.

Finding a single record also ensures that all subsequent actions in the flow can operate on it, without requiring the Apply to each loop.

A simple text:

Note
This feature is only available in Business Central online, but it’s in the Power Platform connector so it’s backward compatible with all supported versions of Business Central.

Great. This gives us another option when making Power Automate flows. Give it a try!!!😁

PS:
Raw Inputs:

{
    "host": {
        "connectionReferenceName": "shared_dynamicssmbsaas",
        "operationId": "GetFirstItemV3"
    },
    "parameters": {
        "bcenvironment": "SANDBOX240",
        "company": "37052e92-60e6-ee11-a200-6045bdac9711",
        "dataset": "v2.0",
        "table": "customers",
        "body/Order": "ascending",
        "body/OrderField": "number",
        "body/NoThrowError": false,
        "body/Filter": [
            {
                "FilterField": "number",
                "FilterOperator": "equals",
                "FilterValue": "40000"
            }
        ]
    }
}

Raw Outputs:

{
    "statusCode": 200,
    "headers": {
        "Cache-Control": "no-cache",
        "Pragma": "no-cache",
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "Set-Cookie": "ARRAffinity=abd5893649a385609ddb94ec2b40f91c17639112e86fa277c083d8f91b0a5db0;Path=/;HttpOnly;Secure;Domain=dynamicssmbsaas-cus.azconn-cus-001.p.azurewebsites.net,ARRAffinitySameSite=abd5893649a385609ddb94ec2b40f91c17639112e86fa277c083d8f91b0a5db0;Path=/;HttpOnly;SameSite=None;Secure;Domain=dynamicssmbsaas-cus.azconn-cus-001.p.azurewebsites.net",
        "Strict-Transport-Security": "max-age=31536000",
        "x-ms-request-id": "f616c6f5-726f-4eea-8ea5-02ca67061492",
        "OData-Version": "4.0",
        "X-AspNet-Version": "4.0.30319",
        "X-Powered-By": "ASP.NET",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "false",
        "x-ms-apihub-obo": "false",
        "Date": "Tue, 14 May 2024 00:49:20 GMT",
        "Content-Type": "application/json; odata.metadata=minimal",
        "Content-Length": "1292",
        "Expires": "-1"
    },
    "body": {
        "@odata.context": "https://dynamicssmbsaas-cus.azconn-cus-001.p.azurewebsites.net/v3/$metadata#bcenvironments('SANDBOX240')/companies(37052e92-60e6-ee11-a200-6045bdac9711)/datasets('v2.0')/tables('customers')/items/$entity",
        "@odata.etag": "W/\"JzE5OzY2OTUwMzg4MjEzODQyNDc3MzkxOzAwOyc=\"",
        "ItemInternalId": "225ae725-310c-ef11-9f88-000d3ace0d3e",
        "id": "225ae725-310c-ef11-9f88-000d3ace0d3e",
        "number": "40000",
        "displayName": "Alpine Ski House",
        "type@odata.type": "#Microsoft.NAV.contactType",
        "type": "Company",
        "addressLine1": "Walter-Gropius-Strasse 5",
        "addressLine2": "Park Stadt Schwabing",
        "city": "Munchen",
        "state": "",
        "country": "DE",
        "postalCode": "DE-80807",
        "phoneNumber": "",
        "email": "ian.deberry@contoso.com",
        "website": "",
        "salespersonCode": "JO",
        "balanceDue": 2617.5,
        "creditLimit": 0,
        "taxLiable": false,
        "taxAreaId": "00e3da31-310c-ef11-9f88-000d3ace0d3e",
        "taxAreaDisplayName": "Customers and vendors in EU",
        "taxRegistrationNumber": "",
        "currencyId": "00000000-0000-0000-0000-000000000000",
        "currencyCode": "GBP",
        "paymentTermsId": "bc3eee1f-310c-ef11-9f88-000d3ace0d3e",
        "shipmentMethodId": "00000000-0000-0000-0000-000000000000",
        "paymentMethodId": "00000000-0000-0000-0000-000000000000",
        "blocked@odata.type": "#Microsoft.NAV.customerBlocked",
        "blocked": "_x0020_",
        "lastModifiedDateTime": "2024-05-07T23:19:12.613Z"
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL