Forum Discussion
childishbambino
May 31, 2023Copper Contributor
how to use powershells sharepoint PnP module change columns conditional formulas?
In sharepoinm, I have a custom formula for a column , called column A, that looks like this: =if[$myColumnB],'true','false') I need to do this 200 times, with different columns, how do I use ...
ganeshsanap
Jun 01, 2023MVP
childishbambino You can use PnP PowerShell code like below to apply conditional formula to list fields:
$conditionalFormula = "=if[{0}],'true','false')" -f '$myColumnB'
# Get SP list field
$field = Get-PnPField -List "Tasks" -Identity "ColumnA"
# Apply conditional formula to column
$field.ClientValidationFormula = $conditionalFormula
$field.Update()
Invoke-PnPQuery
Where ColumnA is the internal name of your SharePoint column. You can get the internal name of column using various methods shown in this article: How to find the Internal name of columns in SharePoint Online?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
dperez13
Jun 01, 2023Copper Contributor
does columnB need to be internal or external?
- ganeshsanapJun 01, 2023MVP
dperez13 ColumnB is the internal name of your SharePoint list column from same SharePoint list where you are updating the column and conditional formula.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.