web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get record id from CDS
Power Automate
Unanswered

Get record id from CDS

(0) ShareShare
ReportReport
Posted on by 817

Hi all,

 

I'm at the end of a flow, but I'm having a problem getting record ID as I need to use it into create new record action with a lookup field.

 

I'm first initializing variable ste

Radoslavov_0-1612434763847.png

Then searching inside CDS for an existing webinar, once have found the webinar I'm passing the webinar into an Appends value to an array variable. 

 

Later in the flow, I'm having a condition where I need to use the CDS webinarid value, but I have access neither to the webinar properties nor the value that I passed to the array step.

Radoslavov_0-1612435226454.png

 

Any help is appriaciated

 

Regards

Kiril

 

 

Categories:
I have the same question (0)
  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @Radoslavov 

    Is the Webinar  List Rows action supposed to return only 1 record?

    Can you also explain the apply_to_each loops you have in your flow?

     

  • Radoslavov Profile Picture
    817 on at

    Hi @Mira_Ghaly ,

    Hi @Mira_Ghaly ,

     

    apply to each was automatically added from the Find Webinar step, since we are searching in CDS inside a webinar entity using a Webinar Name, the system assumes that there might be more than one record returned, but actually should return only one webinar record.

     

    Radoslavov_1-1612441881781.png

    The second apply to each (inside the find webinar step is because of the 

    Appends value to array variable which also expects that IF there is more than one webinar returned should return the webinarid of each one.

     

    However, if you think that there is a better way to get the webinar id so i can place it later in the flow inside the apply to each step feel free to share it, so I can try it.

     

    If I remove all variable steps, this is how the flow looks like

    Radoslavov_6-1612442419759.png

    Hope this helps you 🙂

     

    Regards, Kiril

  • Radoslavov Profile Picture
    817 on at

    So I've decided to remove all variables, but still not able to get to the webinarid property in CDS to use it in my last step where I need to create a new user with a reference to the webinar.

     

    I've used items('Apply_to_each_7')?['new_webinarsid']

    Radoslavov_0-1612534519633.png

    Radoslavov_1-1612534545502.png

    Unable to process template language expressions for action 'Apply_to_each_7' at line '1' and column '27618': 'The template language expression 'outputs('List_CRM_webinars')?['body/value']' cannot be evaluated because property 'body/value' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

     

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @Radoslavov 

    To get the value directly from the List Rows action:

    outputs('ListActionName')?['body/value'][0]['fieldSchemaName']

    So you need to replace ListActionName with Find_Webinar and fieldSchemaName with the schema name of the webinar id.

     

  • Radoslavov Profile Picture
    817 on at

    so, this is what i get after running the flow:

    InvalidTemplate. Unable to process template language expressions for action 'Apply_to_each_7' at line '1' and column '27619': 'The template language expression 'outputs('List_CRM_webinars')?['body/value']' cannot be evaluated because property 'body/value' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

     

    This is my expressions

    outputs('List_CRM_webinars')?['body/value'][0]['new_webinarsid']

    Radoslavov_1-1612595552613.png

     

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @Radoslavov

    I think this might be because there is no records return from List CRM webinars, can u check the flow run history if there is returned values and if so we Can add a condition to check if the list records has returned value or not

     

  • Radoslavov Profile Picture
    817 on at

    actually, there is a record 

    Radoslavov_0-1612599378697.png

       
    "body": {
            "@odata.context""https://europe-002.a/items",
            "value": [
                {
                    "@odata.id""https://org)",
                    "@odata.etag""",
                    "ItemInternalId""337fc7fb-c966-eb11-a812-000d3a44cde6",
                    "_owningbusinessunit_value""59bcc528-5652-eb11-bb23-000d3a45b8a0",
                    "_owningbusinessunit_type""businessunits",
                    "new_webinarsid""337fc7fb-c966-eb11-a812-000d3a44cde6",
                    "statuscode"1,
                    "_statuscode_label""Active",
                    "_createdby_value""e771ddb1-8e52-eb11-bb23-000d3a45b8a0",
                    "_createdby_type""systemusers",
                    "timezoneruleversionnumber"0,
                    "new_startdate""2021-02-15T10:00:00Z",
                    "_ownerid_value""e771ddb1-8e52-eb11-bb23-000d3a45b8a0",
                    "_ownerid_type""systemusers",
                    "modifiedon""2021-02-04T09:18:51Z",
                    "_modifiedby_value""e771ddb1-8e52-eb11-bb23-000d3a45b8a0",
                    "_modifiedby_type""systemusers",
                    "versionnumber"5486179,
                    "new_name""CRM integration",
                    "createdon""2021-02-04T09:18:51Z",
                    "statecode"0,
                    "_statecode_label""Active"
                }
            ]
        }
    }
  • Paulie78 Profile Picture
    8,422 Moderator on at

    I would take a slightly different approach. Take your Find Webinar step out of the "apply each" loop. Then use a compose step and use the first expression to get the first (and only) record from that array. Your compose step will then contain the record that you want to reference. If you want it to contain only the webinar ID you could do something like:

     

    first(body('Find_webinar')['fieldName']

    This will then give you something you can easily refer to in the remainder of the flow.

  • Radoslavov Profile Picture
    817 on at

    Hi @Paulie78 ,

     

    I've done this:

     

    Radoslavov_0-1612781202589.png

     

    first(body('List_CRM_webinars')['new_webinarsid'])

    But i'm getting the following error message

    Unable to process template language expressions in action 'Compose_for_CRM_Webinar' inputs at line '1' and column '27619': 'The template language expression 'first(body('List_CRM_webinars')['new_webinarsid'])' cannot be evaluated because property 'new_webinarsid' doesn't exist, available properties are '@odata.context, value'. Please see https://aka.ms/logicexpressions for usage details.'.

    Radoslavov_1-1612781248368.png

     

    But the field actually exists and the name is correct as I copy it from the outputs

    Radoslavov_2-1612781307916.png

    Am I doing something wrong?

     

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Try:

    first(body('List_CRM_webinars'))['value'][0]['new_webinarsid']

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard