diff --git a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_0.sh b/plugins/salesforce-update-opportunity-stage/.codeblocks/block_0.sh index 3b277cbd..4944738a 100644 --- a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_0.sh +++ b/plugins/salesforce-update-opportunity-stage/.codeblocks/block_0.sh @@ -1,3 +1,11 @@ -curl --location --request PATCH 'https://.my.salesforce.com/services/data/v63.0/sobjects/Opportunity/' \--data '{ - "StageName": "" -} +curl --request PATCH +--location 'https:///services/data/v63.0/sobjects/Opportunity/' \ +--header 'Authorization: Bearer ' \ +--header 'Content-Type: application/json' \ +--data '{ + "StageName": "{{STAGE_NAME}}", + "Name": "{{NAME}}", + "CloseDate": "{{CLOSE_DATE}}", + "Discount__c": "{{DISCOUNT}}", + "MRR__c": "{{MRR}}" +}' diff --git a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_1.sh b/plugins/salesforce-update-opportunity-stage/.codeblocks/block_1.sh deleted file mode 100644 index 5af360ad..00000000 --- a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_1.sh +++ /dev/null @@ -1,6 +0,0 @@ -curl --location --request PATCH 'https://.my.salesforce.com/services/data/v63.0/sobjects/Opportunity/' \ ---header 'Authorization: Bearer ' \ ---header 'Content-Type: application/json' \ ---data '{ - "StageName": "" -}' diff --git a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_2.yaml b/plugins/salesforce-update-opportunity-stage/.codeblocks/block_2.yaml deleted file mode 100644 index 6187170b..00000000 --- a/plugins/salesforce-update-opportunity-stage/.codeblocks/block_2.yaml +++ /dev/null @@ -1,14 +0,0 @@ -steps: - - action: - output_key: Update_Opportunity_Details_result - action_name: Update_Opportunity_Details - progress_updates: - on_complete: Updated Opportunity stage - on_pending: Updating Opportunity stage - input_args: - StageName: data.StageName - Opportunity_Id: data.opportunity.records[0].Id - - return: - output_mapper: - Updated_StageName: data.Update_Opportunity_Details_result.records[0].StageName - diff --git a/plugins/salesforce-update-opportunity-stage/57fdf40a-f356-4ad0-9438-11e3fce13c93.png b/plugins/salesforce-update-opportunity-stage/57fdf40a-f356-4ad0-9438-11e3fce13c93.png deleted file mode 100644 index 7146ab75..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/57fdf40a-f356-4ad0-9438-11e3fce13c93.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/README.md b/plugins/salesforce-update-opportunity-stage/README.md index 090a1e16..0fa24164 100644 --- a/plugins/salesforce-update-opportunity-stage/README.md +++ b/plugins/salesforce-update-opportunity-stage/README.md @@ -2,7 +2,7 @@ description: A plugin that enables an opportunity owner to update its stage to ensure information is kept up-to-date. difficulty_level: INTERMEDIATE -fidelity: TEMPLATE +fidelity: GUIDE installation_asset_uuid: 7bf36acc-a90a-4216-913a-bd268901e25 name: Update the Stage of an Opportunity purple_chat_link: https://developer.moveworks.com/creator-studio/developer-tools/purple-chat?conversation=%7B%22startTimestamp%22%3A%2211%3A43%2BAM%22%2C%22messages%22%3A%5B%7B%22parts%22%3A%5B%7B%22richText%22%3A%22What%27s+the+current+stage+of+the+Acme+opportunity%3F%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%22Fetches+current+stage+of+the+Acme+opportunity+from+CRM%22%2C%22status%22%3A%22success%22%7D%5D%7D%2C%7B%22richText%22%3A%22The+current+stage+of+the+Acme+opportunity+is+%3Cb%3EProposal%2FPrice+Quote%3C%2Fb%3E.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Acme+Opportunity%22%2C%22connectorName%22%3A%22salesforce%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Update+the+stage+to+Closed.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22%3Cp%3EOkay%2C+let%27s+update+the+stage+of+the+Acme+opportunity.%3Cbr%3E%3C%2Fp%3E%22%7D%2C%7B%22reasoningSteps%22%3A%5B%7B%22richText%22%3A%22Change+stage+of+Acme+Opportunity+to+Closed%22%2C%22status%22%3A%22pending%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cb%3E%3Cp%3EPlease+confirm+the+details%3Cbr%3E%3C%2Fp%3E%3C%2Fb%3E%3Cbr%3E%3Cp%3E%3Cb%3EOpportunity%3A%3C%2Fb%3E+Acme%3Cbr%3E%3Cb%3ECurrent+Stage%3A%3C%2Fb%3E+Proposal%2FPrice+Quote%3Cbr%3E%3Cb%3ENew+Stage%3A%3C%2Fb%3E+Closed%3Cbr%3E%3C%2Fp%3E%22%7D%2C%7B%22buttons%22%3A%5B%7B%22buttonText%22%3A%22Confirm+Update%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%22Confirmed.%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%22Successfully+updated+Acme+opportunity%22%2C%22status%22%3A%22success%22%7D%5D%7D%2C%7B%22richText%22%3A%22OK.+I%27ve+updated+the+opportunity.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Acme+Opportunity%22%2C%22connectorName%22%3A%22salesforce%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%5D%7D @@ -13,169 +13,64 @@ systems: time_in_minutes: 20 --- -# **Introduction** +# **Introduction :** -Salesforce is a leading CRM platform, and the "**Update Opportunity Stage in Salesforce**" plugin simplifies the process of updating the stage of an opportunity within your Salesforce account. By integrating this functionality into your bot, users can seamlessly update opportunity stages, enhancing efficiency and organization. +The **“Update Opportunity Stage”** plugin enables users to quickly update the stage of an existing opportunity in **Salesforce**, all through the Moveworks AI Assistant. This streamlines the process for sales and support teams by eliminating the need to manually navigate Salesforce to locate and modify opportunity records. -This guide provides step-by-step instructions on how to incorporate the "**Update Opportunity Stage in Salesforce**" feature into your bot using Creator Studio. +This guide will walk you through installing and configuring the plugin in **Agent Studio** in just a few minutes. -Let’s begin! +Let’s get started! -# Prerequisites +# Prerequisites : -- [Postman](https://www.postman.com/) or an API Testing Tool -- 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) -- The **Salesforce Lookup Opportunity** is a plugin built in **Creator Studio** that allows users to retrieve opportunity details for a specific account name and check their stages based on a query. For setup instructions, refer to the [**Salesforce Lookup Opportunity](https://developer.moveworks.com/creator-studio/resources/plugin?id=salesforce-opportunity-information)** guide. +- Access to Agent Studio +- The **Salesforce Lookup Opportunity** is a plugin built in **Agent Studio** that allows users to retrieve opportunity details for a specific account name and check their stages based on a query. For setup instructions, refer to the [**Salesforce Lookup Opportunity](https://developer.moveworks.com/creator-studio/resources/plugin?id=salesforce-opportunity-information)** guide. # 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%2BAM%22%2C%22messages%22%3A%5B%7B%22parts%22%3A%5B%7B%22richText%22%3A%22What%27s+the+current+stage+of+the+Acme+opportunity%3F%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%22Fetches+current+stage+of+the+Acme+opportunity+from+CRM%22%2C%22status%22%3A%22success%22%7D%5D%7D%2C%7B%22richText%22%3A%22The+current+stage+of+the+Acme+opportunity+is+%3Cb%3EProposal%2FPrice+Quote%3C%2Fb%3E.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Acme+Opportunity%22%2C%22connectorName%22%3A%22salesforce%22%7D%5D%7D%5D%2C%22role%22%3A%22assistant%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22Update+the+stage+to+Closed.%22%7D%5D%2C%22role%22%3A%22user%22%7D%2C%7B%22parts%22%3A%5B%7B%22richText%22%3A%22%3Cp%3EOkay%2C+let%27s+update+the+stage+of+the+Acme+opportunity.%3Cbr%3E%3C%2Fp%3E%22%7D%2C%7B%22reasoningSteps%22%3A%5B%7B%22richText%22%3A%22Change+stage+of+Acme+Opportunity+to+Closed%22%2C%22status%22%3A%22pending%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cb%3E%3Cp%3EPlease+confirm+the+details%3Cbr%3E%3C%2Fp%3E%3C%2Fb%3E%3Cbr%3E%3Cp%3E%3Cb%3EOpportunity%3A%3C%2Fb%3E+Acme%3Cbr%3E%3Cb%3ECurrent+Stage%3A%3C%2Fb%3E+Proposal%2FPrice+Quote%3Cbr%3E%3Cb%3ENew+Stage%3A%3C%2Fb%3E+Closed%3Cbr%3E%3C%2Fp%3E%22%7D%2C%7B%22buttons%22%3A%5B%7B%22buttonText%22%3A%22Confirm+Update%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%22Confirmed.%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%22Successfully+updated+Acme+opportunity%22%2C%22status%22%3A%22success%22%7D%5D%7D%2C%7B%22richText%22%3A%22OK.+I%27ve+updated+the+opportunity.%22%7D%2C%7B%22citations%22%3A%5B%7B%22citationTitle%22%3A%22Acme+Opportunity%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** +# **Installation Steps** -- **Triggers:** - 1. Natural Language -- **Slots**: - 1. Fetch opportunity ID -- **Actions**: - 1. **Updating Stage using Opportunity ID**: Update the Stage Name of an opportunity by providing the desired stage name and the retrieved Opportunity ID. -- **Guidelines:** - 1. Add a guideline to confirm that this plugin executes only after the **Salesforce Lookup Opportunity** plugin has successfully run. - 2. Ensure that this plugin always retrieves the **Opportunity ID** directly from the response of the **Salesforce Lookup Opportunity** plugin +While you can create a connector during plugin installation, we recommend setting up the connector in **Agent Studio** beforehand to streamline the process. Please follow our [**Salesforce Connector Guide**](https://developer.moveworks.com/marketplace/package/?id=salesforce&hist=home%2Cbrws#how-to-implement) for detailed instructions. Once completed, proceed to install the plugin and complete the setup efficiently. -# **API Research** +For this plugin, ensure the Salesforce integration user has the following permissions: -To efficiently implement the use case for updating the **Opportunity Stage**, we utilize a single API along with the [**Salesforce Lookup Opportunity**](https://developer.moveworks.com/creator-studio/resources/plugin?id=salesforce-opportunity-information) plugin. +- `Read` access to the **Account** object +- `Read` and `Update` access to the **Opportunity** object -![image.png](image.png) +After configuring the connector, refer to our **[plugin installation documentation](https://help.moveworks.com/docs/ai-agent-marketplace-installation)** for more details on completing the setup! -## **API #1: Update Stage of Opportunity using Opportunity ID** +# **Appendix** -The Update Stage of Opportunity API allows you to update the stage of an existing Opportunity in Salesforce using the retrieved Opportunity ID. This API is designed to effectively manage and transition Opportunities, ensuring that their stages are accurately updated. +## API #1: Update_Opportunity_Details -- **Purpose**: Updates the stage of an Opportunity in salesforce -- **Features**: accurate updates to Opportunity stages -- **Example**: Utilizes the Opportunity ID to update the stage of an Opportunity in Salesforce, +The **Update_Opportunity_Details** API updates the stage of an opportunity associated with an account. ```bash -curl --location --request PATCH 'https://.my.salesforce.com/services/data/v63.0/sobjects/Opportunity/' \--data '{ - "StageName": "" -} +curl --request PATCH +--location 'https:///services/data/v63.0/sobjects/Opportunity/' \ +--header 'Authorization: Bearer ' \ +--header 'Content-Type: application/json' \ +--data '{ + "StageName": "{{STAGE_NAME}}", + "Name": "{{NAME}}", + "CloseDate": "{{CLOSE_DATE}}", + "Discount__c": "{{DISCOUNT}}", + "MRR__c": "{{MRR}}" +}' ``` -- ****: Your Salesforce instance domain (e.g., yourcompany.my.salesforce.com). -- **** : Retrieved opportunity id. -- **** : Predefined Opportunity Stage Name in Salesforce to be updated. - -# **Steps** - -## **Step 1: Build HTTP Action** - - Define your HTTP Actions for fetching all the backlog ideas of a specific project : - -### **1.** **Update Stage of Opportunity using Opportunity ID** - -- In Creator Studio, create a new Action. - - Navigate to plugin section > Actions tab - - Click on CREATE to define a new action - - ![m1.png](m1.png) - -- Click on the IMPORT CURL  option and paste the following cURL command: - - ```bash - curl --location --request PATCH 'https://.my.salesforce.com/services/data/v63.0/sobjects/Opportunity/' \ - --header 'Authorization: Bearer ' \ - --header 'Content-Type: application/json' \ - --data '{ - "StageName": "" - }' - ``` - -- Click on Use Existing Connector > select the Salesforce [](https://developer.moveworks.com/creator-studio/resources/connector/?id=jira)connector that you just created > Click on Apply. This will populate the Base URL and the Authorization section of the API Editor. -- **Body :** - - **StageName** : Predefined Opportunity Stage Name in Salesforce to be updated. - - ![image.png](image%201.png) - -- **Input Variables** : - - **Opportunity_Id :** Example Value ( **006IU00000kYK6lYAG**) - - **StageName :** Example Value ( **Qualify** ) - - ![image.png](image%202.png) - -- We have provided sample input variables for **Opportunity_Id**, **StageName** Using these input variables, we tested the plugin by making a **PATCH** request to **update stage of Opportunity** in Salesforce. -- After that, you can test the plugin by checking the response. If the stage of an opportunity has been successfully updated, the response will return a **204** status code. 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 - - ![image.png](57fdf40a-f356-4ad0-9438-11e3fce13c93.png) - - -## **Step 2: Build Compound Action** - -- Head over to the **Compound Actions** tab and click **CREATE** - - ![m2.png](m2.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: Update_Opportunity_Details_result - action_name: Update_Opportunity_Details - progress_updates: - on_complete: Updated Opportunity stage - on_pending: Updating Opportunity stage - input_args: - StageName: data.StageName - Opportunity_Id: data.opportunity.records[0].Id - - return: - output_mapper: - Updated_StageName: data.Update_Opportunity_Details_result.records[0].StageName - - ``` - -- 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](a4befcf7-370e-4234-a4e4-8e83b1102c18.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](image%205.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](image%206.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!** - -You've just added the **"Update Stage of Opportunity"** feature inside your Salesforce account to your Copilot! Explore our other guides for more inspiration on what to build next. +**Path Parameters :** + +- `OPPORTUNITY_ID` (string) – The email address of the user whose worker id and timezone want to retrieve. + +**Request Body Fields:** + +- `STAGE_NAME` (string) – The current stage of the opportunity. +- `NAME` (string) – The name of the opportunity. +- `CLOSE_DATE` (string) – The expected close date of the opportunity +- `DISCOUNT` (string) – The discount percentage applied to the opportunity. +- `MRR` (string) – The Monthly Recurring Revenue associated with the opportunity. \ No newline at end of file diff --git a/plugins/salesforce-update-opportunity-stage/a4befcf7-370e-4234-a4e4-8e83b1102c18.png b/plugins/salesforce-update-opportunity-stage/a4befcf7-370e-4234-a4e4-8e83b1102c18.png deleted file mode 100644 index d9e3eb13..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/a4befcf7-370e-4234-a4e4-8e83b1102c18.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 1.png b/plugins/salesforce-update-opportunity-stage/image 1.png deleted file mode 100644 index 54ed93ab..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 1.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 2.png b/plugins/salesforce-update-opportunity-stage/image 2.png deleted file mode 100644 index c6cd1f85..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 2.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 3.png b/plugins/salesforce-update-opportunity-stage/image 3.png deleted file mode 100644 index 4a42a963..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 3.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 4.png b/plugins/salesforce-update-opportunity-stage/image 4.png deleted file mode 100644 index 3b44b20e..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 4.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 5.png b/plugins/salesforce-update-opportunity-stage/image 5.png deleted file mode 100644 index 0308857a..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 5.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image 6.png b/plugins/salesforce-update-opportunity-stage/image 6.png deleted file mode 100644 index 1d180070..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image 6.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/image.png b/plugins/salesforce-update-opportunity-stage/image.png deleted file mode 100644 index 9c15ea1d..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/image.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/m1.png b/plugins/salesforce-update-opportunity-stage/m1.png deleted file mode 100644 index 1b28937a..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/m1.png and /dev/null differ diff --git a/plugins/salesforce-update-opportunity-stage/m2.png b/plugins/salesforce-update-opportunity-stage/m2.png deleted file mode 100644 index cca7262e..00000000 Binary files a/plugins/salesforce-update-opportunity-stage/m2.png and /dev/null differ