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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,568)