i've spent a few long hours trying to evaluate whether the number of records returned by a salesforce get records element is equal to 1, but the basic question is how to evaluate the number of records found.
i have a get records element, followed by a condition set to evaluate if an expression is equal to 1. the yes/no path both send an email for testing purposes.
i tried the following
expression : length(body('Get_records'))
error : The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.
so i converted the body to an array.
expression : length(createArray(body('Get_records')))
2 records are found, but it still goes down the 'true' path, meaning it found that the expression == 1.
i have tried both of these with body('Get_records')?['value']) as well, and the results are the same.
here is the output from the get records element where 2 records are found
{
"@odata.context": "https://flow-apim-msmanaged-na-eastus2-01.azure-apim.net/apim/salesforce/shared-salesforce-b1fc4548-a672-411f-be17-317aff51b9c4/$metadata#datasets('default')/tables('OpportunityPayment__c')/items",
"value": [
{
"@odata.etag": "",
"ItemInternalId": "9e7908fc-7eb9-40c3-b24e-6b6b224f05be",
"CreatedById": "00540000001CkxPAAS",
"CreatedDate": "2020-07-21T17:51:12Z",
"CurrencyIsoCode": "EUR",
"Id": "a0E0R000002oi5TUAQ",
"IsDeleted": false,
"LastActivityDate": null,
"LastModifiedById": "00540000001CkxPAAS",
"LastModifiedDate": "2020-07-21T20:49:17Z",
"LastReferencedDate": "2020-07-21T20:49:19Z",
"LastViewedDate": "2020-07-21T20:49:19Z",
"Name": "P-120713",
"SystemModstamp": "2020-07-21T20:49:17Z",
"Account_Credited__c": "Stripe",
"Amount_Received__c": 12345,
"Amount_USD__c": 12345,
"Broker__c": null,
"Check_Date__c": null,
"Deposit_Date__c": null,
"Exchange_Rate__c": 1,
"Fees__c": null,
"GA_claimed_date__c": null,
"Gift_Aid_signed__c": false,
"ID__c": null,
"Name_Details__c": null,
"Number_of_Shares__c": null,
"Old_Amount_Received__c": null,
"Other_Information__c": "sub_HgnC03jnVVv9uJ",
"Payment_Currency__c": "EUR",
"Payment_Due_Date__c": "2020-07-21",
"Payment_Received_Date__c": "2020-07-21",
"Payment_Type__c": "Credit Card",
"Payment_for__c": "0060R00000EAaV8QAL",
"Sale_Date__c": null,
"Selling_Price_Market_Value__c": null,
"Subscription_Id__c": "sub_HgnC03jnVVv9uJ"
},
{
"@odata.etag": "",
"ItemInternalId": "a62276be-ef2b-4e3d-be86-509f9f6978cb",
"CreatedById": "00540000001CkxPAAS",
"CreatedDate": "2020-07-21T20:49:25Z",
"CurrencyIsoCode": "EUR",
"Id": "a0E0R000002okNfUAI",
"IsDeleted": false,
"LastActivityDate": null,
"LastModifiedById": "00540000001CkxPAAS",
"LastModifiedDate": "2020-07-21T20:49:25Z",
"LastReferencedDate": "2020-07-21T20:49:27Z",
"LastViewedDate": "2020-07-21T20:49:27Z",
"Name": "P-120714",
"SystemModstamp": "2020-07-21T20:49:25Z",
"Account_Credited__c": "Stripe",
"Amount_Received__c": 12345,
"Amount_USD__c": 12345,
"Broker__c": null,
"Check_Date__c": null,
"Deposit_Date__c": null,
"Exchange_Rate__c": 1,
"Fees__c": null,
"GA_claimed_date__c": null,
"Gift_Aid_signed__c": false,
"ID__c": null,
"Name_Details__c": null,
"Number_of_Shares__c": null,
"Old_Amount_Received__c": null,
"Other_Information__c": "sub_HgnC03jnVVv9uJ",
"Payment_Currency__c": "EUR",
"Payment_Due_Date__c": "2020-07-22",
"Payment_Received_Date__c": "2020-07-22",
"Payment_Type__c": "Credit Card",
"Payment_for__c": "0060R00000EAaV8QAL",
"Sale_Date__c": null,
"Selling_Price_Market_Value__c": null,
"Subscription_Id__c": "sub_HgnC03jnVVv9uJ"
}
]
}
and here is a screenshot of the flow

so...any suggestions on how to determine the number of records returned (or simply, if any records are returned?)