Hi all,
I am facing a strange issue today, the patch is unable to set the lookup field value. It was working until yesterday.
Solved! Go to Solution.
Hi @hemantkumar ,
Currently, the issue has been fixed.
I have made a test on my side, the Patch function could patch data to the LookUp column in your CDS Entity. Please consider take a try with the Patch function again within your app, check if the issue is solved.
If the issue still exists, please consider re-create an app based on your CDS Entity, then try the Patch function again, check if the issue has been fixed.
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Best regards,
Hi @hemantkumar ,
Could you please share a bit more about your issue?
Do you want to set a LookUp field value within your CDS Entity using Patch function? Could you please share a bit more about it?
Based on the needs that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. Please take a try with the following workaround:
Set the Items property of the ComboBox (ComboBox1) to follownig:
Choices(Tasks.crba2_TaskLists_Task) /* <-- TaskLists is the LookUp column in my Tasks Entity */
On your side, you should type:
Choices('YourEntity'.LookUpColumn)
Set the OnSelect property of the "Patch" button to following:
Patch(Tasks, First(Tasks),{TaskLists: ComboBox1.Selected})
If you want to add a new value to your CDS Entity, please take a try with the following formula:
Patch(
'YourEntity',
Defaults('YourEntity'),
{LookUpColumn: ComboBox1.Selected}
)
Please also check and see if the following thread would help in your scenario:
If the issue still exists, I think it may be related to Common Data Service server. Please consider submit an assisted support ticket for help through the following link:
https://powerapps.microsoft.com/en-us/support/pro
Best regards,
Hi, I have the same issue over here, but never did it before, so don't know if it worked before as expected.
I have two custom entities, O and M, with a One-to-Many relation defined to it.
I add one row from a collection to entity O .
After that I add one or more rows from another collection to entity M and try to fill the lookup field with a reference to the record in entity O. With no luck.
Tried lots of way to do that. The most logic way (using the LookUp function in the Patch statement of the child records), does not raise an error, but still the field remains empty.
This LookUp function retreives the correct record, I've checked that by saving some field from the O record in a text field of the child records in the same Patch function.
BTW I have activated the "Relational data" preview function, maybe that's the cause of this behavior?
Thanks, @v-xida-msft for the detailed information.
It was working as expected previously but now it doesn't work. (not sure why it may be because of any updates)
But It updates the other fields.
1)Code:
UpdateContext({currentUser:LookUp(
Users,
'Primary Email' = "hemant@xyy.com"
)});
//Users variable always has data
Patch(
'Test Entities',
Defaults('Test Entities'),
{ Name:TextInput1.Text,
User: currentUser
}
);
2)Code:
Set(account,First(Accounts));
Patch(Contacts, Defaults(Contacts),{'Last Name': TextInput1.Text,Account: account});
Hi @hemantkumar ,
Currently, the issue has been fixed.
I have made a test on my side, the Patch function could patch data to the LookUp column in your CDS Entity. Please consider take a try with the Patch function again within your app, check if the issue is solved.
If the issue still exists, please consider re-create an app based on your CDS Entity, then try the Patch function again, check if the issue has been fixed.
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Best regards,
Hi, thanks for the help, MS Support Team.
In my case it is solved indeed and workes as expected!
Kind regards,
Maurits
Thanks @v-xida-msft , Now it's working as expected.
Regards
Hemant Kumar
User | Count |
---|---|
142 | |
141 | |
77 | |
74 | |
71 |
User | Count |
---|---|
231 | |
164 | |
75 | |
67 | |
61 |