Skip to content

Commit

Permalink
Merge pull request #1538 from jdayment/master
Browse files Browse the repository at this point in the history
Flow Flex Card Updates
  • Loading branch information
alexed1 authored Jun 16, 2024
2 parents 31fff9f + 9109c54 commit 28883e2
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>61.0</apiVersion>
<status>Active</status>
</ApexClass>
16 changes: 16 additions & 0 deletions flow_action_components/ApprovalChecker/LockCheckerTest.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@isTest
private class LockCheckerTest {
@isTest
static void testIsLocked() {
// Create test data
Account acc = new Account(Name='Test Account');
insert acc;

// Call the method to be tested
List<Boolean> result = LockChecker.isLocked(new List<Id>{acc.Id});

// Perform assertions
System.assertEquals(1, result.size(), 'Result should have only one entry');
System.assertEquals(false, result[0], 'The test account should not be locked');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>61.0</apiVersion>
<status>Active</status>
</ApexClass>
9 changes: 9 additions & 0 deletions flow_action_components/LockChecker/LockChecker.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class LockChecker {
@InvocableMethod (label='Check if a record is locked')
public static List<Boolean> isLocked(List<Id> recordIdToCheck) {
List<Boolean> isLockedList = new List<Boolean>();
for (Id recordId : recordIdToCheck) {
isLockedList.add(system.Approval.isLocked(recordId));
}
return isLockedList;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">

<apiVersion>57.0</apiVersion>
<apiVersion>60.0</apiVersion>

<isExposed>false</isExposed>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@description :
@author : [email protected]
@group :
@last modified on : 08-20-2023
@last modified on : 04-29-2024
@last modified by : Josh Dayment
-->
<template>
Expand All @@ -27,35 +27,50 @@
onvaluechanged={handleFlowComboboxValueChange} required=true>
</c-fsc_flow-combobox>

<c-fsc_flow-combobox name="value" value={inputValues.value.value}
label={inputValues.value.label} onvaluechanged={handleFlowComboboxValueChange} automatic-output-variables={automaticOutputVariables}></c-fsc_flow-combobox>
<c-fsc_flow-combobox name="value" value={inputValues.value.value} label={inputValues.value.label}
onvaluechanged={handleFlowComboboxValueChange}
automatic-output-variables={automaticOutputVariables}></c-fsc_flow-combobox>

<c-fsc_flow-banner banner-color="#4C6E96" banner-label="Component Styling" banner-info={componentStyling}>
</c-fsc_flow-banner>

<c-fsc_flow-combobox name="label" value={inputValues.label.value} label={inputValues.label.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<c-fsc_flow-combobox name="cardHeight" value={inputValues.cardHeight.value} label={inputValues.cardHeight.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<c-fsc_flow-combobox name="cardWidth" value={inputValues.cardWidth.value} label={inputValues.cardWidth.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<c-fsc_flow-banner banner-color="#4C6E96" banner-label="Header Styling" banner-info={headerStyling}>
</c-fsc_flow-banner>

<c-fsc_flow-combobox name="headerStyle" value={inputValues.headerStyle.value} label={inputValues.headerStyle.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<c-fsc_pick-object-and-field-3 field-label={inputValues.headerField.label} field={inputValues.headerField.value}
object-type={inputValues.objectAPIName.value} onfieldselected={handleHeaderFieldNameChange}
hide-object-picklist=true allow-multiselect=false>
</c-fsc_pick-object-and-field-3>

<lightning-combobox label="Apply SLDS class to header field?" options={fieldClassOptions}
onchange={handleHeaderFieldClassChange} value={inputValues.headerFieldClass.value}></lightning-combobox>

<c-fsc_pick-icon name="icons" mode="combobox" oniconselection={handlePickIcon} icon-name={inputValues.icon.value}>
</c-fsc_pick-icon>

<c-fsc_flow-banner banner-color="#4C6E96" banner-label="Card Styling" banner-info={cardStyling}>
</c-fsc_flow-banner>

<c-fsc_flow-combobox name="subheadCSS" value={inputValues.subheadCSS.value} label={inputValues.subheadCSS.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<lightning-combobox label="Show or hide field labels?" options={fieldVariants} onchange={handleFieldVariantChange}
value={inputValues.fieldVariant.value}></lightning-combobox>

<lightning-combobox label="Apply SLDS class to field values?" options={fieldClassOptions}
onchange={handleFieldClassChange} value={inputValues.fieldClass.value}></lightning-combobox>

<c-fsc_flow-combobox name="label" value={inputValues.label.value} label={inputValues.label.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>

<c-fsc_pick-icon name="icons" mode="combobox" oniconselection={handlePickIcon} icon-name={inputValues.icon.value}>
</c-fsc_pick-icon>
<lightning-combobox label="Show or hide field labels?" options={fieldVariants} onchange={handleFieldVariantChange}
value={inputValues.fieldVariant.value}></lightning-combobox>

<c-fsc_flow-banner banner-color="#4C6E96" banner-label="Flex Card Actions" banner-info={flexCardActions}>
</c-fsc_flow-banner>
Expand All @@ -66,7 +81,6 @@
<c-fsc_flow-combobox name="buttonLabel" value={inputValues.buttonLabel.value} label={inputValues.buttonLabel.label}
builder-context-filter-type="String" onvaluechanged={handleFlowComboboxValueChange}></c-fsc_flow-combobox>


<c-fsc_flow-picker-3 label={inputValues.flows.label} show-active-flows-only onflowselect={handleFlowSelect}>
</c-fsc_flow-picker-3>
<template for:each={inputValues.flows.value} for:item="flow" for:index="index">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : Josh Dayment
* @group :
* @last modified on : 05-31-2023
* @last modified on : 04-29-2024
* @last modified by : Josh Dayment
**/
import { api, track, LightningElement } from 'lwc';
Expand Down Expand Up @@ -54,10 +54,26 @@ export default class fsc_flexcardCPE extends LightningElement {

];
componentStyling = [
{ label: 'Card Size', helpText: 'Size in pixels default is 300px' },
{ label: 'Component Label', helpText: 'Label for the entire component does support rich text' },
{ label: 'Card Width', helpText: 'Size in pixels default is 300px' },
{ label: 'Card Height', helpText: 'Size in pixels default is 300px' },

];

headerStyling = [
{ label: 'Header Field', helpText: 'Choose the field name to populate in the card header' },
{ label: 'Style attribute for the card headers', helpText: 'Standard HTML syling to apply to the card headers' },
{ label: 'Pick an Icon', helpText: 'When an Icon is selected it will apply it before the name in the card header' },
{ label: 'Apply SLDS class to header field?', helptText: 'Select SLDS class to apply to header text' },
];

cardStyling = [
{ label: 'Style attribute for the card body', helpText: 'Standard HTML syling to apply to the card body' },
{ label: 'Apply SLDS class to field values?', helptText: 'Select SLDS class to apply to field values' },
{ label: 'Show or hide field labels?', helptText: 'Decide if you want to show the field labels or just the values' },

];

flexCardActions = [
{ label: 'List or Menu', helpText: 'Menu will display that action in a dropdown list, list will display the action as a list on the card' },
{ label: 'Actons Menu Label', helpText: 'When there is a text string here it either adds a label to the menu button or if list it will add a label with an h1 tag' },
Expand Down Expand Up @@ -90,6 +106,8 @@ export default class fsc_flexcardCPE extends LightningElement {
cardWidth: { value: null, valueDataType: null, isCollection: false, label: 'Card Width', helpText: 'This is the width of the card in Pixels' },
fieldVariant: { value: null, valueDatatType: null, isCollection: false, label: 'Field Variant' },
fieldClass: { value: null, valueDataType: null, isCollection: false, label: 'Field Class' },
headerField: { value: null, valueDataType: null, isCollection: false, label: 'Header Field' },
headerFieldClass: { value: null, valueDataType: null, isCollection: false, label: 'Header Field Class' },
};

@api get builderContext() {
Expand Down Expand Up @@ -175,7 +193,7 @@ export default class fsc_flexcardCPE extends LightningElement {

get fieldClassOptions() {
return [
{ label: '--None--', value:''},
{ label: '--None--', value: '' },
{ label: 'Body Small', value: 'slds-text-body_small' },
{ label: 'Heading Large', value: 'slds-text-heading_large' },
{ label: 'Heading Medium', value: 'slds-text-heading_medium' },
Expand Down Expand Up @@ -370,10 +388,18 @@ export default class fsc_flexcardCPE extends LightningElement {
this.dispatchFlowValueChangeEvent('fieldClass', event.detail.value, 'String')
}

handleHeaderFieldClassChange(event) {
this.dispatchFlowValueChangeEvent('headerFieldClass', event.detail.value, 'String')
}

handleAllowAllObjects(event) {
this.dispatchFlowValueChangeEvent('allowAllObjects', event.detail.value, 'String');
}

handleHeaderFieldNameChange(event) {
this.dispatchFlowValueChangeEvent('headerField', event.detail.value, 'String');
}

get isMenu() {
let displayType = this.inputValues.actionDisplayType.value
if (displayType == 'menu')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>58.0</apiVersion>
<apiVersion>60.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Flow Flex Card CPE</masterLabel>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@description :
@author : [email protected]
@group :
@last modified on : 01-03-2024
@last modified on : 04-29-2024
@last modified by : Josh Dayment
-->
<template>
Expand Down Expand Up @@ -31,7 +31,15 @@
<template lwc:if={showIcon}>
<lightning-avatar src={record.src_URL__c} fallback-icon-name={icon}
class="slds-m-right_small"></lightning-avatar>
</template>{record.Name}
</template>

<lightning-record-view-form object-api-name={objectAPIName} record-id={record.Id}>

<lightning-output-field field-name={headerField} variant=label-hidden
field-class={headerFieldClass}>
</lightning-output-field>

</lightning-record-view-form>

</header>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : Josh Dayment
* @group :
* @last modified on : 01-03-2024
* @last modified on : 04-29-2024
* @last modified by : Josh Dayment
**/
import { LightningElement, api, track, wire } from 'lwc';
Expand Down Expand Up @@ -107,6 +107,8 @@ export default class FlexcardFlow extends LightningElement {
@api cardWidth = 300;
@api fieldVariant;
@api fieldClass;
@api headerField = 'Name';
@api headerFieldClass = 'slds-text-heading_small';


curRecord;
Expand All @@ -121,6 +123,7 @@ export default class FlexcardFlow extends LightningElement {
renderedCallback() {
if (this.value != null && !this.allowMultiSelect && this.isClickable) {
this.template.querySelector('[data-id="' + this.value + '"]').checked = true;

}
}

Expand All @@ -131,6 +134,10 @@ export default class FlexcardFlow extends LightningElement {
}
//console.log('records are: ' + JSON.stringify(this.records));
this.recs = JSON.parse(JSON.stringify(this.records));





}

Expand All @@ -140,7 +147,6 @@ export default class FlexcardFlow extends LightningElement {

this.recs = JSON.parse(JSON.stringify(this._records));


}

retrieveFieldLabels(item, index) {
Expand Down Expand Up @@ -215,4 +221,5 @@ export default class FlexcardFlow extends LightningElement {
}
}


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<apiVersion>60.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Flow Flex Cards</masterLabel>
<targets>
<target>lightning__FlowScreen</target>
</targets>
Expand Down Expand Up @@ -66,6 +67,8 @@
<property name="cardWidth" type="String" role="inputOnly" />
<property name="fieldVariant" type="String" role="inputOnly" />
<property name="fieldClass" type="String" role="inputOnly" />
<property name="headerField" type="String" role="inputOnly" />
<property name="headerFieldClass" type="String" role="inputOnly" />
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* @description :
* @author : Josh Dayment
* @group :
* @last modified on : 05-31-2023
* @last modified on : 04-29-2024
* @last modified by : Josh Dayment
**/
import { LightningElement, api } from 'lwc';
import LightningModal from 'lightning/modal';
import { notifyRecordUpdateAvailable } from 'lightning/uiRecordApi'; // Added by Brian Paul

export default class fsc_modalFlow extends LightningModal {
@api flowNameToInvoke;
Expand All @@ -16,7 +17,11 @@ export default class fsc_modalFlow extends LightningModal {

handleOpenModal(event){
if(event.detail.status === 'FINISHED' || event.detail.status === 'FINISHED_SCREEN'){
const recordId = this.flowParams[0]?.value;
if(recordId) {
notifyRecordUpdateAvailable([{recordId: recordId}])
} // Add by Brian Paul
this.close('modal closed, flow status is ' + event.detail.status);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<apiVersion>60.0</apiVersion>
<isExposed>true</isExposed>
</LightningComponentBundle>
</LightningComponentBundle>

0 comments on commit 28883e2

Please sign in to comment.