Referencing 'Version' Column
-
08-02-2021 - |
Question
Hi there,
I am relatively new to using SharePoint as well as JSON and as mentioned in the subject, I am having issues in trying to reference the Version column (set by the approval status).
What I hope to achieve is such that if the "version" number is the same as the "version flow" number, a conditional formatting would be set to show a green background and red if the version flow number is less than the version number.
I have hard coded the values of 13 just to see if I could get the colours to appear. Whenever I try to reference [$Version], the values in version flow would disappear. Help on the matter would be greatly appreciated!
I have attached my current code applied to th 'Version Flow' column as conditional formatting.
{
"elmType": "div",
"txtContent": "@currentField",
"attributes": {},
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": ">=",
"operands": [
"@currentField",
"13.0"
]
},
"#98FB98",
{
"operator": "?",
"operands": [
{
"operator": "<",
"operands": [
"@currentField",
"13.0"
]
},
"#FF6A6A",
""
]
}
]
}
},
"customRowAction": {},
"children": []
}
Solution
Instead of using [$Version]
, use [$_UIVersionString]
.
So, your code should be something like below:
{
"elmType": "div",
"txtContent": "@currentField",
"attributes": {},
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": ">=",
"operands": [
"@currentField",
[$_UIVersionString]
]
},
"#98FB98",
{
"operator": "?",
"operands": [
{
"operator": "<",
"operands": [
"@currentField",
[$_UIVersionString]
]
},
"#FF6A6A",
""
]
}
]
}
},
"customRowAction": {},
"children": []
}
Note: Version
is a Single line of text field.