Hello all powerapps users,
I have two custom entity in Dynamic 365,
First entity name: Bookable Resource
Second entity name : Alternate Resource
Bookable Resource entity has a column called, "Name" column type is Single Line Text.
Alternate Resource entity has a column called, "Team" column type is Lookup (Lookup of Name Column).
I want to create a new record in AlternateResource entity, however record created properly but my value not inserted in Team column. (Team is lookup type column of Name).
.
Below patch functioin creates new record in entity:
Patch(
AlternateResource,
Defaults(AlternateResource),
{
'Task Type': Value(DataCardValue1.Text),
'Task Head': Value(DataCardValue5.Text),
}
);
But when i use lookup column (Team) in patch, that gives me error.
Patch(
AlternateResource,
Defaults(AlternateResource),
{
'Task Type': Value(DataCardValue1.Text),
'Task Head': Value(DataCardValue5.Text),
'Team':Textinput1.text
}
);
I dont know how to play with lookup column,
so please Help me, how can i create a new record properly in my Entity.
Solved! Go to Solution.
Hi @sachinsoni441,
Could you please share a bit more about the error message with your Patch formula? Does it say that the 'new_myemployee' column not exist within your Demo2 data source?
Based on the formula that you mentioned, I think there is something wrong with it. Please take a try to modify your formula as below:
Patch( Demo2, Defaults(Demo2), { _new_myemployee_value: ComboBox1.Selected.new_employee /* <-- Type _new_myemployee_value rather than 'new_myemployee' */ } )
You could find the corresponding LookUp column name via using property select operator (.) after the Demo2 data source. Please take a try with the following formula within your app:
Demo2.
then all available columns/properties would be shown up after it, you could find the LookUp column name/property.
Please check the attached GIF screenshot for more details:
Best regards,
Hi @sachinsoni441,
Does the Team column (Team Member) column a LookUp column in your Alternate Resource entity?
Could you please share more details about the error message with your Patch formula?
Based on the formula that you provided, I think there is something wrong with it.
Actually, within Dynamics 365, the LookUp column search the corresponding value via a unique Parimary GUID string (e.g. '') of the target Entity. On your side, the Team column in your Alternate Resource search the corresponding value via a unique Primary GUID string in your Bookable Resource Entity.
I have made a test on my side, please take a try with the following workaround:
Firstly, please turn off/disable the "Use column display name" option and "Use GUID data type instead of strings" option within Advanced settings of Apps settings of your app.
Set the Items property of the Combo Box control within the Team Data card (LookUp column) to following:
Choices([@'Alternate Resource'].new_Team)
Set the OnSelect property of the "Patch" button to following formula:
Patch(
'Alternate Resource',
Defaults('Alternate Resource'),
{
new_name: DataCardValue15.Text,
_new_team_value: DataCardValue18.Selected.new_bookableresourceid /* <-- DataCardValue18 represents the Combo Box control within the Team Data card */
}
)
On your side, you should type:
Patch( AlternateResource, Defaults(AlternateResource), { prefix_task_type: Value(DataCardValue1.Text), prefix_task_head: Value(DataCardValue5.Text), prefix_team_value: TeamComboBox.Selected.prefix_bookableresourceid /* <-- The TeamComboBox represents the Combo Box within the Team Data card in your Edit form */ } )
The user @Digit89 and @Kipetcoff have faced similar issue with you, please check my response within the following thread:
https://powerusers.microsoft.com/t5/Creating-Apps/Dynamics-365-Look-up-field-update/td-p/198429
Best regards,
Hello @v-xida-msft,
Actually I am very confused with Lookup Approch. so for testing purpose i create two new entity
First Entity Name: Demo1
Second Entity Name: Demo2
Demo1 has a column name Employee type of Single line of Text
Demo2 has a column name MyEmployee which is type of Lookup column of Employee Field (Demo1)
Demo1 Entity:
Demo2 Entity:
I already turn off the "Use column display name" option and "Use GUID data type instead of strings".
So i want to create new record in Demo2 Entity, to store My Employee (from Emoployee Column of Demo1 Entity). for this i create one edit form on screen, and add one combo box control in edit form, Please check ComboBox Item Property (I am not sure it is right or not), after that i creates one button, which is use to perform patch functionality.
ComboBox Functionality:
Patch Functionality:
Error: The function 'Patch' has some invalid Arguments.
Due to this small dilemma, I have spoiled my whole day, please help to resolve this issue.
Hi @sachinsoni441,
Could you please share a bit more about the error message with your Patch formula? Does it say that the 'new_myemployee' column not exist within your Demo2 data source?
Based on the formula that you mentioned, I think there is something wrong with it. Please take a try to modify your formula as below:
Patch( Demo2, Defaults(Demo2), { _new_myemployee_value: ComboBox1.Selected.new_employee /* <-- Type _new_myemployee_value rather than 'new_myemployee' */ } )
You could find the corresponding LookUp column name via using property select operator (.) after the Demo2 data source. Please take a try with the following formula within your app:
Demo2.
then all available columns/properties would be shown up after it, you could find the LookUp column name/property.
Please check the attached GIF screenshot for more details:
Best regards,
Hello @v-xida-msft ,
Working perfectly, Thanks
Can I set default user in Combo Box Control, Which may be came from another Drop down.
User | Count |
---|---|
137 | |
130 | |
77 | |
72 | |
69 |
User | Count |
---|---|
222 | |
136 | |
78 | |
59 | |
53 |