Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Automatic Absence Management Prompt for Power Automate Copilot #74

Merged
merged 5 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions prompts/ai-builder/basic-contract-generation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Basic Contract Generation

## Description

This solution enables users to automatically generate professional contracts using a combination of AI Builder, Power Automate, and SharePoint. The process dynamically fills a Word template with user-provided data, formats it into a complete contract, and optionally converts it to PDF before sending it to the intended recipients.

## Prompt

Generate a professional service contract based on the following inputs:
- Client Name: [ClientName]
- Client Address: [ClientAddress]
- Start Date: [StartDate]
- Services Included: [Services]
- Contract Duration: [Duration]
- Additional Terms: [Terms]

The contract must include:
1. A formal introduction naming the parties.
2. Clear service details and obligations.
3. Terms and conditions.
4. A signature section for both parties.

Format the contract in a professional tone.

### Supported Language(s)

[English](./en-us/prompt.md)

---

## Authors

Solution|Author(s)
--------|---------
Basic Contract Generation | [Cristian Rodriguez](https://github.com/script32)

---

## Minimal Path to Awesome

### Prerequisites

1. **Access to Power Automate** with premium connectors.
2. **SharePoint Online** library to store templates and generated contracts.
3. **AI Builder License** for GPT model integration.
4. A Word document template (`.docx`) with placeholders for dynamic content.

---

### Step 1: Create the Word Template
1. Open Microsoft Word and create a contract template with placeholders. Example:
```
**CONTRACT AGREEMENT**

This contract is made between [ClientName], located at [ClientAddress], and [YourCompany], effective as of [StartDate].

**Services Provided**:
[Services]

**Duration**:
[Duration]

**Terms and Conditions**:
[Terms]

**Signatures**:
________________________
Client Signature

________________________
Company Signature
```
2. Save the template as `ContractTemplate.docx`.
3. Upload the template to a SharePoint document library (e.g., `Templates`).

---

### Step 2: Create the Power Automate Flow

#### **Trigger**
1. Choose a trigger such as:
- **When a form response is submitted (Microsoft Forms)**.
- **When a new item is added to a SharePoint list**.

#### **Steps**
1. **Get Data**:
- Retrieve data from the trigger, such as client name, address, and services.

2. **AI Builder Integration**:
- Add the action **Generate Text with GPT (AI Builder)**.
- Use the following prompt:
```
Generate a professional service contract based on the following inputs:
- Client Name: [ClientName]
- Client Address: [ClientAddress]
- Start Date: [StartDate]
- Services Included: [Services]
- Contract Duration: [Duration]
- Additional Terms: [Terms]

The contract must include:
1. A formal introduction naming the parties.
2. Clear service details and obligations.
3. Terms and conditions.
4. A signature section for both parties.

Format the contract in a professional tone.
```
- Map the variables to dynamic content from the trigger.

3. **Fill the Word Template**:
- Add the action **Populate a Microsoft Word Template**.
- Select the `ContractTemplate.docx` file from SharePoint.
- Map placeholders (`[ClientName]`, `[Services]`, etc.) to the data retrieved from the trigger.

4. **Save the Generated Contract**:
- Use the action **Create File (SharePoint)** to save the populated Word document in a designated folder (e.g., `GeneratedContracts`).

5. **Convert to PDF (Optional)**:
- Add the action **Convert Word Document to PDF**.
- Save the PDF version in a specified folder.

6. **Send the Contract**:
- Add the action **Send an Email (Outlook)**.
- Attach the generated Word/PDF document and send it to the client.

---

### Step 3: Test the Flow
1. Submit a form response or add an item to the SharePoint list.
2. Verify that:
- The contract is correctly generated and saved in the designated folder.
- The email with the attachment is sent to the client.

---

### Example Output

**Word Template Example**:
```
**CONTRACT AGREEMENT**

This contract is made between John Doe, located at 123 Main Street, and Synerbyte, effective as of 2024-12-13.

**Services Provided**:
- IT Maintenance
- Cloud Integration

**Duration**:
12 Months

**Terms and Conditions**:
- All payments are due within 30 days of invoice.
- Support is available 24/7 during the contract period.

**Signatures**:
________________________
John Doe (Client)

________________________
Synerbyte (Company)
```

---

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-prompts/samples/ai-builder/basic-contract-generation" aria-hidden="true" />
52 changes: 52 additions & 0 deletions prompts/ai-builder/basic-contract-generation/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/pnp/samples/v1.0/metadata-schema.json",
"name": "pnp-powerplatform-prompts-basic-contract-generation",
"version": "1.0.0.0",
"source": "pnp",
"creationDateTime": "2024-10-08T00:00:00.000Z",
"updateDateTime": "2024-10-08T00:00:00.000Z",
"title": "Basic Contract Generation",
"shortDescription": "This prompt generates a professional contract using client-provided data.",
"longDescription": [
"This solution leverages AI Builder, Power Automate, and SharePoint to automate the generation of professional contracts. It dynamically fills a Word template with inputs such as client name, address, services, and terms, producing a ready-to-use document in Word or PDF format."
],
"url": "https://github.com/script32/powerplatform-prompts/tree/main/prompts/ai-builder/basic-contract-generation/",
"products": [
"AI Builder",
"Power Automate",
"Power Platform",
"powerplatform-prompts",
"ai-builder-prompts"
],
"tags": [
"Contract generation",
"Automation"
],
"categories": [
"AI Builder"
],
"metadata": [
{
"key": "Prompt",
"value": "Generate a professional service contract based on the following inputs: Client Name: [ClientName], Client Address: [ClientAddress], Start Date: [StartDate], Services Included: [Services], Contract Duration: [Duration], Additional Terms: [Terms]. The contract must include a formal introduction, clear service details, terms and conditions, and a section for signatures. Format it professionally."
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://raw.githubusercontent.com/script32/powerplatform-prompts/main/templates/previewprompts.png",
"alt": "Preview of Basic Contract Generation Prompt"
}
],
"authors": [
{
"gitHubAccount": "script32",
"name": "Cristian Rodriguez",
"pictureUrl": "https://avatars.githubusercontent.com/u/11950749?s=40&v=4"
}
]
}
]

