Nov 16 2022 09:15 AM
Afternoon,
Is it possible to setup a text field on sharepoint that changes the text depending on what day of the week it is?
Thanks
Nov 17 2022 12:34 AM
@Jamie Lawrence You can try using WEEKDAY function and create a calculated column to show the text based on day of the week.
For example:
=IF(WEEKDAY([Start Date]) = 1, "Sunday", IF(WEEKDAY([Start Date]) = 2, "Monday", IF(WEEKDAY([Start Date]) = 3, "Tuesday", IF(WEEKDAY([Start Date]) = 4, "Wednesday", IF(WEEKDAY([Start Date]) = 5, "Thursday", IF(WEEKDAY([Start Date]) = 6, "Friday", "Saturday"))))))
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Nov 17 2022 04:20 AM
Solution@Jamie Lawrence I read your question slightly differently to @ganeshsanap and it seemed to me you might be wanting to do something similar to what we do on our intranet where there is a message or reminder about somethinbg every day. A few senior staff go into a list and change the message, and at 2am every day a flow runs in Power Automate that updates a different list which has just 1 item in it which is the message of the day. That message is then displayed on the homepage of the intranet, formatted with JSON to make it look better than the standard view of the list.
This is the list where the messages are stored:
This is the flow:
and then gets the item for that day from the messages list:
The flow then updates the other list with the message for that day:
And this is the result which is displayed on the homepage with the list web part:
The JSON view formatting for this is as follows and is based on the Announcements view formatting at https://github.com/pnp/List-Formatting/tree/master/view-samples/announcements
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"hideColumnHeader": true,
"hideSelection": true,
"rowFormatter": {
"elmType": "div",
"style": {
"min-width": "15vw",
"max-width": "19vw",
"padding-bottom": "20px"
},
"customCardProps": {
"formatter": {
"elmType": "div",
"children": [
{
"elmType": "img",
"attributes": {
"src": "[$Image]"
}
}
],
"style": {
"height": "200px",
"width": "200px",
"cursor": "pointer",
"font-size": "14px",
"padding": "14px",
"align-items": "stretch"
}
},
"openOnEvent": "hover",
"directionalHint": "leftCenter",
"isBeakVisible": false,
"beakStyle": {
"backgroundColor": "white"
}
},
"children": [
{
"elmType": "div",
"style": {
"border-radius": "8px",
"box-shadow": "#00000022 0px 1.6px 3.6px 0px, #00000022 0px 0.3px 0.9px 0px",
"display": "flex",
"font-size": "1rem",
"background-color": "#e5f6fd",
"line-height": "1.43",
"padding": "6px 16px",
"align-items": "center",
"flex-flow": "wrap"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "info"
},
"style": {
"padding-right": "10px",
"font-weight": "700",
"color": "#03a9f4"
}
},
{
"txtContent": "[$Title]",
"elmType": "div",
"style": {
"font-weight": "700",
"margin-bottom": "0.35em"
}
},
{
"elmType": "div",
"txtContent": "[$Message]",
"style": {
"padding-left": "26px",
"flex-direction": "column"
}
}
]
}
]
}
}
I hope that's useful.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Nov 17 2022 08:08 AM
Nov 21 2022 07:03 AM
Nov 21 2022 07:09 AM
@Jamie Lawrence make sure you are using YOUR column names in the list, that is the column name between [$ and ]
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Nov 21 2022 07:17 AM