2

So I am new to using JSON and need a little help. So I have these two Json codes

"additionalRowClass": "=if([$Modified] < @now && [$Modified] >= @now - 86400000, 'ms-bgColor-gray50', if([$Modified] < @now && [$Modified] >= @now - 259200000, 'ms-bgColor-gray20' , ''))"

One checks the date and changes the color of the row based on when it was modified.

"additionalRowClass": "= if([$Deleted] == 'Deleted', 'sp-field-strikeThrough sp-css-color-red', '')"

The other checks if the the value "Deleted" is in the deleted column and strikes through all the text in that column and makes it red.

Now, they work fine separately, but when I try to implement both at the same time, I have problems. I want both this pieces of code to work but cannot get them too.

Any advice?

1 Answer 1

3

Try using this:

"additionalRowClass": "=if([$Deleted] == 'Deleted', 'sp-field-strikeThrough sp-css-color-red', if([$Modified] < @now && [$Modified] >= @now - 86400000, 'ms-bgColor-gray50', if([$Modified] < @now && [$Modified] >= @now - 259200000, 'ms-bgColor-gray20' , '')))"

This will first check if [$Deleted] == 'Deleted' and add classes accordingly, If not, it will check other conditions. Hope this is what you want!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.