Use: I needed a power automation to create a new column after a certain date and the update the sharepoint item in the new column with values from two other columns.
IE: Our testing closes May 10 and I need to record the users that registered for current years test so we could see it next year. The column that stores the current data is called "CurrentSchoolYR" so we can continue to use it in the future.
The archive column that will be created when the school year ends will be called assignments2026.
Once May 10th rolls around, the new column will be automatically created, then the CurrentSchoolYR data will written to the newly created column with the data in the test type column and then the CurrentSchoolYR will be cleared out.
The whole flow:
1. Add the trigger you want to fire this off. For demo purposes, I used Manually Trigger, but you can want you want.
2. Add the "Get Items" and add your SharePoint List and SharePoint Site address.
***This step is so you can grab the data you need to archive in the newly created column later.
3. The compose step for the name of my new column
***This step is so your newly created column will be dynamic so you can add it to later steps
The date expression: formatDateTime(utcNow(), 'yyyy')
4. Send an HTTP request to SharePoint
The text/code stuff up there:
Site address: Your SharePoint Site's URL
Method: POST
URI: _api/web/lists/GetByTitle('YOURSHAREPOINTLIST')/fields/CreateFieldAsXml
Headers:
Accept: application/json;odata=verbose
Content-Type: application/json;odata=verbose
Body:
{"parameters":{"SchemaXml":"<Field DisplayName='@{outputs('Compose-_column_name_with_year')}' Name='@{outputs('Compose-_column_name_with_year')}' Type='Text' />"}}
5. I added a "Delay" actions which is optional.
6. Now the tricky part, update the column that was just created with data from other field from the Sharepoint List.
***Note: this step will only work for Modern “NoScript / locked down” sites. If you run into and error try a MERGE headers scroll to the bottom of this post for example.
The text/code stuff up there:
Site address: Your SharePoint Site's URL
Method: POST
URI: _api/web/lists/GetByTitle('SchoolOpsTestList')/items(@{items('Apply_to_each')?['ID']})/ValidateUpdateListItem
Looks Like:
Headers:
Accept: application/json;odata=nometadata
Content-Type: application/json;odata=nometadata
Body:
{
"formValues": [
{ "FieldName": "@{outputs('Compose-_column_name_with_year')}", "FieldValue": "@{items('Apply_to_each')?['DeletethisRow']}-@{items('Apply_to_each')?['DeleteThisColumn2']}" }
],
"bNewDocumentUpdate": false
}
Looks Like:
Try it out!![]()
Code Snippets
POST
_api/web/lists/GetByTitle('YourList')/items(<ID>)/ValidateUpdateListItem
Json Body
{
"formValues": [
{ "FieldName": "InternalColumnName", "FieldValue": "Your value" }
],
"bNewDocumentUpdate": false
}
Example if you need "Update item" for Classic SharePoint.
Method: POST
URI: _api/web/lists/GetByTitle('YOURLIST')/items(@{item()?['ID']})
Headers-
Accept: application/json;odata=nometadata
Content-Type: application/json;odata=nometadata
IF-MATCH: *
X-HTTP-Method: MERGE
Body:
{"NewlyCreatedColumn":"some value"}