17 changes: 17 additions & 0 deletions prompts/ai-builder/basic-contract-generation/en-us/prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Prompt

Generate a professional service contract based on the following inputs:
- Client Name: [ClientName]
- Client Address: [ClientAddress]
- Start Date: [StartDate]
- Services Included: [Services]
- Contract Duration: [Duration]
- Additional Terms: [Terms]

The contract must include:
1. A formal introduction naming the parties.
2. Clear service details and obligations.
3. Terms and conditions.
4. A signature section for both parties.

Format the contract in a professional tone.
51 changes: 51 additions & 0 deletions prompts/power-automate/automatic-absence-management/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Automatic Absence Management

## Description

This prompt helps automate employee absence management. It notifies the relevant parties, updates the shared calendar, and handles additional tasks based on absence length and replacement requests.

## Prompt
I want to create a flow to manage team absences automatically. The flow should start when an employee sends an email with the subject 'Absence' and specifies the start and end dates in the body of the email. The flow should perform the following actions:

- Extract the start and end dates of the absence from the body of the email.
- Update a shared team calendar with an event titled 'Absence: [Employee Name]' and the corresponding dates.
- Send an email to the employee's direct supervisor notifying them of the absence.
- If the absence is longer than 3 days, notify the HR department.
- If the employee requested a replacement, automatically assign a task in Microsoft Planner to the designated substitute.
- Confirm to the employee via email that their absence has been processed."

Flow Technical Details:

Trigger:

- When a new email is received in a specific folder (e.g., "Absences").

Actions:

- Extract the start and end dates from the email using dynamic content expressions.
- Create an event in the shared team calendar using Microsoft Graph or the Office 365 Calendar connector.
- Send notifications via email and Teams messages based on the defined conditions.
- Create a task in Planner if a substitute is requested.

