The first uses variables and an array of column names and loops through the creation of the columns: https://www.alanps1.io/power-platform/flow/flow-create-sharepoint-list-text-fields-using-rest-api-wi...
The second provides option on how to do a myriad REST options which I used to tweet the Creation flow above to delete multiple columns:
http://www.ludovicperrichon.com/sharepoint-rest-api-call-with-powerautomate/#removelistfields
This page gives examples on many other useful REST API options too.
This being said, for some reason, neither with the create or update flows work in setting the Default Value on the Yes/No columns. in my array. Here is the information for both:
1. Create Flow:
Headers:
{
"Content-Type": "application/json;odata=verbose",
"Accept": "application/json;odata=verbose"
}
Body:
{
"__metadata": {
"type": "SP.FieldText"
},
"FieldTypeKind": 8,
"Title": "@{items('Apply_to_each_Create_Each_New_Column_String')}",
"Required": "false",
"EnforceUniqueValues": "false",
"DefaultValue": "No",
"StaticName": "@{items('Apply_to_each_Create_Each_New_Column_String')}"
}
2. Update Flow:
Header:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"IF-MATCH": "*",
"X-HTTP-Method": "MERGE"
}
Body:
{
'__metadata': {
'type': 'SP.FieldMultiLineText'
},
'DefaultValue': 'No'
}
Any help would be appreciated.
That worked! The simple and obvious solutions always allude me. 🙂 Thanks for the correction. I wish Microsoft's documentation as clear.
I will have to look into the XML option later as it might come in handy for other things. Looks like simply using "0" instead of "No" was the answer.
For Yes/No field you can set using DefaultValue to "0" (False), Set DefaultValue to "1" (True)
For Default No
{
"__metadata": {
"type": "SP.FieldText"
},
"FieldTypeKind": 8,
"Title": "@{items('Apply_to_each_Create_Each_New_Column_String')}",
"Required": "false",
"EnforceUniqueValues": "false",
"DefaultValue": "0",
"StaticName": "@{items('Apply_to_each_Create_Each_New_Column_String')}"
}
For Default Yes
{
"__metadata": {
"type": "SP.FieldText"
},
"FieldTypeKind": 8,
"Title": "@{items('Apply_to_each_Create_Each_New_Column_String')}",
"Required": "false",
"EnforceUniqueValues": "false",
"DefaultValue": "1",
"StaticName": "@{items('Apply_to_each_Create_Each_New_Column_String')}"
}
Hi @NotThe1stChoice,
Don't know if that DefaultValue is supported in the fields method. I always prefer the CreateFieldAsXml option because it seems to support more properties. In the body of that request you can set the Default value to 0 (aka No).
Try something like below
URI
_api/web/lists/getbytitle('@{variables('ListName')}')/fields/CreateFieldAsXml
Body
{ "parameters":
{"__metadata": {"type":"SP.XmlSchemaFieldCreationInformation"},
"SchemaXml":"<Field DisplayName='YesField' Format='Dropdown' IsModern='TRUE' Name='YesField' Title='YesField' Type='Boolean'><Default>0</Default></Field>",
"Options":12}
}
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1