Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsc flow radio button group #1342

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions flow_screen_components/fsc_flowRadioButtonGroup/.forceignore
Original file line number Diff line number Diff line change
@@ -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__/**
18 changes: 18 additions & 0 deletions flow_screen_components/fsc_flowRadioButtonGroup/README.md
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"orgName": "andyhaas company",
"edition": "Developer",
"features": []
}
Original file line number Diff line number Diff line change
@@ -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);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<div class="slds-form-element">
<div class="slds-form-element__control">
<!-- Field Level Help -->
<template if:true={fieldLevelHelp}>
<lightning-helptext content={fieldLevelHelp}
></lightning-helptext>
</template>
<template if:true={required}>
<abbr class="slds-required" title="required">*</abbr>
<lightning-radio-group
class="slds-p-top_xxx-small"
name={name}
label={label}
options={options}
value={value}
type={type}
onchange={handleValueChange}
disabled={disabled}
required>
</lightning-radio-group>
</template>
<template if:false={required}>
<lightning-radio-group
class="slds-p-top_xxx-small"
name={name}
label={label}
options={options}
value={value}
type={type}
disabled={disabled}
onchange={handleValueChange}>
</lightning-radio-group>
</template>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -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
}
}));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<isExposed>false</isExposed>
</LightningComponentBundle>
19 changes: 19 additions & 0 deletions flow_screen_components/fsc_flowRadioButtonGroup/sfdx-project.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it intentional to have this Detect and Launch file in this pull request with the radio button stuff?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created new PR #1348

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);

Expand All @@ -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);
}
}
}


})