cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
krishnags
Super User
Super User

Lookup to be added on Screen

Hi All, I am new to this Power Platform. As part of exploring the Power Apps, I started off creating some basic apps. While doing that, I was trying to create a contact from App and want to show the account lookup on the screen. I am not using any form or gallery, instead I am using blank screen and adde all my required feilds. I am able to create a new contact in CDS (D365) without Account, but I want to add Account to it and if the required account is not avaialble from the lookup, it should create an account and map it to that contat.

 

If(
!(PasswordTextInput.Text = ReEnterPasswordTextInput.Text),
Notify(
"Passwords not matching",
NotificationType.Error
),
Patch(
Contacts,
{'First Name':FirstNameTextInput.Text,
'Last Name':LastNameTextInput.Text,
Password:PasswordTextInput.Text,
Email:EmailTextInput.Text,
'Business Phone':PhoneNumberTextInput.Text }
)
); Navigate(SuccessScreen,None)

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @krishnags,

Could you please share a bit more about your scenario?

Do you want to list the available accounts from the Accounts Entity of your CDS within your app?

If you want to list the available accounts from the Accounts Entity of your CDS within your app, I think the Combo Box control could achieve your needs. I have made a test on my side, please take a try with the following workaround:9.JPG

 

8.JPG

Within your app, add your Accounts Entity as a data source, then add a Combo Box control within the screen of your app, set the Items property of the Combo Box control to following:

Accounts

Within the Right Pop-Up panel, set the Primary text field and SearchField both to FullName column.

Please check the attached GIF screenshot for more details:

 

I assume that you have created a Account Name column (Text Type column) in your Contacts Entity already, please modify your formula as below:

If(
  !(PasswordTextInput.Text = ReEnterPasswordTextInput.Text),
  Notify("Passwords not matching", NotificationType.Error),
  Patch(
        Contacts,
Defaults(Contacts), /* <- Modify formula here */ {
'First Name':FirstNameTextInput.Text, 'Last Name':LastNameTextInput.Text, Password: PasswordTextInput.Text, Email: EmailTextInput.Text, 'Business Phone': PhoneNumberTextInput.Text,
AccountName: ComboBox1.Selected.FullName /* <- Add formula here , ComboxBox1 represents the ComboBox control in your app*/
} ) );
Navigate(SuccessScreen,None)

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @krishnags,

Could you please share a bit more about your scenario?

Do you want to list the available accounts from the Accounts Entity of your CDS within your app?

If you want to list the available accounts from the Accounts Entity of your CDS within your app, I think the Combo Box control could achieve your needs. I have made a test on my side, please take a try with the following workaround:9.JPG

 

8.JPG

Within your app, add your Accounts Entity as a data source, then add a Combo Box control within the screen of your app, set the Items property of the Combo Box control to following:

Accounts

Within the Right Pop-Up panel, set the Primary text field and SearchField both to FullName column.

Please check the attached GIF screenshot for more details:

 

I assume that you have created a Account Name column (Text Type column) in your Contacts Entity already, please modify your formula as below:

If(
  !(PasswordTextInput.Text = ReEnterPasswordTextInput.Text),
  Notify("Passwords not matching", NotificationType.Error),
  Patch(
        Contacts,
Defaults(Contacts), /* <- Modify formula here */ {
'First Name':FirstNameTextInput.Text, 'Last Name':LastNameTextInput.Text, Password: PasswordTextInput.Text, Email: EmailTextInput.Text, 'Business Phone': PhoneNumberTextInput.Text,
AccountName: ComboBox1.Selected.FullName /* <- Add formula here , ComboxBox1 represents the ComboBox control in your app*/
} ) );
Navigate(SuccessScreen,None)

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (58,563)