cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
negodfre
New Member

How to get fields to refresh based on 'default type' of 'Content Type'?

I created a PowerApp using a SharePoint list.

It has three screens the "BrowseScreen", "DetailScreen", & "EditScreen".

 

Depending on the "Content Type", different columns are associated with different "Content Types".

I have it setup so that the user selects the 'Content Type' on the "BrowserScreen". It filters the list there to only show records of that content type.

 

Then, when the user wishes to add a record by clicking the "+" symbol the selected "Content Type" gets passed to the "Edit Form".

 

When the variable identifying the 'Content Type' get's passed to the "Edit Form", it's used to set the default value of the dropdown. This value then changes the visibility of other fields based on whether they are in that 'Content Type'.

 

However, when I use the default value, the dropdown shows the correct value, but the fields don't appear to call their function within the 'Visible' property. 

If I go to the dropdown and select the option, all the fields 'Visible' property code runs and shows the correct fields.

 

Is there a way to resolve this issue?

 

I am setting the 'Content Type' dropdown using the following:

{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedContentType",
Id: Variable1,
Value: Variable2
}

 

Variable 1 & 2 are passed when the user hit's the default "+" icon to add a row.

These are also set based on the dropdown in the first screen.

 

Fields that are not associated with the selected 'Content Type' are filtered like so within the 'Visible' option:


If(Self.DisplayName in LookUp('SharePoint List', Title=DataCardValue.Selected.Name).Columns, true, false)

2 ACCEPTED SOLUTIONS

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @negodfre 

 

Set the Default property of the dropdown to

 

 

ContentTypeSelection.Selected.Name

 

 

In this example, I have a dropdown in the Browse screen called "ContentTypeSelection". And items property to

 

Choices([@SPListName].'{ContentType}')

 

StalinPonnusamy_1-1668143456573.png

 

In the Edit Screen, Set the Items property to

Same as Browse Screen

 

And set the default property like below as simple Text

StalinPonnusamy_0-1668143220805.png

 

I tested, and it works.


Thanks, Stalin (Microsoft MVP)
Blog - Learn To Illuminate Blog
YouTube - Learn To Illuminate Videos

View solution in original post

Hi @negodfre 

 

Change to Name like below

StalinPonnusamy_0-1668145238238.png

 


Thanks, Stalin (Microsoft MVP)
Blog - Learn To Illuminate Blog
YouTube - Learn To Illuminate Videos

View solution in original post

4 REPLIES 4
StalinPonnusamy
Super User
Super User

Hi @negodfre 

 

Set the Default property of the dropdown to

 

 

ContentTypeSelection.Selected.Name

 

 

In this example, I have a dropdown in the Browse screen called "ContentTypeSelection". And items property to

 

Choices([@SPListName].'{ContentType}')

 

StalinPonnusamy_1-1668143456573.png

 

In the Edit Screen, Set the Items property to

Same as Browse Screen

 

And set the default property like below as simple Text

StalinPonnusamy_0-1668143220805.png

 

I tested, and it works.


Thanks, Stalin (Microsoft MVP)
Blog - Learn To Illuminate Blog
YouTube - Learn To Illuminate Videos

negodfre
New Member

When I do that, I get the 'id' of the 'Content Type'. Example '0x00012403123...' instead of "Option 1".


I don't actually get the names.
Is there a way to get the names?

Hi @negodfre 

 

Change to Name like below

StalinPonnusamy_0-1668145238238.png

 


Thanks, Stalin (Microsoft MVP)
Blog - Learn To Illuminate Blog
YouTube - Learn To Illuminate Videos

negodfre
New Member

Thank you! 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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