I have a SharePoint list called Master Documents Register.
Inside another list, I created a lookup column named Parent Document that points to this Master Documents Register list.
What I need
When editing or adding a new item, the Parent Document dropdown should show only Parent documents, not Child documents.
Document Code formats:
Parent document format:
[Department]-[Type]-[Sequential Number]
Example: CS-PRO-045
Child document format:
[Parent Number]-[Child Sequential#]
Example: CS-PRO-045-001
The key difference is that parent codes have exactly 2 hyphens (“-”) while child codes have 3.
What I Tried
I attempted to use JSON column/field formatting like this:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"color": "=if(length(split(@currentField,'-')) == 4,'green','red')"
},
"children": [
{ "elmType": "span", "txtContent": "@currentField" }
]
}
and conditional formulas such as:
=if(length(split([$ParentDocument], "-")) == 4, true, false)
But this only changes how the value is displayed after selection—it does not filter the lookup dropdown.