Jan 18 2019 08:03 AM - edited Jan 18 2019 08:10 AM
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
Jan 18 2019 09:43 PM - edited Jan 18 2019 09:44 PM
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.
Jan 20 2019 02:05 AM
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.
Jan 20 2019 03:04 PM
Solution
@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..
Feb 06 2021 06:42 PM
@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.
Jan 20 2019 03:04 PM
Solution
@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..