cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tahir2944
Regular Visitor

Formula not working for me

Hi,

 

Problem Statement: In a SharePoint list, I am customzing a form. I want certain validations for onSave event. Like whenever a user clicks on save button, if a toggle is checked, attachments will be mandatory for him to upload.   

 

I tried executing the following formula on onSave event of powerapps:

 

If(_checkedToggleCount> 0 && IsEmpty(DataCardValue69.Attachments),  Set(warningText, "Attachments Missing"), _checkedToggleCount= 0, SubmitForm(SharePointForm1) )

If a user clicks on save without uploading an attachment, a label is updated with the correct text.( first part of the formula),

But then if user tries to upload attachment and save the item still the item is not saved. 

 

I have just started with powerapps formuals, any idea where I could be going wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi,

 

Could you please explain a bit for the parameter used in your formula?

If(_checkedToggleCount> 0 && IsEmpty(DataCardValue69.Attachments),  Set(warningText, "Attachments Missing"), _checkedToggleCount= 0, SubmitForm(SharePointForm1) )

Specially for _checkedToggleCount, and the DataCardValue69.Attachments?

By the way, what is the meaning of "

_checkedToggleCount= 0

"?

I don't think it will work if you want to set the value to 0 for _checkedToggleCount.

The value should be updated by UpdateContext() or the set() function.

 

I suspect the issue here should be mostly related to the _checkedToggleCount.

 

Regards,

Michael

 

Community Support Team _ Michael Shao
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-micsh-msft
Community Support
Community Support

Hi,

 

Could you please explain a bit for the parameter used in your formula?

If(_checkedToggleCount> 0 && IsEmpty(DataCardValue69.Attachments),  Set(warningText, "Attachments Missing"), _checkedToggleCount= 0, SubmitForm(SharePointForm1) )

Specially for _checkedToggleCount, and the DataCardValue69.Attachments?

By the way, what is the meaning of "

_checkedToggleCount= 0

"?

I don't think it will work if you want to set the value to 0 for _checkedToggleCount.

The value should be updated by UpdateContext() or the set() function.

 

I suspect the issue here should be mostly related to the _checkedToggleCount.

 

Regards,

Michael

 

Community Support Team _ Michael Shao
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 Apps News & Annoucements carousel

Power Apps News & Announcements

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

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (2,756)