3

I have a list with a choice column called Status with possible values: New, Pending, Complete. I would like to be able to ensure that whenever the Status column is set to Complete, that an attachment has been added to the list item.

The problem I'm having is that attachment is not really a column so I don't think I can do the usual list validation.

I have also seen similar a question but with an older version of SharePoint. I am using SharePoint Online and not sure if I can add a custom script like that.

I considered Power Automate for a moment, but I don't know how I could set up a flow that would reject entries.

1 Answer 1

2

For SharePoint online, you cannot add custom JavaScript to modern list forms. You have to customize the list forms using Power Apps for this requirements.

You can achieve this using different ways in Power Apps:

  1. You can check if status value is "Complete" and any file is attached to attachments control on click of submit button (similar to shown in #3 below)

    Reference: PowerApps attachment control how to check if any attachments have been made

  2. Set "Required" property of attachments data card to: ddStatusCardValue.Selected.Value = "Complete"

  3. Set DisplayMode property of submit button to "Disabled" based on similar condition as:

If(
    ddStatusCardValue.Selected.Value = "Complete",
    If(CountRows(YourAttachmentsControl.Attachments) > 0, DisplayMode.Edit, DisplayMode.Disabled),
    DisplayMode.Edit
)

Documentation: Customize a form for a SharePoint list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.