Hello,
I am building a flow the intention of which is to create a Choice column in a SharePoint list on the 1st of each month. The Column should be called YYYYMM relative to the current data, and the default choice should be Not Started. The other choices will be Waiting On Ops, Waiting On Analyst, and Submitted.
I am struggling with the final step - Send an HTTPS Request to SharePoint. I can't see how to list the default choices for the column, and I am getting an error message I can't understand.
Flow as-is:
Error:
Any guidance?
I am new to this level of work (JSON, HTTPS, etc) but eager to learn and apply in many contexts - help much appreciated.
Solved! Go to Solution.
Hi @TomTomTom,
I think you are missing a couple of things. First of all you are using the verbose headers. So, that would require you to specify metadata in the body of the request.
Secondly, I would add a couple of additional properties to your choice field. I have added properties like StaticName and Choices.
Below is an example of a new request which should work. Can you try that instead?
{
"__metadata": {
"type": "SP.FieldChoice"
},
"FieldTypeKind": 6,
"Title": "@{variables('YYYYMM.Str')}",
"Required": "false",
"EnforceUniqueValues": "false",
"StaticName": "@{variables('YYYYMM.Str')}",
"Choices": { 'results': ['Not Started', 'Waiting On Ops', 'Waiting On Analyst', 'Submitted.'] },
"DefaultValue": "Not Started"
}
Hi @TomTomTom,
I think you are missing a couple of things. First of all you are using the verbose headers. So, that would require you to specify metadata in the body of the request.
Secondly, I would add a couple of additional properties to your choice field. I have added properties like StaticName and Choices.
Below is an example of a new request which should work. Can you try that instead?
{
"__metadata": {
"type": "SP.FieldChoice"
},
"FieldTypeKind": 6,
"Title": "@{variables('YYYYMM.Str')}",
"Required": "false",
"EnforceUniqueValues": "false",
"StaticName": "@{variables('YYYYMM.Str')}",
"Choices": { 'results': ['Not Started', 'Waiting On Ops', 'Waiting On Analyst', 'Submitted.'] },
"DefaultValue": "Not Started"
}
That's excellent! Thank you.
I think I must have misunderstood the meaning of DefaultValue though as the values are blank in each item. I was expecting them to use DefaultValue instead.
I am wondering if I can't do that in this step, and need to Get Items / Update Items instead for this final step.
Hi @TomTomTom,
DefaultValue means that whenever you create a new item a choice is already selected in that field for the user. Which makes the data entry experience a bit user friendlier.
However, the user can still select a different choice when creating the item. This column setting only affects new items, existing items won't be updated.
If you want to update the data of existing items you might want to have a look at the different REST API Method. Do you need an example for that?
An example would be great, if you have one!
Hi @TomTomTom,
Yes, no problem.
Below is an example how you can update the selected value of a choice field of an existing list item with the validateUpdateListItem method, in this case item with ID 1.
Normally you could do these kind of updates also with a Update Item action. However, since you are storing the column name in a variable I thought a Send an HTTP action is a bit more flexible and useful in your setup 😁
Ah this is so close!
I have combined it with Get Items to apply your work to both.
But I get an error that the Column is not found ...
(YYYYMM is wrong, but this is just because I have created a lot of test columns.)
I am wondering if the best solution is just two flows say six hours apart? The first flow provisions the column; it is ready (after the delay) to be filled.
But I would be curious to know if I am missing something in this flow ...
Hi Expiscornovus
User | Count |
---|---|
99 | |
39 | |
27 | |
23 | |
16 |
User | Count |
---|---|
130 | |
52 | |
48 | |
36 | |
24 |