cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sgokul95
Frequent Visitor

Access the controls of the newly created record in the Gallery

Hi Everyone, 

 

I have a Gallery which contains a CheckBox, TextInput(holds Name) and DropDown(holds the Status) in each of its rows.

 

Also I have a button called "New" in my App which when pressed will create a new record in the Gallery with default empty values using below code:

(ccProjects is a collection created in the App using a SharePoint list and is set as the DataSource for the Gallery)

Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""}
    }
)

 

I need to get this record from the Gallery and mark its checkbox as checked when the New button is clicked. Can anyone please help me out here?

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @sgokul95 ,

 

Since you are wanting to change the check box value inside the Gallery with the button outside, please consider using AddColumns function to add a new column when creating the collection.

ClearCollect(ccProjects, AddColumns(...., "Check", false))

 

OnSelect of the create button:

Set(varNEW, Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""},
        Check: true
    }
  )
)

This variable is exact the new created record.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
Nogueira1306
Community Champion
Community Champion

Hey! When you click a button, set a var

Set(varCheckBox; true)

In the Checkbox, set the default to be the varCheckBox

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

Hi @Nogueira1306 ,

 

Thanks for your quick reply.

 

The New button is not present in each row of the Gallery. It is present outside the Gallery. 

So when I created and set the varCheckBox in the "New" button in my App and then set the varCheckBox to the Default property of the CheckBox, the CheckBox in each of the row becomes "Checked" instead of the particular new record that I had created. 

 

 

Ok.. Try to check your data source to check if it is already created.

Something like this:

 

If(CountRows(Filter('DataSource', ID = ThisItem.ID)) >= 1, true, false)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

v-jefferni
Community Support
Community Support

Hi @sgokul95 ,

 

Since you are wanting to change the check box value inside the Gallery with the button outside, please consider using AddColumns function to add a new column when creating the collection.

ClearCollect(ccProjects, AddColumns(...., "Check", false))

 

OnSelect of the create button:

Set(varNEW, Patch(ccProjects, Defaults(ccProjects),
    {
        'Name (Title)': "",
        Status: {Value: ""},
        Check: true
    }
  )
)

This variable is exact the new created record.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,123)