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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Powerapps: problem spe...
Power Apps
Unanswered

Powerapps: problem specifying DataCard record Id for Patch function

(0) ShareShare
ReportReport
Posted on by 2

I have a PowerApps CanvasApp, inside a CRM environment. It consists of a survey form of this way:

  • From a  DataCard I am getting the Account record, keeping in mind that here there is an interaction with Account source entity.

 

 

 

 

 

DataSourceInfo([@Accounts], DataSourceInfo.MaxLength, "name")

 

 

 

 

 

 

 This process is working because I can see the Account selected to include this application inside the CRM Account form. I mean the name Bernardo Garcia

 

vVlfX

 

I want to set the Submit action in its Button, in order to pass the accountid in the formula. I want here use the accountid of the context Account which is active and using CRM.

In the new_account key here, I don't know how to pass the accountid, so I have the following as a test:

 

 

 

 

 

Patch(
 Surveys,Defaults(Surveys), 
 {
 new_city:DataCardCityValue,

 # IS HERE WHERE I WANT TO PASS THE accountid. It is a test 
 new_account:First(Filter(Accounts,'Address 1: Primary Contact Name')),
 
 new_phone:DataCardPhoneValue,
 new_name:TextInputName.Text, 
 new_issurveydone:ToggleSurveyDone.Value,
 new_noofemployee:Value(NoEmployeeSlider.Value),
 new_email:TextInputEmail.Text,
 new_surveydate:SurveyDatePicker.SelectedDate,
 new_signature:SignaturePenInput.Image
 });

 

 

 

 

 

With this formula in the Submit button I manage to store in my Survey entity in CRM the survey data, but I am not getting the value regarding to Account

I am trying to get the accountid using the Value function, but of course I am asking for the Text value here

 

j62OI

 

I have been trying according to this explanation, and this another article , but is not clear for me how should I set the parameter inside the `Patch` function.

If someone can point me in the right direction, I will appreciate it.

Categories:
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @bgarcial ,

    Could you tell me

    1)the relationship between Surveys entity and Accounts entity?

    2) is new_account a lookup field?
    3)describe more clearly the meaning of this formula?

    Filter(Accounts,'Address 1: Primary Contact Name')

     Usually, we use this kind of formula to update lookup field:

    Patch(entity,Defaults(entity),{lookupfieldname:DataCardValue.Selected,....})

    set the lookup field's drop down's Items: 

    Choices([@YourEntity].lookupColumn) 

     Or like this:

    Patch(
     Surveys,Defaults(Surveys), 
     {
     new_city:DataCardCityValue,
     new_account:LookUp(Accounts,condition)),
     
     ....
     });

    The lookup formulas should be like:

    LookUp(Accounts,'Address 1: Primary Contact Name'=....)  //if 'Address 1: Primary Contact Name' is a field name.

     

     

     

    Please refer these two docs about updating lookup field:

    https://powerusers.microsoft.com/t5/Common-Data-Service-for-Apps/Problem-with-lookup-fields/m-p/360145

    https://powerusers.microsoft.com/t5/Common-Data-Service-for-Apps/Patching-User-Lookup-on-CDM/m-p/366115

     

     

     

    Best regards,

  • bgarcial Profile Picture
    2 on at

    Hi, @v-yutliu-msft Thanks for reaching out.

     

    I want to answer your questions.

     

    2) is new_account a lookup field?

    Yes new_account is a Lookup field. You can see it here.

    wcAO2fyGvm

     

    1. the relationship between Surveys entity and Accounts entity?

     

    Yes, it was a small and important detail which I forgot. My apologies.

    I am trying to set up the relationship between Account and Surveys,  1 : N

    But I have some doubts here:

    At the Lookup Field section, do I need to reference the new_account field?

     

    wI72QCjdrH

     

    3)describe more clearly the meaning of this formula?

     

     

    Filter(Accounts,'Address 1: Primary Contact Name') 

     

     

    Really It was only a test to verify despite I wasn't getting the accountid (because of the relationship between Surveys and Account ... I guess) I can store data in my Surveys Entity, so, really this value I don't want to reference it in any specific place.

    It was just to fill something in the new_account key.

     

    The Address 1: Primary Contact Name'  yes, it is a Field, in the Accounts form, and obviously in the Account Entity

     

    61xh0mQsNT

     

    But I don't need it in my Formula process.

     

    The other recommendations about reference the lookup field inside Patch Formula look nice, but I suppose that I need to set up the relationship first in order to continue right?

     

     

     

     

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard