Forum Discussion
john john
Jan 18, 2019Steel Contributor
Adding JSON inside my "Format view" is not having any effect.
I have a custom list inside our sharepoint online classic team site. now the custom list has a field named "SiteAutomaticallyCreated" of type "Single Line of text" which can have values; (null, No or Yes). and i want to redirect the users when they click on the list item title, to either the normal display form if the "SiteAutomaticallyCreated" = No , OR to redirect the user to a sub-site if the"SiteAutomaticallyCreated" =Yes.
So inside my list view >> I click on "Format view" >> i added this json:-
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "=if([$SiteAutomaticallyCreated] == 'Yes', 'https://****.sharepoint.com/sites/**/**/','https://***.sharepoint.com/sites/***/**/Lists/Projects/DispForm.aspx?ID=') + [$ID]"
}
}
as follow:-
But currently when i click on any item i will be redirected to the display form. and i am already showing the SiteAutomaticallyCreated field inside the list view.
so can anyone advice on this please?
Thanks
Matti Paukkonen wrote:If you need changes only to Title column, just format only the Title column. Your code is actually working correctly on column formatting.
Column formatting can be found on column settings.
thanks for pointing this out, i thought i need to apply this to the view format. now my code is working well..
4 Replies
Sort By
- Eva VogelSteel Contributor
Hi john john! The Json field is only for conditional formatting. You tried to manipulate the masterpage settings and thus it redirected to the original displayform. The modern ux / classic settings are not open for being set by users. Thats an admin thing to do. For this you have the central administration settings in your sharepoint online center in office 365. Or you can manipulate the masterpage and insert a new choice button, whether user should be able to change the ux (???) . Good look and greets, Eva.
- Matti PaukkonenIron Contributor
If you need changes only to Title column, just format only the Title column. Your code is actually working correctly on column formatting.
Column formatting can be found on column settings.
- john johnSteel Contributor
Matti Paukkonen wrote:If you need changes only to Title column, just format only the Title column. Your code is actually working correctly on column formatting.
Column formatting can be found on column settings.
thanks for pointing this out, i thought i need to apply this to the view format. now my code is working well..
- Matthew CarterIron Contributor
john john Is there a way I could do that with the [ID] column? I could have Title be say renamed to or a new column "Site Number: XXX" where XXX is the item ID reference from the ID column.