How to write a good prompt

Co-Pilot for Automators lets you explore different variations of a prompt so you can determine what works best for you. If the initial results do not meet your need, you can undo or delete the automation, rephrase your prompt, and run it again.

Follow these principles to get better and more relevant results from Automation Co-Pilot.

Write unambiguous instructions

Automation Co-Pilot aims to understand your intent from the instruction (or prompt) you send. Providing clear and specific instructions reduces guesswork and produces better results.

When instructed with Send Email in the Bot editor, Automation Co-Pilot uses the Email command package to execute this prompt. If your intention was to send an email with Microsoft 365 Outlook, then the correct prompt would be Send Outlook email action.

Be direct

Provide direct instructions and refrain from requesting or "thinking aloud".

Instead of saying can you please help me to create an automation to send email, rephrase your prompt to say create an automation to send email to demo@demo.com with subject 'this is a demo'.

Break down complex actions

If the automation scenario involves multiple steps, break them down into smaller, more manageable tasks.

Instead of saying Insert salesforce records into database and check record for email info to send email, rephrase your prompt to say Get records from Salesforce. For each record, insert it into the database. If the record contains an email address, send an email to demo@demo.com. If not, add a comment. If an error occurs when the bot performs these operations then show a message box.

Add additional context where possible

Specifying the task type or action in your prompt will accurately identify the automation step.

Using a prompt to say Open excel C:/temp/MyFile.xlsx would ensure that Automation Co-Pilot uses the Excel action to open the specified file.

Examples of prompts

These are example prompts for common patterns observed in automations built by developers. Though these prompt patterns create optimal outputs, we recommend tweaking them as needed for the automation you are building.

Bot editor Examples:
  • Open a folder. Loop through each file. Copy the file names and add it in a excel file
  • connect to database using myname/mytoken account
  • open browser google.com
  • create a bot that sends email to $EmailTo$, CC $EmailCC$, from $EmailFrom$, subject 'Bot Started', message 'The bot has now started'
  • run excel macro "TestMacro" on C:\Temp\MacroFile.xls. Then switch to excel Main worksheet and get all cells
  • Prompt for the user to select the folderpath. Loop through the selected folder including subfolders. If any excel file is found, then check for the worksheet ‘Main’. if available save it as a PDF in the same folder
  • get records from salesforce. for each salesforce record, insert a record into the database. if the record contains an email, send an email. if not, add a comment. if an error occurs when the bot performs these operations show a message box
  • Sharepoint Operations:
    • authenticate sharepoint with Client ID as $ClientID$, Client Secret as $ClientSecret$, Tenant ID as $TenantID$
    • create sharepoint folder COPILOT at /SiteName/Folders/FA
    • upload file to sharepoint
  • * If / ElseIf / Else:
    • If response is A, connect to database and read data. Else, send email to $EmailTo$
    • If response is A, connect to database and read data. Else if response is B, open www.google.com. Else, send email to $EmailTo$
  • Error Handler:
    • open excel C:\temp.xlsx. When error occurs, send an email to me@myorg.com
    • open excel C:\temp.xlsx and get all rows. If error occurs when performing these operations, send an email
    • add try-catch
    • add error handler
  • Use Excel Advanced package to load the data from 'SalesData.xlsx' located in the 'C:\Reports' folder. Write this data into XYZ oracle database.
  • Prompt user for two folders. Loop first folder to find excel files and copy them to second folder.
  • Create a bot to copy data from a table in database to excel.

Process Composer Examples:
  • Create a new customer profile in the CRM system. The name, email address, and phone number will be provided by a user via a form.
  • Read the list of automotive parts from a pdf using a document automation task, use a bot to search these parts in a website, and email the collected information
  • Start with a form to enter patient information. Then filter out patients that are 75 years old and older. Finally, add a bot to save the information in an excel spreadsheet.
  • Get data from an invoice. If the name starts with "new", check the price. If the price is above 1000, send an email and If the price is below 500, then go to the first task. Otherwise, save the data to Excel file. If the invoice doesn't start with new, validate the document.
  • Add a form task for EntryForm.
  • Add a bot task for botInput.