Updates .forceignore to exclude more metadata types like settings, fieldsets, profiles, reports, and dashboards. Updates the API version to 63.0 for Apex classes, LWC, and the SFDX project. Also updates the project scratch definition to remove AuthorApex.
3.1 KiB
3.1 KiB
Smart Clone - Opportunity Cloner
The purpose of the Smart Clone is to provide the user with the functionality to clone an opportunity, but with added benefits.
- The ability to select only fields that need to be edited during the cloning
- The ability to select fields that must be cleared of their original value
- The ability to clone other child objects than just Opportunity Products
The Project consists of the following components:
| Item | Description |
|---|---|
| OpportunityCloneService | Apex class that contains the Apex functionality |
| OpporutnityCloneserviceTest | Code coverage and unit test class |
| TestCloneUtility | Utilities used in the Code coverage and unit test class |
| SmartCloneChildList custom label | Custom Label used as a setting to store semi-colon separated list of child objects to select from |
| opportunityCustomClone | Lightning web component that is the visual interface |
| OppCustomCloneAura | Aura Lightning Component that is used to wire to a QuickAction |
| Opportunity.SmartClone QuickAction | The QuickAction button to use on the Opportunity Detail Layout |
| Opportunity.ClonedFields fieldset | the fieldet used to configure displayable and cleared fields for input |
Additional Notes
- This application currently will not support the cloning of a hierarchy of children. This means it is only designed to support the cloning of direct children to the Opportunity, and the Opportunity itself
- This application will not support RecordType as a field to be edited/updated during the clone.
Setup
- Setup List of Opportunity Fields to include in the Cloning process.
- Create a Fieldset named 'ClonedFields'. This fieldset will need to contain the fields to clone on the Opportunity.
- Place fields that need to be cloned in the 'ClonedFields' fieldset
- Create Action for SmartClone
- Navigate to the Opportunity Object and click on 'Buttons, Links, and Actions'. Click the 'New Action' button.
- Action Type: 'Lightning Web Component', Lightning Web Component:'c:opportunityCustomClone', Label: Your Choice, Name:Your Choice
- Save Action Button
- Navigate to the proper layout and place the Action Button on the Layout.
Prerequisites
- You need to have the Salesforce CLI installed on your system to follow the install directions.
Installed Steps
- Clone this repository to your local filesystem.
- Navigate to the directory created from the clone.
- Create a 'build' folder in the directory of this cloned repository
- Convert the project into deployable Metadata API format using the following command
sf project convert source --root-dir ./force-app/main/default -d ./build/unpackaged/ - Zip the 'unpackaged' directory located in the 'build' folder.
- Deploy the zip file into your instance using the following command
sf project deploy start --target-org <yourinstancealias> --metadata-dir ./build/unpackaged.zip --wait 30 --verbose- Optionally, you can use the
--test-level RunLocalTestsoption if installing into a production instance separately.
- Optionally, you can use the
- Once the deployment completes successfully, the components will be installed in your instance.