[Open in Power Automate](https://make.powerautomate.com/create/fromNaturalLanguage?prompt=I%20want%20to%20create%20a%20flow%20to%20manage%20team%20absences%20automatically.%20The%20flow%20should%20start%20when%20an%20employee%20sends%20an%20email%20with%20the%20subject%20%27Absence%27%20and%20specifies%20the%20start%20and%20end%20dates%20in%20the%20body%20of%20the%20email.%20The%20flow%20should%20perform%20the%20following%20actions%3A%20-%20Extract%20the%20start%20and%20end%20dates%20of%20the%20absence%20from%20the%20body%20of%20the%20email.%20-%20Update%20a%20shared%20team%20calendar%20with%20an%20event%20titled%20%27Absence%3A%20%5BEmployee%20Name%5D%27%20and%20the%20corresponding%20dates.%20-%20Send%20an%20email%20to%20the%20employee%27s%20direct%20supervisor%20notifying%20them%20of%20the%20absence.%20-%20If%20the%20absence%20is%20longer%20than%203%20days%2C%20notify%20the%20HR%20department.%20-%20If%20the%20employee%20requested%20a%20replacement%2C%20automatically%20assign%20a%20task%20in%20Microsoft%20Planner%20to%20the%20designated%20substitute.%20-%20Confirm%20to%20the%20employee%20via%20email%20that%20their%20absence%20has%20been%20processed.&from=Copilot&utm_source=PromptLibrary)

### Supported Language(s)

[English](./en-us/prompt.md)

## Authors

Solution|Author(s)
--------|---------
Automatic Absence Management | [Cristian Rodriguez](https://github.com/script32)

## Minimal Path to Awesome

* Copy the prompt
* Paste prompt into the Power Automate Copilot

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-prompts/samples/power-automate/automatic-absence-management" aria-hidden="true" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/pnp/samples/v1.0/metadata-schema.json",
"name": "pnp-powerplatform-prompts-automatic-absence-management",
"version": "1.0.0.0",
"source": "pnp",
"creationDateTime": "2024-12-11T00:00:00.000Z",
"updateDateTime": "2024-12-11T00:00:00.000Z",
"title": "Automatic Absence Management",
"shortDescription": "This Power Automate Copilot prompt helps with automating team absence management.",
"longDescription": [
"This Power Automate Copilot prompt helps automate team absence management by notifying relevant parties, updating shared calendars, and handling additional tasks."
],
"url": "https://github.com/pnp/powerplatform-prompts/tree/main/prompts/power-automate/automatic-absence-management",
"products": [
"Power Automate",
"Power Platform",
"powerplatform-prompts",
"power-automate-prompts"
],
"tags": [
"Power Automate Copilot"
],
"categories": [
"Power Automate"
],
"metadata": [
{
"key": "POWERAPPS-CUSTOMCONNECTOR",
"value": "No"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,

"url": "https://raw.githubusercontent.com/script32/powerplatform-prompts/main/prompts/power-automate/automatic-absence-management/assets/images/preview.png",
"alt": "Preview GIF"
}
],
"authors": [
{
"gitHubAccount": "script32",
"name": "Cristian Rodriguez",
"pictureUrl": "https://avatars.githubusercontent.com/u/11950749?s=40&v=4"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
I want to create a flow to manage team absences automatically. The flow should start when an employee sends an email with the subject 'Absence' and specifies the start and end dates in the body of the email. The flow should perform the following actions:

- Extract the start and end dates of the absence from the body of the email.
- Update a shared team calendar with an event titled 'Absence: [Employee Name]' and the corresponding dates.
- Send an email to the employee's direct supervisor notifying them of the absence.
- If the absence is longer than 3 days, notify the HR department.
- If the employee requested a replacement, automatically assign a task in Microsoft Planner to the designated substitute.
- Confirm to the employee via email that their absence has been processed."

Flow Technical Details:

Trigger:

- When a new email is received in a specific folder (e.g., "Absences").

Actions:

- Extract the start and end dates from the email using dynamic content expressions.
- Create an event in the shared team calendar using Microsoft Graph or the Office 365 Calendar connector.
- Send notifications via email and Teams messages based on the defined conditions.
- Create a task in Planner if a substitute is requested.

[Open in Power Automate](https://make.powerautomate.com/create/fromNaturalLanguage?prompt=I%20want%20to%20create%20a%20flow%20to%20manage%20team%20absences%20automatically.%20The%20flow%20should%20start%20when%20an%20employee%20sends%20an%20email%20with%20the%20subject%20%27Absence%27%20and%20specifies%20the%20start%20and%20end%20dates%20in%20the%20body%20of%20the%20email.%20The%20flow%20should%20perform%20the%20following%20actions%3A%20-%20Extract%20the%20start%20and%20end%20dates%20of%20the%20absence%20from%20the%20body%20of%20the%20email.%20-%20Update%20a%20shared%20team%20calendar%20with%20an%20event%20titled%20%27Absence%3A%20%5BEmployee%20Name%5D%27%20and%20the%20corresponding%20dates.%20-%20Send%20an%20email%20to%20the%20employee%27s%20direct%20supervisor%20notifying%20them%20of%20the%20absence.%20-%20If%20the%20absence%20is%20longer%20than%203%20days%2C%20notify%20the%20HR%20department.%20-%20If%20the%20employee%20requested%20a%20replacement%2C%20automatically%20assign%20a%20task%20in%20Microsoft%20Planner%20to%20the%20designated%20substitute.%20-%20Confirm%20to%20the%20employee%20via%20email%20that%20their%20absence%20has%20been%20processed.&from=Copilot&utm_source=PromptLibrary)
Loading