Skip to content

Instantly share code, notes, and snippets.

@chrisobriensp
Last active November 8, 2019 12:07
Show Gist options
  • Save chrisobriensp/5fef701167d1766efb575ce9096cad49 to your computer and use it in GitHub Desktop.
Save chrisobriensp/5fef701167d1766efb575ce9096cad49 to your computer and use it in GitHub Desktop.
A SharePoint Site Design which configures a modern theme, calls a Flow, and provisions some document libraries (including column formatting), fields and navigation links.
{
"$schema": "schema.json",
"actions": [
{
"verb": "applyTheme",
"themeName": "COB purple"
},
{
"verb": "triggerFlow",
"url": "https://prod-48.westeurope.logic.azure.com:443/workflows/791dab19ffb3455cbfe58b6ac556e37c/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ZfoL7_0JXwg_Mv3_BmyCN-Z5W-l2eehRI8Ga0jWzPH4",
"name": "Apply PnP template",
"parameters": {
"event": "",
"product": ""
}
},
{
"verb": "createSPList",
"templateType": 100,
"listName": "Project Activities",
"subactions": [
{
"verb": "setDescription",
"description": "List of project activities"
},
{
"verb": "addSPField",
"fieldType": "Text",
"displayName": "Project Status",
"isRequired": true,
"addToDefaultView": true
},
{
"verb": "addSPField",
"fieldType": "Number",
"displayName": "Effort (days)",
"addToDefaultView": true,
"isRequired": true
},
{
"verb": "addSPField",
"fieldType": "Note",
"displayName": "Meeting Notes",
"addToDefaultView": true,
"isRequired": false
},
{
"verb": "addSPField",
"fieldType": "User",
"displayName": "Assigned To",
"addToDefaultView": true,
"isRequired": true
},
{
"verb": "setSPFieldCustomFormatter",
"fieldDisplayName": "Project Status",
"formatterJSON": {
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"debugMode": true,
"elmType": "div",
"attributes": {
"class": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"Done"
]
},
"sp-field-severity--good",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"In progress"
]
},
"sp-field-severity--low",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"In review"
]
},
"sp-field-severity--warning",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"Blocked"
]
},
"sp-field-severity--severeWarning",
"sp-field-severity--blocked"
]
}
]
}
]
}
]
}
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"Done"
]
},
"CheckMark",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"In progress"
]
},
"Forward",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"In review"
]
},
"Error",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toString()",
"operands": [
"@currentField"
]
},
"Has issues"
]
},
"Warning",
"ErrorBadge"
]
}
]
}
]
}
]
}
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
},
{
"verb": "setSPFieldCustomFormatter",
"fieldDisplayName": "Assigned To",
"formatterJSON": {
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding-right": "8px"
},
"txtContent": "@currentField.title"
},
{
"elmType": "a",
"attributes": {
"iconName": "Mail",
"class": "sp-field-quickActions",
"href": {
"operator": "+",
"operands": [
"mailto:",
"@currentField.email",
"?subject=Task status&body=Hey, how is your task coming along?.\r\n---\r\n",
"@currentField.title",
"\r\nUpdate Status"
]
}
}
}
]
}
},
{
"verb": "setSPFieldCustomFormatter",
"fieldDisplayName": "Effort (days)",
"formatterJSON": {
"debugMode": true,
"elmType": "div",
"txtContent": "@currentField",
"attributes": {
"class": "sp-field-dataBars"
},
"style": {
"width": {
"operator": "?",
"operands": [
{
"operator": ">",
"operands": [
"@currentField",
"20"
]
},
"100%",
{
"operator": "+",
"operands": [
{
"operator": "toString()",
"operands": [
{
"operator": "*",
"operands": [
"@currentField",
5
]
}
]
},
"%"
]
}
]
}
}
}
}
]
},
{
"verb": "createSPList",
"templateType": 101,
"listName": "Project Collateral",
"subactions": [
{
"verb": "setDescription",
"description": "A library of project-specific files"
},
{
"verb": "addSPField",
"fieldType": "DateTime",
"displayName": "Due Date",
"addToDefaultView": true,
"isRequired": true
},
{
"verb": "addSPField",
"fieldType": "User",
"displayName": "Contact",
"addToDefaultView": true,
"isRequired": true
},
{
"verb": "setSPFieldCustomFormatter",
"fieldDisplayName": "Due Date",
"formatterJSON": {
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": {
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$DueDate]",
"@now"
]
},
"#ff0000",
""
]
}
}
}
}
]
},
{
"verb": "addNavLink",
"url": "/Project Collateral",
"displayName": "Project Collateral",
"isWebRelative": true
},
{
"verb": "addNavLink",
"url": "/Lists/Project Activities",
"displayName": "Project Activities",
"isWebRelative": true
}
],
"bindata": {},
"version": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment