Prompt Detail:
Sure, here's an example script that will create three tasks (Email Employer, Bill Client, and Email Work Permit) in Monday whenever a group title includes the words "WP":
csharp// Get the current board and all its groups
var board = boards.getCurrentBoard();
var groups = board.getGroups();
// Loop through each group and check if the title includes "WP"
groups.forEach(function(group) {
var title = group.getTitle();
if (title.includes("WP")) {
// If the title includes "WP", create three new tasks
items.createItem({
"name": "Email Employer",
"column_values": {
"status": {"label": "To do"},
"person": {"personsAndTeams": [{"id": "{USER_ID}", "kind": "person"}]},
"due_date": {"date": "today"}
},
"group_id": group.getId()
});
items.createItem({
"name": "Bill Client",
"column_values": {
"status": {"label": "To do"},
"person": {"personsAndTeams": [{"id": "{USER_ID}", "kind": "person"}]},
"due_date": {"date": "today"}
},
"group_id": group.getId()
});
items.createItem({
"name": "Email Work Permit",
"column_values": {
"status": {"label": "To do"},
"person": {"personsAndTeams": [{"id": "{USER_ID}", "kind": "person"}]},
"due_date": {"date": "today"}
},
"group_id": group.getId()
});
}
});
This script uses the same basic structure as the previous example, but includes three separate calls to items.createItem()
to create the three different tasks. Note that you'll need to replace {USER_ID}
with the actual ID of the person or team you want to assign the tasks to.