I have added a dropdown with items property as [“No”,”Yes”]
My goal in this post is to update the data in cds entity when dropdown is changed to Yes
On the “On change” property of dropdown, add the below code
If(
Dropdown1.Selected.Value = “Yes”,
Patch(
Accounts,
LookUp(
Accounts,
‘Account Name’ = “A. Datum Corporation (sample)”
),
{‘Account Name’: “Datum Sample”}
)
)
Here, if the dropdown value is “Yes”, then I’m updating existing account name A. Datum Corporation (sample)”, with new account name Datum Sample.
In the below code, I’m taking help of account name field to update the record. Instead of account name, you can also take email and update account name.
LookUp(
Accounts,
‘Account Name’ = “A. Datum Corporation (sample)”
)