Closed divewoot closed 9 months ago
@divewoot According to Microsoft Docs:
"With the new setValue and customRowAction properties, formatters can render action buttons which modify the item internally without opening editors or forms."
I'm not sure about what you tried to get, but from my findings, setValue requires a user action to be performed through a click. Therefore, it won't write automatically any data or, in other words, it doesn't work like a calculated column.
I used your piece of code and everything worked fine, BUT I used a button to perform the writing action of a multiperson column elsewhere. Here is visually what I did:
And if you check with edit in grid view to see what actually there is behind, here is the result:
@divewoot According to Microsoft Docs:
"With the new setValue and customRowAction properties, formatters can render action buttons which modify the item internally without opening editors or forms."
I'm not sure about what you tried to get, but from my findings, setValue requires a user action to be performed through a click. Therefore, it won't write automatically any data or, in other words, it doesn't work like a calculated column.
I used your piece of code and everything worked fine, BUT I used a button to perform the writing action of a multiperson column elsewhere. Here is visually what I did:
And if you check with edit in grid view to see what actually there is behind, here is the result:
yes doing the same, using a button. You mentioned 'everything worked fine', did that mean that multiple persons were copied from the source field to the destination field. Or did you find that only the first person in the source multi person field was copied to the destination multi person field. This is the challenge to be solved. How to copy not just the first person in the source field but copy over all persons in the source multi person field.
@divewoot
From my testing, multiple persons were copied from the source field to the destination field.
Here is the code I used for the "SETVALUEBUTTON" column:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"customRowAction": {
"action": "setValue",
"actionInput": {
"MULTIPERSON2": "=[$MULTIPERSON1]"
}
},
"style": {
"margin-top": "10px",
"display": "flex",
"align-items": "center",
"justify-content": "center",
"box-sizing": "border-box",
"width": "110px",
"height": "40px",
"border-radius": "10px",
"box-shadow": "2px 2px 2px #bdbbb7",
"cursor": "pointer"
},
"attributes": {
"class": "sp-field-bold sp-css-backgroundColor-neutralBackground sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralTertiary"
},
"txtContent": "PUSH HERE"
}
The source column has name MULTIPERSON1 The destination column has name MULTIPERSON2
I tried @Fedes365 's code and was able to copy multiple users. Also, since there seems to be no replies, I will close it.
How can setValue be used to copy the value stored in one multi person field to another empty multi person field? Have tried multiple ways of implementing appendTo but nothing is working. The below code does work but only copies over one person instead of the multi person values that are stored in perMultiPersonField1. This will be used in a custom list view.
"customRowAction": { "action": "setValue", "actionInput": { "perMultiPersonField2": "=[$perMultiPersonField1]" } }