From 0daf3cce2fef81e42a2ad5e8144bc166c04322b4 Mon Sep 17 00:00:00 2001 From: Andy Haas Date: Tue, 7 Feb 2023 15:52:53 -0600 Subject: [PATCH 1/2] changed how helper class was deciding to launch flow or not. Some flows got launched even tho they were not being set. Also moved Loaded to its own else if statment and made seperate class to call the flow to have unified code between loaded and changed events. --- .../detectAndLaunch/detectAndLaunchHelper.js | 88 +++++++++++-------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/lightning_page_components/DetectAndLaunch/force-app/main/default/aura/detectAndLaunch/detectAndLaunchHelper.js b/lightning_page_components/DetectAndLaunch/force-app/main/default/aura/detectAndLaunch/detectAndLaunchHelper.js index 9b753a12f..7143b6ff1 100755 --- a/lightning_page_components/DetectAndLaunch/force-app/main/default/aura/detectAndLaunch/detectAndLaunchHelper.js +++ b/lightning_page_components/DetectAndLaunch/force-app/main/default/aura/detectAndLaunch/detectAndLaunchHelper.js @@ -1,8 +1,28 @@ ({ processChangeEvent : function(component, eventParams) { console.log('entering processChangeEvent'); - if(eventParams.changeType === "CHANGED" || eventParams.changeType === "LOADED") { + if(eventParams.changeType === "CHANGED") { console.log ('changeType is: ' + eventParams.changeType); + this.callFlow(component, eventParams); + } else if(eventParams.changeType === "REMOVED") { + console.log('record is being deleted'); + //the other launch paths don't work well when the underlying page is deleted + var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable + console.log('targetURL is: ' + targetUrl); + window.open(targetUrl); + } else if(eventParams.changeType === "LOADED") { + console.log ('changeType is: ' + eventParams.changeType); + this.callFlow(component, eventParams); + } + }, + + callFlow : function(component, eventParams) { + console.log('entering callFlow'); + console.log ('changeType is: ' + eventParams.changeType); + var flowApiName = component.get("v.targetFlowName"); + if (flowApiName == null || flowApiName == undefined) { + console.log('flowApiName is null or undefined'); + } else { if(component.get("v.launchMode") == 'Modal') { component.set('v.openModal',true); @@ -16,49 +36,43 @@ ]; var flow = component.find("flow"); - flow.startFlow(component.get("v.targetFlowName"), inputVariable); //added input variable + // Check to see if flow is not null before calling startFlow + if (flowApiName != null && flowApiName != undefined) { + console.log('flow is not null', flowApiName); + flow.startFlow(flowApiName, inputVariable); //added input variable + } else { + console.log('flow is null', flow); + } } else { //launch modelessly in a tab or browser window var workspaceAPI = component.find("workspace"); workspaceAPI.isConsoleNavigation().then(function(response) { - console.log('current workspace is console? : ' + response); - if (response) { - //we are in console mode - workspaceAPI.getFocusedTabInfo() - .then(function(response) { - var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable; - workspaceAPI.openSubtab({ - parentTabId: response.tabId, - url: targetUrl, - focus: true + console.log('current workspace is console? : ' + response); + if (response) { + //we are in console mode + workspaceAPI.getFocusedTabInfo() + .then(function(response) { + var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable; + workspaceAPI.openSubtab({ + parentTabId: response.tabId, + url: targetUrl, + focus: true + }) + }) - - }) - .catch(function(error) { - console.log(error); - }); - } else { - console.log('need to launch flow a different way'); - var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable; - console.log('targetURL is: ' + targetUrl); - window.open(targetUrl); - } - }) + .catch(function(error) { + console.log(error); + }); + } else { + console.log('need to launch flow a different way'); + var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable; + console.log('targetURL is: ' + targetUrl); + window.open(targetUrl); + } + }) } - - - - - } - else if(eventParams.changeType === "REMOVED") { - console.log('record is being deleted'); - //the other launch paths don't work well when the underlying page is deleted - var targetUrl = '/flow/' + component.get("v.targetFlowName") + '?recordId=' + component.get("v.recordId"); //added input variable - console.log('targetURL is: ' + targetUrl); - window.open(targetUrl); - } + } } - }) From 2e82258e83f4b5db6677fffca0e9dfe836394702 Mon Sep 17 00:00:00 2001 From: Andy Haas Date: Tue, 7 Feb 2023 18:06:35 -0600 Subject: [PATCH 2/2] New Component for CPE development to change Checkboxes into Buttons --- .../fsc_flowRadioButtonGroup/.forceignore | 15 ++++++++ .../fsc_flowRadioButtonGroup/README.md | 18 +++++++++ .../config/project-scratch-def.json | 5 +++ .../fsc_flowRadioButtonGroup.test.js | 25 +++++++++++++ .../fsc_flowRadioGroup.html | 37 +++++++++++++++++++ .../fsc_flowRadioGroup/fsc_flowRadioGroup.js | 20 ++++++++++ .../fsc_flowRadioGroup.js-meta.xml | 5 +++ .../sfdx-project.json | 19 ++++++++++ 8 files changed, 144 insertions(+) create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/.forceignore create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/README.md create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/config/project-scratch-def.json create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/__tests__/fsc_flowRadioButtonGroup.test.js create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.html create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js-meta.xml create mode 100644 flow_screen_components/fsc_flowRadioButtonGroup/sfdx-project.json diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/.forceignore b/flow_screen_components/fsc_flowRadioButtonGroup/.forceignore new file mode 100644 index 000000000..4c0adf5b7 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/.forceignore @@ -0,0 +1,15 @@ +# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status +# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm +# + +package.xml + +# LWC configuration files +**/jsconfig.json +**/.eslintrc.json +./.sfdx +./.sf +./config + +# LWC Jest +**/__tests__/** \ No newline at end of file diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/README.md b/flow_screen_components/fsc_flowRadioButtonGroup/README.md new file mode 100644 index 000000000..afcda4a66 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/README.md @@ -0,0 +1,18 @@ +# Salesforce DX Project: Next Steps + +Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started. + +## How Do You Plan to Deploy Your Changes? + +Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models). + +## Configure Your Salesforce DX Project + +The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file. + +## Read All About It + +- [Salesforce Extensions Documentation](https://developer.salesforce.com/tools/vscode/) +- [Salesforce CLI Setup Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm) +- [Salesforce DX Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro.htm) +- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm) diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/config/project-scratch-def.json b/flow_screen_components/fsc_flowRadioButtonGroup/config/project-scratch-def.json new file mode 100644 index 000000000..08ee94365 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/config/project-scratch-def.json @@ -0,0 +1,5 @@ +{ + "orgName": "andyhaas company", + "edition": "Developer", + "features": [] +} diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/__tests__/fsc_flowRadioButtonGroup.test.js b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/__tests__/fsc_flowRadioButtonGroup.test.js new file mode 100644 index 000000000..a0acbd3dd --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/__tests__/fsc_flowRadioButtonGroup.test.js @@ -0,0 +1,25 @@ +import { createElement } from 'lwc'; +import Fsc_flowRadioButtonGroup from 'c/fsc_flowRadioButtonGroup'; + +describe('c-fsc-flow-radio-button-group', () => { + afterEach(() => { + // The jsdom instance is shared across test cases in a single file so reset the DOM + while (document.body.firstChild) { + document.body.removeChild(document.body.firstChild); + } + }); + + it('TODO: test case generated by CLI command, please fill in test logic', () => { + // Arrange + const element = createElement('c-fsc-flow-radio-button-group', { + is: Fsc_flowRadioButtonGroup + }); + + // Act + document.body.appendChild(element); + + // Assert + // const div = element.shadowRoot.querySelector('div'); + expect(1).toBe(1); + }); +}); \ No newline at end of file diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.html b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.html new file mode 100644 index 000000000..27b9a3b63 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.html @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js new file mode 100644 index 000000000..5d6c5da1a --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js @@ -0,0 +1,20 @@ +import { LightningElement, api } from 'lwc'; + +export default class Fsc_flowRadioGroup extends LightningElement { + @api label; + @api name; + @api options; // [{label: 'Option 1', value: '1'}, {label: 'Option 2', value: '2'}] + @api type; // Radio or Button + @api fieldLevelHelp; + @api disabled; + @api required; + @api value; + + handleValueChange(event) { + this.dispatchEvent(new CustomEvent('valuechange', { + detail: { + newValue: event.target.value + } + })); + } +} \ No newline at end of file diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js-meta.xml b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js-meta.xml new file mode 100644 index 000000000..f8c5cb4a3 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/force-app/main/default/lwc/fsc_flowRadioGroup/fsc_flowRadioGroup.js-meta.xml @@ -0,0 +1,5 @@ + + + 56.0 + false + \ No newline at end of file diff --git a/flow_screen_components/fsc_flowRadioButtonGroup/sfdx-project.json b/flow_screen_components/fsc_flowRadioButtonGroup/sfdx-project.json new file mode 100644 index 000000000..c389bb207 --- /dev/null +++ b/flow_screen_components/fsc_flowRadioButtonGroup/sfdx-project.json @@ -0,0 +1,19 @@ +{ + "packageDirectories": [ + { + "path": "force-app", + "default": true, + "package": "Flow Radio Button Group for CPE", + "versionName": "ver 0.1", + "versionNumber": "0.1.0.NEXT", + "versionDescription": "" + } + ], + "name": "fsc_flowRadioButtonGroup", + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "56.0", + "packageAliases": { + "Flow Radio Button Group for CPE": "0Ho5e000000wkSFCAY" + } +} \ No newline at end of file