diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_0.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_0.sh index 08dbb09c..7ae14259 100644 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_0.sh +++ b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_0.sh @@ -1,3 +1,3 @@ -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{Quote_Name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{Opportunity_Name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ ---header 'Authorization: Bearer ' - +curl --location 'https:///services/data/vXX.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{quote_name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{opportunity_name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ +--header 'Authorization: Bearer '\ +--header 'Content-Type: application/json' \ diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_1.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_1.sh index 645cbbb7..af5f2847 100644 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_1.sh +++ b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_1.sh @@ -1,3 +1,3 @@ -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{Product_Name}}%25%27' \ ---header 'Authorization: Bearer ' - +curl --location 'https:///services/data/vXX.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{product_name}}%25%27' \ +--header 'Authorization: Bearer '\ +--header 'Content-Type: application/json' \ diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_2.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_2.sh index b8ddcb22..a01d7571 100644 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_2.sh +++ b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_2.sh @@ -1,10 +1,10 @@ -curl --location 'https:///services/data/v62.0/sobjects/QuoteLineItem' \ +curl --location 'https:///services/data/vXX.0/sobjects/QuoteLineItem' \ --header 'Content-Type: application/json' \ ---header 'Authorization: Bearer ' \ +--header 'Authorization: Bearer ' \ --data '{ - "QuoteId": "", - "PricebookEntryId": "", - "Product2Id": "", - "Quantity": , - "UnitPrice": "" + "QuoteId": "", + "PricebookEntryId": "", + "Product2Id": "", + "Quantity": "", + "UnitPrice": "" }' diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_3.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_3.sh deleted file mode 100644 index 08dbb09c..00000000 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_3.sh +++ /dev/null @@ -1,3 +0,0 @@ -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{Quote_Name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{Opportunity_Name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ ---header 'Authorization: Bearer ' - diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_4.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_4.sh deleted file mode 100644 index 645cbbb7..00000000 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_4.sh +++ /dev/null @@ -1,3 +0,0 @@ -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{Product_Name}}%25%27' \ ---header 'Authorization: Bearer ' - diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_5.sh b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_5.sh deleted file mode 100644 index 129555cf..00000000 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_5.sh +++ /dev/null @@ -1,10 +0,0 @@ -curl --location 'https://.my.salesforce.com/services/data/v62.0/sobjects/QuoteLineItem' \ ---header 'Content-Type: application/json' \ ---header 'Authorization: Bearer ' \ ---data '{ - "QuoteId": "", - "PricebookEntryId": "", - "Product2Id": "", - "Quantity": , - "UnitPrice": "" -}' diff --git a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_6.yaml b/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_6.yaml deleted file mode 100644 index 76d5913b..00000000 --- a/plugins/salesforce-add-line-item-to-quote/.codeblocks/block_6.yaml +++ /dev/null @@ -1,31 +0,0 @@ -steps: - - action: - output_key: Get_Qualified_Opportunity_With_StageName_result - action_name: Get_Qualified_Opportunity_With_StageName - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - Opportunity_Name: data.Opportunity_Name - Quote_Name: data.Quote_Name - - action: - output_key: Get_Product_Info_result - action_name: Get_Product_Info - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - Product_Name: data.Product_Name - - action: - output_key: AddLineItemtoQuote_result - action_name: AddLineItemtoQuote - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - UnitPrice: data.UnitPrice - PricebookEntryId: data.Get_Product_Info_result.records[0].PricebookEntries.records[0].Id - Quantity: data.Quantity - QuoteId: data.Get_Qualified_Opportunity_With_StageName_result.records[0].Quotes.records[0].Id - Product2Id: data.Get_Product_Info_result.records[0].Id - diff --git a/plugins/salesforce-add-line-item-to-quote/00ecd5b7-7a7c-4cfa-83bc-1ecbd244612d.png b/plugins/salesforce-add-line-item-to-quote/00ecd5b7-7a7c-4cfa-83bc-1ecbd244612d.png deleted file mode 100644 index 20df84ee..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/00ecd5b7-7a7c-4cfa-83bc-1ecbd244612d.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/512cad53-2fb3-438c-91a7-db4cd48c4801.png b/plugins/salesforce-add-line-item-to-quote/512cad53-2fb3-438c-91a7-db4cd48c4801.png deleted file mode 100644 index 96434963..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/512cad53-2fb3-438c-91a7-db4cd48c4801.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/55f8cd39-cb81-4d70-a271-8dc198b9f415.png b/plugins/salesforce-add-line-item-to-quote/55f8cd39-cb81-4d70-a271-8dc198b9f415.png deleted file mode 100644 index b3bbd8a2..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/55f8cd39-cb81-4d70-a271-8dc198b9f415.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/5c052c25-3559-42d8-b1a0-a52bccf86589.png b/plugins/salesforce-add-line-item-to-quote/5c052c25-3559-42d8-b1a0-a52bccf86589.png deleted file mode 100644 index 45a2ed3b..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/5c052c25-3559-42d8-b1a0-a52bccf86589.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/7e60a366-b583-45c4-8f0f-6854ec7ed8ca.png b/plugins/salesforce-add-line-item-to-quote/7e60a366-b583-45c4-8f0f-6854ec7ed8ca.png deleted file mode 100644 index a87689fe..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/7e60a366-b583-45c4-8f0f-6854ec7ed8ca.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/8af424b3-8064-4024-9e7f-add4cd86114d.png b/plugins/salesforce-add-line-item-to-quote/8af424b3-8064-4024-9e7f-add4cd86114d.png deleted file mode 100644 index 98de58ec..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/8af424b3-8064-4024-9e7f-add4cd86114d.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/99e9fb17-8418-4e0e-b27b-febf5db64652.png b/plugins/salesforce-add-line-item-to-quote/99e9fb17-8418-4e0e-b27b-febf5db64652.png deleted file mode 100644 index befc973a..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/99e9fb17-8418-4e0e-b27b-febf5db64652.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/README.md b/plugins/salesforce-add-line-item-to-quote/README.md index d407d382..494fcd79 100644 --- a/plugins/salesforce-add-line-item-to-quote/README.md +++ b/plugins/salesforce-add-line-item-to-quote/README.md @@ -1,302 +1,92 @@ --- description: A plugin that adds a line item a quote for a qualified opportunity. -difficulty_level: INTERMEDIATE -fidelity: TEMPLATE +fidelity: GUIDE installation_asset_uuid: 0dde6199-774e-424a-a4c0-9fd1566035d1 name: Add a Line Item to a Quote +difficulty_level: INTERMEDIATE +time_in_minutes: 20 purple_chat_link: https://developer.moveworks.com/creator-studio/developer-tools/purple-chat?conversation=%7B%22startTimestamp%22%3A%2211%3A43+AM%22%2C%22messages%22%3A%5B%7B%22parts%22%3A%5B%7B%22richText%22%3A%22I+need+to+add+a+product+to+a+quote+in+Salesforce.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Okay%2C+I+can+help+with+that.+Please+provide+the+opportunity+name%2C+quote+name%2C+product+name%2C+quantity%2C+and+sales+price.%22%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22The+opportunity+name+is+%27Palm+Tree+Corp%27%2C+the+quote+name+is+%27Q3+Sales+Quote%27%2C+and+I+need+to+add+%2710+Service+Hours%27.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Got+it.+Now%2C+please+provide+the+quantity+and+sales+price.%22%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Quantity+is+5+and+the+sales+price+is+%24200+each.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Please+confirm+the+details+below+before+I+add+the+line+item+to+the+quote.%22%7D%2C%7B%22richText%22%3A%22%3Cb%3EConfirm+Line+Item+Details%3C%2Fb%3E%3Cbr%3E%3Cb%3EOpportunity+Name%3A+%3C%2Fb%3EAcme+Corp%3Cbr%3E%3Cb%3EQuote+Name%3A+%3C%2Fb%3EQ3+Sales+Quote%3Cbr%3E%3Cb%3EProduct+Name%3A+%3C%2Fb%3E10+Service+Hours%3Cbr%3E%3Cb%3EQuantity%3A+%3C%2Fb%3E5%3Cbr%3E%3Cb%3ESales+Price%3A+%3C%2Fb%3E%24200+each%3Cbr%3E%22%7D%2C%7B%22buttons%22%3A%5B%7B%22buttonText%22%3A%22Add+to+Salesforce%22%2C%22style%22%3A%22filled%22%7D%2C%7B%22buttonText%22%3A%22Edit+Details%22%2C%22style%22%3A%22outlined%22%7D%2C%7B%22buttonText%22%3A%22Cancel%22%2C%22style%22%3A%22outlined%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Ok%2C+adding+it+now.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22richText%22%3A%22Adding+product+%2710+Service+Hours%27+to+quote+%27Q3+Sales+Quote%27+in+Salesforce...%22%2C%22status%22%3A%22pending%22%7D%5D%7D%2C%7B%22richText%22%3A%22I%27ve+added+the+product+to+the+quote.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Q3+Sales+Quote%22%2C%22connectorName%22%3A%22salesforce%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%5D%7D solution_tags: - Sales systems: - salesforce -time_in_minutes: 20 --- -# Introduction: +## **Introduction** -Salesforce is a CRM platform, and the "Add Line Item to Quote" plugin simplifies the process of adding line items to a quote in your Salesforce account. By integrating this feature with your bot, users can quickly and efficiently add and manage line items within their quotes, improving workflow and organization. +The **“Add a Line Item to a Quote”** plugin enables sales representatives to easily add products to an existing quote for a qualified opportunity directly through the Moveworks AI Assistant. This simplifies updating quotes in Salesforce without having to navigate the system manually. -This guide will show you how to add the "Add Line Item to Quote" feature to your bot using Creator Studio. Let's get started! +This guide will walk you through installing and setting up the plugin in **Agent Studio**, so your team can quickly add line items to quotes and keep deals moving forward efficiently. Let’s get started! -# **Prerequisites:** +## **Prerequisites** -- Salesforce Connector built in Creator Studio (follow the [Salesforce Authentication](https://developer.moveworks.com/creator-studio/resources/connector/?id=salesforce) guide to create your connector) +- Access to Agent Studio -# **What are we building?** +## **What are we building?** -### **Conversation Design** +### **Agent Design** This [purple chat](https://developer.moveworks.com/creator-studio/developer-tools/purple-chat?conversation=%7B%22startTimestamp%22%3A%2211%3A43+AM%22%2C%22messages%22%3A%5B%7B%22parts%22%3A%5B%7B%22richText%22%3A%22I+need+to+add+a+product+to+a+quote+in+Salesforce.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Okay%2C+I+can+help+with+that.+Please+provide+the+opportunity+name%2C+quote+name%2C+product+name%2C+quantity%2C+and+sales+price.%22%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22The+opportunity+name+is+%27Palm+Tree+Corp%27%2C+the+quote+name+is+%27Q3+Sales+Quote%27%2C+and+I+need+to+add+%2710+Service+Hours%27.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Got+it.+Now%2C+please+provide+the+quantity+and+sales+price.%22%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Quantity+is+5+and+the+sales+price+is+%24200+each.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Please+confirm+the+details+below+before+I+add+the+line+item+to+the+quote.%22%7D%2C%7B%22richText%22%3A%22%3Cb%3EConfirm+Line+Item+Details%3C%2Fb%3E%3Cbr%3E%3Cb%3EOpportunity+Name%3A+%3C%2Fb%3EAcme+Corp%3Cbr%3E%3Cb%3EQuote+Name%3A+%3C%2Fb%3EQ3+Sales+Quote%3Cbr%3E%3Cb%3EProduct+Name%3A+%3C%2Fb%3E10+Service+Hours%3Cbr%3E%3Cb%3EQuantity%3A+%3C%2Fb%3E5%3Cbr%3E%3Cb%3ESales+Price%3A+%3C%2Fb%3E%24200+each%3Cbr%3E%22%7D%2C%7B%22buttons%22%3A%5B%7B%22buttonText%22%3A%22Add+to+Salesforce%22%2C%22style%22%3A%22filled%22%7D%2C%7B%22buttonText%22%3A%22Edit+Details%22%2C%22style%22%3A%22outlined%22%7D%2C%7B%22buttonText%22%3A%22Cancel%22%2C%22style%22%3A%22outlined%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Ok%2C+adding+it+now.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22richText%22%3A%22Adding+product+%2710+Service+Hours%27+to+quote+%27Q3+Sales+Quote%27+in+Salesforce...%22%2C%22status%22%3A%22pending%22%7D%5D%7D%2C%7B%22richText%22%3A%22I%27ve+added+the+product+to+the+quote.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Q3+Sales+Quote%22%2C%22connectorName%22%3A%22salesforce%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%5D%7D) shows the experience we are going to build. -# **Creator Studio Components** - -- **Triggers:** - 1. Natural Language -- **Slots:** - 1. **Opportunity Name:** Query the related Opportunity using the Opportunity Name.. - 2. **Quote Name:** Query the specific Quote using the Quote Name - 3. **Product Name:** Query relevant product details using the Product Name - 4. **Create Quote Line Item:** Capture the details to create a quote line item -- **Actions:** - 1. **Get Qualified Opportunity:** Fetch the qualified opportunity using the Opportunity Name and Quote Name via Salesforce API. - 2. **Retrieve Product Details:** Retrieve product information based on the provided Product Name, PricebookEntry, and Product2 details - 3. **Create Quote Line Item:** This action adds a line item to a quote with the specified product details for the quote -- **Guidelines:** - 1. None - -# **API Research** - -To build this use case, we will use **three APIs** to achieve the goal of adding a line item to a quote in a Salesforce account - -![image.png](image.png) - -## API #1: Retrieve Opportunity and Quote Information - -The [Retrieve Opportunity and Quote Information](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) API retrieves **Opportunity** and **Quote** details based on the given **Opportunity Name** and **Quote Name** from Salesforce using a SOQL query. This API helps in associating the correct quote with its related opportunity. +## **Installation Steps** -- **Purpose**: Fetches **Opportunity** and **Quote** information based on **Opportunity Name** and **Quote Name**. -- **Features**: Filters by **Opportunity Name** and **Quote Name** and returns the relevant Opportunity and Quote data. -- **Example**: Queries Salesforce to get the **Opportunity** and **Quote** information +We recommend setting up **Salesforce** before installing this plugin. Please follow the [Salesforce Connector](https://developer.moveworks.com/marketplace/package/?id=salesforce&hist=home%2Cbrws#how-to-implement) guide to configure the connection. -```bash -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{Quote_Name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{Opportunity_Name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ ---header 'Authorization: Bearer ' - -``` - -## API #2: Retrieve Product and Pricebook Entry Information - -The [Retrieve Product and Pricebook Entry Information](https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_Product2.htm) API retrieves **Product** and **PricebookEntry** details based on the given **Product Name** from Salesforce using a SOQL query. This API helps in associating products with their active pricebook entries, which are essential for adding line items to quotes. +Note: To enable the Add a Line Item to a Quote functionality, ensure the Salesforce integration user has the necessary object and field-level permissions. -- **Purpose**: Fetches **Product** details based on **Product Name** and its associated **PricebookEntry** information. -- **Features**: Filters by **Product Name** and returns the **PricebookEntry** details with active pricebook information. -- **Example**: Queries Salesforce to get the **Product** and **PricebookEntry** details +Specifically, confirm the following permissions are granted: -```bash -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{Product_Name}}%25%27' \ ---header 'Authorization: Bearer ' - -``` +- **Object Access**: `Read` and `Create` access to the **QuoteLineItem**, **Quote**, and **PricebookEntry** objects. +- **Field Access**: `Read` and `Edit` access to fields such as **QuoteId**, **PricebookEntryId**, **Quantity**, **UnitPrice**, and any custom fields your organization uses for quote line items. -## **API #3: Create Quote Line Item in Salesforce** +Once the connector is successfully configured, follow our [plugin installation documentation](https://help.moveworks.com/docs/ai-agent-marketplace-installation) for detailed steps on how to install and activate the plugin in **Agent Studio**. -The [**Create Quote Line Item in Salesforce**](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_quote.htm) API allows you to add a new **Quote Line Item** to a quote in Salesforce. Using the provided **Quote ID**, **Pricebook Entry ID**, **Product ID**, **Quantity**, and **Unit Price**, this API adds a line item to the specified quote. This is crucial for creating detailed quotes with specific products and prices. +## **Appendix** -- **Purpose**: Creates a new **Quote Line Item** in Salesforce. -- **Features**: Supports adding **Quote ID**, **Pricebook Entry ID**, **Product ID**, **Quantity**, and **Unit Price**. -- **Example**: Adds a new line item to a quote in Salesforce with the provided details +### **API #1: Retrieve Opportunity and Quote Information:** ```bash -curl --location 'https:///services/data/v62.0/sobjects/QuoteLineItem' \ +curl --location 'https:///services/data/vXX.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{quote_name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{opportunity_name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ +--header 'Authorization: Bearer '\ --header 'Content-Type: application/json' \ ---header 'Authorization: Bearer ' \ ---data '{ - "QuoteId": "", - "PricebookEntryId": "", - "Product2Id": "", - "Quantity": , - "UnitPrice": "" -}' ``` -- ****: Your Salesforce instance domain (e.g., `yourcompany.my.salesforce.com`). -- ****, ****, ****, ****, ****: The details for the **Quote Line Item**, including the associated **Quote ID**, **Pricebook Entry ID**, **Product ID**, quantity, and unit price. - -# **Steps** - -## **Step 1: Build HTTP Action** - -Define your HTTP Actions for fetching the **Opportunity** and **Quote** details from Salesforce based on the provided **Opportunity Name** and **Quote Name** - -### 1. **In Creator Studio, Create a New Action**: - -- Navigate to **Plugins** section > **Actions** tab. -- Click on **CREATE** to define a new action. - -![image.png](image%20332.png) - -- Click on the `IMPORT CURL` option and paste the following cURL command: - -```bash -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+Name,+StageName,+%28SELECT+Id,+Name+FROM+Quotes+WHERE+Name=%27{{Quote_Name}}%27%29+FROM+Opportunity+WHERE+Name+LIKE+%27%25{{Opportunity_Name}}%25%27+AND+%28StageName=%27Qualification%27+OR+StageName=%27Qualified%27%29' \ ---header 'Authorization: Bearer ' - -``` - -- Click on `Use Existing Connector` > select the [**Salesforce Connector**](https://developer.moveworks.com/creator-studio/resources/connector/?id=salesforce) that you just created > Click on `Apply`. This will populate the Base URL and the Authorization section of the API Editor. -- **Query Parameters for Salesforce Opportunity and Quote Query** - - **Key (q)**: `Value` (`SELECT Id, Name, StageName, (SELECT Id, Name FROM Quotes WHERE Name = '{{Quote_Name}}') FROM Opportunity WHERE Name LIKE '%{{Opportunity_Name}}%' AND (StageName = 'Qualification' OR StageName = 'Qualified')`) - - This query filters opportunities by **Opportunity Name** and retrieves related quotes if the opportunity is in the **Qualification** or **Qualified** stage, ensuring only relevant data is returned - -![image.png](00ecd5b7-7a7c-4cfa-83bc-1ecbd244612d.png) - -- **Input Variables**: - - **Opportunity_Name**: Example Value (Salesforce Demo) - - **Quote_Name**: Example Value (Quote for Salesforce Demo) - - -![image.png](7e60a366-b583-45c4-8f0f-6854ec7ed8ca.png) - -- Click on `Test` to check if the Connector setup was successful and expect a successful response as shown below. You will see the request response on the left side and the generated output schema on the right. -- If the output schema does not match the API response or fails to populate automatically, kindly click the `GENERATE FROM RESPONSE` button to refresh and align the schema with the API response. - -![image.png](55f8cd39-cb81-4d70-a271-8dc198b9f415.png) - -- Add the **API Name** and **API Description** as shown below, then click the `Save` button - -![image.png](image%201.png) +**Query Parameter:** -### 2. Fetch Product Details +- `opportunity_name` (string) - The name of the Opportunity you want to search for. This helps filter Opportunities based on their names. +- `quote_name` (string)- The exact name of the Quote you're looking for under the matched Opportunity. This filters the related Quotes. -- Repeat the steps above to create another action. -- Click on the `IMPORT CURL` option and paste the following cURL command: +### **API #2: Retrieve Product and Pricebook Entry Information:** ```bash -curl --location 'https:///services/data/v62.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{Product_Name}}%25%27' \ ---header 'Authorization: Bearer ' - +curl --location 'https:///services/data/vXX.0/query/?q=SELECT+Id,+%28SELECT+Pricebook2Id,+Id+FROM+PricebookEntries+WHERE+Pricebook2.IsActive+=+TRUE%29+FROM+Product2+WHERE+Name+LIKE+%27%25{{product_name}}%25%27' \ +--header 'Authorization: Bearer '\ +--header 'Content-Type: application/json' \ ``` -- Click on `Use Existing Connector` > select the [**Salesforce Connector**](https://developer.moveworks.com/creator-studio/resources/connector/?id=salesforce) that you just created > Click on `Apply`. This will populate the Base URL and the Authorization section of the API Editor. -- **Query Parameters for Salesforce Product Query**: - - **Key (q)**: Value (`SELECT Id, (SELECT Pricebook2Id, Id FROM PricebookEntries WHERE Pricebook2.IsActive = TRUE) FROM Product2 WHERE Name LIKE '%{{Product_Name}}%'`) - - This query filters **Product2** records based on the **Product Name** using the **LIKE** operator, allowing for partial matching. It retrieves the related **PricebookEntry** information where the **Pricebook2** is active and returns the **Id** for both **Product2** and the related **PricebookEntry** details. - -![image.png](512cad53-2fb3-438c-91a7-db4cd48c4801.png) - -- **Input Variables** : - - Product_Name : Example Value (GenWatt Diesel 200kW). - -![image.png](5c052c25-3559-42d8-b1a0-a52bccf86589.png) - -- Test the Connector setup as described earlier to verify the response. If the output schema is incorrect or missing, click `GENERATE FROM RESPONSE` to update it. - -![image.png](f93a374c-a4a3-4bd3-b473-58aa3af16d02.png) - -- Add the **API Name** and **API Description** as shown below, then click the `Save` button - -![image.png](image%202.png) +**Query Parameter:** -### 3. Create Quote Line Item +- `product_name` (string) - The name of the Product you want to search for. This is used to find matching products and their active price book entries in Salesforce. -- Repeat the steps above to create another action. -- Click on the `IMPORT CURL` option and paste the following CURL command: +### **API #3: Create Quote Line Item:** ```bash -curl --location 'https://.my.salesforce.com/services/data/v62.0/sobjects/QuoteLineItem' \ +curl --location 'https:///services/data/vXX.0/sobjects/QuoteLineItem' \ --header 'Content-Type: application/json' \ ---header 'Authorization: Bearer ' \ +--header 'Authorization: Bearer ' \ --data '{ - "QuoteId": "", - "PricebookEntryId": "", - "Product2Id": "", - "Quantity": , - "UnitPrice": "" + "QuoteId": "", + "PricebookEntryId": "", + "Product2Id": "", + "Quantity": "", + "UnitPrice": "" }' ``` -- To create a Quote Line Item in Salesforce, we send a POST request with the following body: - -![image.png](f8a8d634-7838-4d54-8e5d-f575bbcabbc9.png) - -- **QuoteId**: The ID of the quote to which the line item is being added. -- **PricebookEntryId**: The ID of the pricebook entry associated with the product. -- **Product2Id**: The ID of the product being added to the quote. -- **Quantity**: The quantity of the product in the quote. -- **UnitPrice**: The unit price of the product in the quote - -![image.png](d56191b7-e1fa-4f6d-b87f-a9d72b159ff7.png) - -- We have provided sample input variables for **QuoteId**, **PricebookEntryId**, **Product2Id**, **Quantity**, and **UnitPrice**. -- Using these input variables, we tested the plugin by making a **POST** request to create a **Quote Line Item** in Salesforce - -![image.png](99e9fb17-8418-4e0e-b27b-febf5db64652.png) - -- After that, you can test the plugin by checking the response, which will include the **Quote Line Item ID**. If the Quote Line Item has been successfully created, the response will return a **201** status code, indicating successful creation. -- If the output schema is incorrect or missing, click **`GENERATE FROM RESPONSE`** to update it. - -![image.png](image%203.png) - -- Add the **API Name** and **API Description** as shown below, then click the `Save` button - -## **Step 2: Build Compound Action** - -- Head over to the **Compound Actions** tab and click **CREATE** - -![image.png](image%20334.png) - -- Give your Compound Action a **Name** and **Description** , then click `Next` Note: Name only letters, numbers, and underscores. We suggest using snake case or camel case formatting (e.g. Workflow_name or workflowName ) - -![image.png](image%204.png) - -- Click on the `Script editor` tab. Here you will be able to build your compound action using the YAML syntax. -- At a high-level, this syntax provides actions (HTTP Request, APIthon Scripts) and workflow logic (switch statements, for each loops, return statements, parallel, try/catch). See the [Compound Action Syntax](https://developer.moveworks.com/creator-studio/reference/compound_actions_syntax/) Reference for more info. - -```yaml -steps: - - action: - output_key: Get_Qualified_Opportunity_With_StageName_result - action_name: Get_Qualified_Opportunity_With_StageName - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - Opportunity_Name: data.Opportunity_Name - Quote_Name: data.Quote_Name - - action: - output_key: Get_Product_Info_result - action_name: Get_Product_Info - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - Product_Name: data.Product_Name - - action: - output_key: AddLineItemtoQuote_result - action_name: AddLineItemtoQuote - progress_updates: - on_complete: ON_COMPLETE_MESSAGE - on_pending: ON_PENDING_MESSAGE - input_args: - UnitPrice: data.UnitPrice - PricebookEntryId: data.Get_Product_Info_result.records[0].PricebookEntries.records[0].Id - Quantity: data.Quantity - QuoteId: data.Get_Qualified_Opportunity_With_StageName_result.records[0].Quotes.records[0].Id - Product2Id: data.Get_Product_Info_result.records[0].Id - -``` - -- Click on `Input fields` tab and click the `+Add` button. Here you will define the slots that you want to collect from users through the conversation and trigger your Workflow with. After defining the input fields, click the `Submit` button to save your changes. - -![image.png](image%205.png) - -## **Step 3: Publish Workflow to Plugin** - -- Head over to the `Compound Actions` tab and click on the kebab menu ( `︙` ) -- Next, click on `Publish Workflow to Plugin` -- First, verify your Plugin **Name** & **Short description** . This is autofilled from the name & description of your compound action. - -![image.png](c36db5c3-f699-4eed-b24b-0eb56c35ff00.png) - -- Next, consider whether to select the `User consent required before execution?` checkbox. Enabling this option prompts the user to confirm all slot values before executing the plugin, which is widely regarded as a best practice. - -![image.png](8af424b3-8064-4024-9e7f-add4cd86114d.png) - -- Click `Next` and set up your positive and negative triggering examples. This ensures that the bot triggers your plugin given a relevant utterance. -- See our [guide](https://developer.moveworks.com/creator-studio/conversation-design/triggers/natural-language-triggers/#how-to-write-good-triggering-examples) on Triggering -- Lastly, click `Next` and set the **Launch Rules** you want your plugin to abide by. - - See our [guide](https://developer.moveworks.com/creator-studio/administration/launch-options/) on Launch Rules - -## **Step 4: See it in action!** - -- After clicking the final `Submit` button, your plugin will be published to the bot and triggerable based on your **Launch Rules.** -- You should wait up to **5 minutes** after making changes before trying to test in your bot! - - If you run into an issue: - 1. Check our [troubleshooting guides](https://developer.moveworks.com/creator-studio/troubleshooting/support/) - 2. Understand your issue using Logs - 3. Reach out to Support - -# **Congratulations!** +**Request Body Fields:** -You’ve successfully added the "Add Line Item to Quote" feature to your Salesforce account in your Copilot! Explore our other guides for more ideas on what to build next. \ No newline at end of file +- `quote_id` (string) - The ID of the Quote this line item belongs to, linking the product to the specific quote. +- `Pricebook2Id` (string) - The ID of the Price Book used for this Quote. This determines which set of products and prices will be available. +- `Product2Id` (string) - The ID of the Product used for this Quote. This determines which set of products and prices will be available. +- `quantity` (string) - The number of units quoted for this product. +- `unit_price` (string) - The price per unit of the product. \ No newline at end of file diff --git a/plugins/salesforce-add-line-item-to-quote/c36db5c3-f699-4eed-b24b-0eb56c35ff00.png b/plugins/salesforce-add-line-item-to-quote/c36db5c3-f699-4eed-b24b-0eb56c35ff00.png deleted file mode 100644 index b889e80d..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/c36db5c3-f699-4eed-b24b-0eb56c35ff00.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/d56191b7-e1fa-4f6d-b87f-a9d72b159ff7.png b/plugins/salesforce-add-line-item-to-quote/d56191b7-e1fa-4f6d-b87f-a9d72b159ff7.png deleted file mode 100644 index 23a2e5a9..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/d56191b7-e1fa-4f6d-b87f-a9d72b159ff7.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/f8a8d634-7838-4d54-8e5d-f575bbcabbc9.png b/plugins/salesforce-add-line-item-to-quote/f8a8d634-7838-4d54-8e5d-f575bbcabbc9.png deleted file mode 100644 index d0df3c61..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/f8a8d634-7838-4d54-8e5d-f575bbcabbc9.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/f93a374c-a4a3-4bd3-b473-58aa3af16d02.png b/plugins/salesforce-add-line-item-to-quote/f93a374c-a4a3-4bd3-b473-58aa3af16d02.png deleted file mode 100644 index ae2acc2d..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/f93a374c-a4a3-4bd3-b473-58aa3af16d02.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 1.png b/plugins/salesforce-add-line-item-to-quote/image 1.png deleted file mode 100644 index cb77b579..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 1.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 2.png b/plugins/salesforce-add-line-item-to-quote/image 2.png deleted file mode 100644 index d50ea8fd..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 2.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 3.png b/plugins/salesforce-add-line-item-to-quote/image 3.png deleted file mode 100644 index 3cc342e0..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 3.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 332.png b/plugins/salesforce-add-line-item-to-quote/image 332.png deleted file mode 100644 index c44bcff5..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 332.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 334.png b/plugins/salesforce-add-line-item-to-quote/image 334.png deleted file mode 100644 index c4a42d84..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 334.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 4.png b/plugins/salesforce-add-line-item-to-quote/image 4.png deleted file mode 100644 index 617ddfec..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 4.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image 5.png b/plugins/salesforce-add-line-item-to-quote/image 5.png deleted file mode 100644 index 6618dd23..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image 5.png and /dev/null differ diff --git a/plugins/salesforce-add-line-item-to-quote/image.png b/plugins/salesforce-add-line-item-to-quote/image.png deleted file mode 100644 index d0f03be3..00000000 Binary files a/plugins/salesforce-add-line-item-to-quote/image.png and /dev/null differ