cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CRM-Kfar-Sava
New Member

CRM lookup Circular reference between properties problem.

I have the following 2 Lookup fields from CRM in PowerApp:

DataCardValue1, DataCardValue2

 

Now I have a filter on DataCardValue2 by the value in DataCardValue1, and I also have default value on DataCardValue1 when DataCardValue2 is selected.

 

This is how I do it:

  • DataCardValue2-> Items -> Filter(subjects, _pws_casesubsubjectid_value = DataCardValue1.Selected.pws_casesubjectid)
  • DataCardValue1-> DefaultSelectedItems ->First(Filter(subjects, pws_casesubjectid = DataCardValue2.Selected._pws_casesubsubjectid_value))

 

The following create the error:

this rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value.

If I remove 1 of the above Items or DefaultSelectedItems everything works fine.

 

There is no real collusion between those 2 conditions and I wonder how can I fix this error.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @CRM-Kfar-Sava,

Based on the formula that you provided, I think you have faced a circular reference issue within your app.

Actually, the populated values within your DataCardValue2 is based on the selected value within your DataCardValue1, however, the DefaultSelectedItems value of your DataCardValue1 is also based on the selected value in your DataCardValue2.

In other words, the DefaultSelectedItems value of your DataCardValue1 is based on the selected value in your DataCardValue1. Currently, within PowerApps, a property could not reference itself or other properties affected by its value.

As an alternative solution, please take a try with the following workaround:

Set the Items property of the DataCardValue2 to following:

Filter(subjects, _pws_casesubsubjectid_value = DataCardValue1.Selected.pws_casesubjectid)

Set the OnChange property of the DataCardValue2 to following:

Set(
SelectedValue,
First(Filter(subjects, pws_casesubjectid = DataCardValue2.Selected._pws_casesubsubjectid_value))
)

Or

Set(
SelectedValue,
LookUp(subjects, pws_casesubjectid = DataCardValue2.Selected._pws_casesubsubjectid_value)
)

 

Set the DefaultSelectedItems property of the DataCardValue1 to following:

SelectedValue

 

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 @CRM-Kfar-Sava,

Based on the formula that you provided, I think you have faced a circular reference issue within your app.

Actually, the populated values within your DataCardValue2 is based on the selected value within your DataCardValue1, however, the DefaultSelectedItems value of your DataCardValue1 is also based on the selected value in your DataCardValue2.

In other words, the DefaultSelectedItems value of your DataCardValue1 is based on the selected value in your DataCardValue1. Currently, within PowerApps, a property could not reference itself or other properties affected by its value.

As an alternative solution, please take a try with the following workaround:

Set the Items property of the DataCardValue2 to following:

Filter(subjects, _pws_casesubsubjectid_value = DataCardValue1.Selected.pws_casesubjectid)

Set the OnChange property of the DataCardValue2 to following:

Set(
SelectedValue,
First(Filter(subjects, pws_casesubjectid = DataCardValue2.Selected._pws_casesubsubjectid_value))
)

Or

Set(
SelectedValue,
LookUp(subjects, pws_casesubjectid = DataCardValue2.Selected._pws_casesubsubjectid_value)
)

 

Set the DefaultSelectedItems property of the DataCardValue1 to following:

SelectedValue

 

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.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,625)