web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / This rule create a cir...
Power Apps
Answered

This rule create a circular reference - Gallery-Selected-ID

(0) ShareShare
ReportReport
Posted on by

Hi

 

I have something complicated. Hope my explanation is clear

 

So I have three forms, External User Form, Firewall Access Form, VPN Access Form.

So what I have done is if a user want three access , he can submit only one form which will create the other access too. So a user might request only for External    OR   External/VPN     OR    External/VPN/Firewall etc. 

 

After access if he open the External Access VIEW form. if he have requested for others he can see in the gallery created inside the form the respective details of the other form too.

 

So in addition to gallery created to view/edit in these three forms, inside the form there is gallery referring to other forms. Hope my explanation is clear so far. 

 

So there is two more galleries referring to the same form, so I use a filter to get the correct record in view form mode, 

 

Example

So below is my External Form and The Gallery details. So I use the filter for VPN Gallery as below

indhaa_2-1622315170012.png

If(varVPNExtGallery,Filter(VPNAccess, ExtFormID = VPNExtGallery.Selected.ID),Filter(VPNAccess,ExtFormID = ExternalGallery.Selected.ID))

indhaa_1-1622314864180.png

 

So below is my VPN form and External Gallery details.

 

indhaa_3-1622315299144.png

When I try to filter it is saying circular reference error. How can I filter selected item without creating a circular reference

indhaa_4-1622315639385.png

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    HI @indhaa ,

    Firstly, the below is a shorter way of doing it, but your code should not create a Circular Reference on its own - there must be another piece of code conflicting with it. How do you create varVPNExternalGallery?

    With(
     {
     wID:
     If(
     varVPNExtGallery,
     VPNExtGallery.Selected.ID,
     ExternalGallery.Selected.ID
     )
     },
     Filter(
     VPNAccess, 
     ExtFormID = wID
     )
    )

    Also, there is probably a better way of doing this - on the OnSelect of each gallery, put

    Set(gblID,ThisItem.ID)

    then the Item of your Form would be

    Filter(
     VPNAccess, 
     ExtFormID = gblID
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • indhaa Profile Picture
    on at

    So I think it is creating circular reference because of this. I think due to this it is still creating havoc in the form.

     

    So External Form item property is set like this

     

    indhaa_1-1622404652757.png

    The On Select of the Gallery inside External Form is set like below

     indhaa_0-1622404573676.png

     

    VPN Form Item property is set like this 

    indhaa_2-1622404812490.png

    And On Select property of the Gallery on VPN form like below

    indhaa_3-1622404893981.png

     

    or maybe because it is referring to it's own record from the gallery. Still not working correctly

     

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @indhaa ,

    Did you attempt the code I sent where you are setting the required ID and then doing a LookUp - I use this successfully on a number of forms where I navigate to them from different places. I still cannot see anything in your code supplied that would create a Circular Reference.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • indhaa Profile Picture
    on at

    hi

     

    Hope you are online now

    I have updated my code as you have requested and it is not prompting that circular reference error but I still think due to this reference it is creating a havoc in my form. Now from the form gallery it is not filtering the forms related to it and the form also not showing data when I click on it sometimes. 

    Filter(
    VPNAccess,
    ExtFormID = galID
    )

    I think it is creating circular reference because I'm going to same the form when I click the record in the form gallery and when it open the form it is referring to its own record some how. or maybe due to variable I created it is creating the reference. Can you check my form item property code is ok



     

  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @indhaa ,

    Are you setting galID to ThisItem.ID on the OnSelect of your galleries?

    Set(galID,ThisItem.ID)
    

    Then your Form Item would be

    LookUp(
     VPNAccess,
     ID = galID
    )

    A couple of questions I should have asked - what is your data source (I have assumed SharePoint).
    What is ExtFormID ?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • indhaa Profile Picture
    on at

    So I will do that and let you know. Now kind of busy with another project, so might be late with my response.

     

    yes it is SharePoint list. So I said it is three SP List and each form will have respective ID of the other form so I will know to compare the related form. Hope u get what I'm trying to do. Don't know if it is the correct way to do it,

    External SP List   ID, VPNFormID, FirewallFormID

    VPN SP List         ID, ExtFormID, FirewallFormID

    Firewall SP List    ID, VPNFormID, ExtFormID

     

     

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @indhaa ,

    If this is SharePoint, forget all your other Variables and simply set one to the ID of the item selected in the gallery, then use the code I supplied for the form Item - I do this in a lot of my apps.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • indhaa Profile Picture
    on at

    Hi,

     

    So I updated my Form Item property (Not Gallery Item property) as below and I'm getting the below error for it. 

    indhaa_0-1622557350824.png

    indhaa_1-1622557461783.png

     

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @indhaa ,

    Your Form Item should be LookUp, not Filter.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • indhaa Profile Picture
    on at

    it working now

     

    Thanks alot. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard