Forum Discussion
Dynamic Mandatory Fields
In a SharePoint library,
I have folders which are =
a. Admin
b. Events
c. Furniture and Moves
d. Janitorial and Maintenance
e. Parking and Transportation
f. Shipping and Receiving
g. Supplies and Equipment
h. Waste and Recycling
I have Meta data across the library whose data type are all choices and are:
a. Document Type = Contract, Financial, planning
b. Building = Gym, Garage, Heating
c. Asset Category = Office, Playground
d. Fiscal Year = FY23, FY24, FY25, FY26, FY27
e. Vendor = Maple Leaf, Canadian Tire, Home Depot
f. Status = Active, Pending, Not Active
g. Retention Label = 3 years, 5 years
h. Service Type = Admin, Events, Furniture and Moves, Janitorial and Maintenance, Parking and Transportation, Shipping and Receiving, Supplies and Equipment, Waste and Recycling
Service Type and Retention Label are mandatory fields, with the Rule below for all the files in the various folders:
IF Folder Name = Admin, then Service Type = Admin and Retention Label = 5 years; the mandatory fields should be Document Type, Status and Fiscal Year
IF Folder Name = Events, then Service Type = Events and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Fiscal Year, Building and Vendor
IF Folder Name = Furniture and Moves, then Service Type = Furniture and Moves and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Building
IF Folder Name = Janitorial and Maintenance, then Service Type = Janitorial and Maintenance and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Fiscal Year
IF Folder Name = Parking and Transportation, then Service Type = Parking and Transportation and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Fiscal Year
IF Folder Name = Shipping and Receiving, then Service Type = Shipping and Receiving and Retention Label = 3 years; the mandatory fields should be Document Type, Status
IF Folder Name = Supplies and Equipment, then Service Type = Supplies and Equipment and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Fiscal Year
IF Folder Name = Waste and Recycling, then Service Type = Waste and Recycling and Retention Label = 3 years; the mandatory fields should be Document Type, Status and Vendor
I have used Column Default Value Settings for SharePoint to display Auto-Display the Service Type and Retention Label, but I cannot seem to perform the conditional mandatory fields using Validations setting for the other requirements. Please help
1 Reply
You’re using folder defaults correctly for Service Type and Retention Label, but the remaining metadata must be enforced according to Service Type. SharePoint’s Required setting is static; library validation can block a save conditionally, but it will not add or remove the Required indicator. First, make Service Type, Retention Label, Document Type, and Status required, because every rule needs them. Set Fiscal Year, Building, and Vendor defaults to None. Then open Library settings > Validation settings and add:
=AND(IF(OR([Service Type]="Admin",[Service Type]="Events",[Service Type]="Janitorial and Maintenance",[Service Type]="Parking and Transportation",[Service Type]="Supplies and Equipment"),NOT(ISBLANK([Fiscal Year])),TRUE),IF(OR([Service Type]="Events",[Service Type]="Furniture and Moves"),NOT(ISBLANK([Building])),TRUE),IF(OR([Service Type]="Events",[Service Type]="Waste and Recycling"),NOT(ISBLANK([Vendor])),TRUE))
Add a message naming the conditional fields, then test one upload in every folder. Keep referenced Choice columns single-select. If users need visibly different required fields, create service-specific content types and set each column Required or Optional there. Users would need to choose the matching content type.