Power Apps Dynamic Form - SharePoint List Content Types

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Thank you very much. I have a requirement to build a similar app, this will be useful in my approach.

I did also subscribe to your channel

👍︎︎ 3 👤︎︎ u/jm420a 📅︎︎ Apr 06 2021 🗫︎ replies
Captions
sharepoint list with multiple content type and you want dynamic form using powerapps then you are at the right place because in this video i'm going to show you how you can create a dynamic powerapps form for the sharepoint list that is using multiple content type so stay tuned [Music] hello and welcome i'm deepak srivastav and welcome to my channel also don't forget to subscribe and click on the notification icon so as we know in sharepoint we can create a list that can use multiple content type and this works perfectly fine in sharepoint but if you try to use that list that is using multiple content type as a data source in power apps there are some challenges that we face uh and the challenge is like if someone tried to create a new item for that list the power app as of now it doesn't tell you that what all columns belongs to which content type so for the end user it is always difficult to provide information because if they select one particular content type they don't know what column they need to provide information for so let me show you the use case what we're going to use today okay so i have created this list called issue tracker in the sharepoint okay this list is using three content type enhancement issues and feedback so as an end user i can submit an issue i can submit a request for enhancements or i can also provide feedback but all of this information is getting stored into the single list and as you can see here this list has three content type associated with it now you i'm using this list as a data source for this powerapp as you can see here so these are my issue i can select feedback i can see all the feedback and if i click on enhancement i can see all the enhancement requests now if i click on new item so i'm opening the new form where user can submit an issue but now as you can see here it is only showing me the column those are required for an issue if i change the content type to feedback the form is automatically going to change and now it's going to show me only the column required for feedback if i go to the enhancement as you can see now i'm seeing only the columns required for the enhancement request okay so start with let's create a blank canvas app okay so my app is created so now what we're going to do we're going to connect to the sharepoint as a data source so i connected to the data source and i'm going to pick my issue tracker list click connect okay so my data source is connected now what next what i'm going to do i'm going to go to my app the screen one that is the home screen and i'm going to add a gallery that will just display all the items that i have so my gallery is showing all the items from that uh that issue tracker list so what i'm gonna do i'm gonna add a icon here just add icon and then i'm going to add another screen that will be screen for my form and on this screen what i'm going to do i'm going to drop a form a power form right so this is my form connect to data i'm going to pick the data source as issue tracker okay so as you can see here it is showing some of the column not all the column but some of the column from that list let me go back to the home screen on click off this plus icon what i'm going to do i'm going to reset the form that we have just just added to the second screen and we're going to create a new item so reset form the name of the form is form one and the new form again name of the form one okay and then after that we will navigate to the form screen so let me play it click and as you can see here this is my new form it is showing some of the column now let's see what happened if we don't make any changes so number one thing if you go to the form and if you go to the fields edit fields click on add fields now as you can see here you are seeing all those different fields irrespective of the content type and i will show you in a while so let me add all these different fields on the form first so as you can see here what i'm seeing i'm seeing title assigned to all these different fields if i go back to my sharepoint list and if i go to the list settings you can see all those different column here but not all these columns belongs to all the content type like for example issue have some of these columns associated enhancement has two or three of them similarly feedback right but in powerapp you don't know for example if i play this one if i click on the content type i am getting all those different content type but if i select them nothing gonna happen and that's what we want to change we want to make sure if user selecting an issue only the issue related column should be displaying here okay so let me make a little bit change on the ui so what i'm going to do i'm going to edit the fields we're going to move content type on the top right so we can select and and i'm going to make this form as one column right so now we have a form that is one column we have the first column is the content type we don't know in powerapp which column belongs to which content type so i have two options or two solutions for you guys the first one is very simple the second one is also very simple but not as simple as the first one okay so uh the first option so what i did in my sharepoint i created a list called ct master or you can call it content type master and this list has two columns the title and the columns title is the name of the content type and the columns is the number of column this contentize belongs to yes this is the manual list so for an example if i'm adding a content type to my list i can come here at that content type name and all the columns that contentize belongs to so for an example the issue content type has these many columns feedback has these many columns enhancement has these many columns right so this is my master list for the content type and if i go back to my app and what i'm going to do i'm going to connect so this time what we're going to select we're going to select the ct master okay so now we have our container master data source connected right now the only thing we need to do we need to write some logic so we can show hide these feeds and now we are going to use a formula that will tell us whether the given column belongs to the selected content type or not based on the information that we are getting from that ct master list okay so the formula is very straightforward what we are trying to do in this formula i'll go from the center so first thing that we are saying look up ct master list where title equal to data card 13 dot selected dot name and data card 13 is the content type data card so if this is selected issue then we are filtering the ct master for the issue if this is enhancement we are filtering for enhancement if i go back to the actual sharepoint list as you can see here if this is issue it's going to give me this one row issues and all these columns if the selected is feedback then it will give me these three columns okay so we are getting this dot columns this part will give me all the columns if self dot display name self.display name for the card will give me the name of the column that this card belongs to so in this case it's saying issue status right so this condition is saying if the name of the column that is issue status in our this query so that's query is going to give me this information and as you can see here it is there so you can see the issue status belongs here right so the condition is true so that's the only formula so now because that formula is very dynamic the only thing you need to do you need to select each and every card and apply the same formula there so what i'm going to do i'm going to select all of them but content type because we don't want content type to be hidden go to the visual property and paste that formula and that's all what i need to do now if i play the form now you can see the issue is showing me only the column those are related to the issue if i change to feedback here you go now you are seeing only those three columns those belongs to feedback if i go to enhancement as you can see here okay option number two now as i said option number two is simple but not as simple as this one so if we want to automate this process of getting all the columns belongs to a given content type we need to create a flow okay and what that flow will do that flow will use a course sharepoint rest api and query all the columns and the content type and send that information back to our powerapp and then we can use our logic to show and hide these uh these fields okay so so to call the flow what i'm gonna do i'm gonna click a button or add a button here and in the action i'm going to use the power automate click there i have already created that flow so i'm gonna walk you through so let me log into the flow and i'll show you okay so this is the flow that going to help us finding all the content type all the columns for that list okay so as you can see here this is a flow that is getting called from powerapps first thing that we need to make it fully dynamic is the name of the list so what i'm doing here i have created one uh compose action here calling list name and then i'm trying to ask powerapp for that information and how you can do it i'm going to show you so if i click on add an action and if i go compose in here you just need to say ask in powerapps and as soon as you click that it will create something like this so remember whatever name you gave to your compose action will become the name of the variable that you will see in powerapps so before clicking on powerapps change the name maybe you can just type here something like okay change the name and then click on ask in powerapps okay so it will be something like this then i have created two variables column set and columns both are strings column set is actually the final output that we are going to send back to the powerapps the second variable is columns this is just to store columns for a given content type okay just two variables then we have two very important sharepoint actions here both are using send http request to sharepoint action and the http request that we are calling is the list get by title and as you can see here saying output this is the output of our list name variable as you can read here the second again same uh send sutp request to sharepoint but in this case we are using the different api what we are using list get by title but content types so you can see at the end it's saying content types so this api or this url will give me all the content type associated with this list okay okay very simple and before i explain the later part of this flow let me show you uh the previously run flow because i need to show you the output of one of the action so you can understand so uh get list id or getting the list information this api will give me all the information like this and if you scroll down it has column called id and that's what we need and we want to use this one right so this is our response for our first action the second action this is getting all the content type is looks like this so d results and then it has all these different content type information as you can see here correct so i just wanted to show you that the information that is coming from these two actions is something like the d dot results and then we have all these different content type now i go back and edit this and i'll show you the next action so the next action that we're going to use we're going to use and apply to each and we are going loop through each content type that we are getting in this previous action as you can see here body dot d dot results very simple this is our action result body of get list ct and then the next part is d and results as i showed you previously that's how we are getting the response okay the next one rest call that we have to make because we got the content type now we need to make another rest api call to get all the columns those are belongs to this content type and this is where we're going to pass the list id this is the list id that we are getting from our first action and i'm going to show you how this looks like so output of our get list id that is our this action again body d and then id column so this is the expression to get the id okay and then the second very simple we're gonna get the id of the content type for which we are uh running this loop for and the expression for this one is gonna look like this current item string id and this is the column name this is the column name that is giving me the id okay and this is very standard so you can use it as it is without making any changes and once you make this get columns api call it will give you all the columns belongs to the given content type okay now before we move forward we are setting up the columns variable that we have declared on the top to null so we are re-initiating it and then what we are doing as you can see are going through each column now this looks very similar the only thing has changed now we are looping through each column that we are receiving in this action get column so if i show you this expression again it's saying body of get columns that is our action body d results is going to give us all the columns okay and then for each column what we are doing in this column variable we are appending the title and the title is going to be the name of the column that we're going to receive from that api okay so that's all we're going to do to get all the columns for that given content type and once this column loop complete for a given content type we are going to append to our column set variable so for column set variable we are appending this information and this i need to show you so this is what we are doing we are doing concat this is the name of the content type in the current loop colon and all the name of these columns okay so this is the expression that we are setting up and then this is just going to complete each content type loop after that we are just converting the column set to the string and sending that string back to the powerapps so now we understand the flow let me go back to the powerapp this was the flow that i was talking i'm going to add this to my powerapp and now if you remember it is asking me the list name input that was the variable that we have defined to get the list name in powerapp there is something called data source info right i'm going to select the issue tracker and data source display name okay so so this data source info name of the data source and display name is going to give me the name of the data source and that's actually my list name now if you remember our flow is returning as in string so what i'm going to do i'm going to set our variable and i'm going to store the response that my flow is providing into this variable is ct okay now i can copy this entire expression or formula and i'll go to my app on start paste it there so on app on start i'm going to call this flow and get all this information so if i go to my form screen let me just show you what i'm getting i'm going to insert a label here just to see the response that i'm getting from my flow and i'm going to say you can see right so i'm getting all the content type and the columns from my flow but still it's not in that perfect format that we need so on app on start what i'm going to do i'm going to make a function called split and we will split this response that we are getting from the power automate dot we need to just use the column now this will give us a collection okay and let me show that so let me remove this label from here and insert a gallery just to show you how we are getting the response okay so you can see this right so this is the name of the content type and these are the columns feedback and enhancement the next what we need to do we need to just update our formula okay so this is the updated formula and i'm going to just show you uh side by side so self.display name that has not changed the only thing that has changed is this lookup function right so previously if you look at our previous from formula we were looking at that master list that we have created but now what we are doing we are going into that collection that we are getting from the flow and this doesn't change we are still trying to find the the selected content type from the form but what we are doing we are trying to find that in the result and result is nothing but this table like if you see it if you see this response that we are getting and the column in which they are getting the information is result so we are saying look up in this list where the selected name the content type name in result and why we are doing so because if you look this one this is how we are sending from the power automate we are not really sending in two separate column we're just sending in one one column as a string so it's going to look for this issue in these different string and wherever it find it will give you that uh that item so this will give us the first item because this is where we would find the issue and then we're going to try to find if the column name for example this time we are trying to assign to exist in that result so if i select this one as you can see here this is giving me all this information now again this is also a dynamic expression so what we are going to do we are going to again do the same thing select all these r and then just set the visual property now if i run the app again and if i click on the plus icon and if i select let's say feedback enhancement or issue okay so yeah so that's it um go ahead and give a try if you have any such requirement thank you very much thanks for giving your time and also last but not the least subscribe and keep watching thank you
Info
Channel: Deepak Shrivastava
Views: 2,765
Rating: 5 out of 5
Keywords: powerapps sharepoint list, customize sharepoint form with powerapps, power apps and content type, powerapps sharepoint list form, custom sharepoint form, microsoft powerapps, powerapps forms sharepoint, office 365 powerapps, powerapps tutorial sharepoint, powerapps tutorial, microsoft sharepoint, how to, powerapps for beginners, tutorial, sharepoint custom list, customize sharepoint list forms with powerapps, sharepoint content type, sharepoint list content type, power apps
Id: tcwoCUcmNqo
Channel Id: undefined
Length: 21min 46sec (1306 seconds)
Published: Tue Apr 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.