My_Test_Repo/force-app/main/default/lwc/customFooterFlowComponent/customFooterFlowComponent.js

37 lines
1.5 KiB
JavaScript

import { LightningElement, api } from 'lwc';
import { FlowAttributeChangeEvent, FlowNavigationBackEvent, FlowNavigationNextEvent} from 'lightning/flowSupport';
/*FlowAttributeChangeEvent — Informs the runtime that a component property has changed.
FlowNavigationBackEvent — Requests navigation to the previous screen.
FlowNavigationNextEvent — Requests navigation to the next screen.
FlowNavigationFinishEvent — Requests the flow runtime to terminate the flow.*/
export default class CustomFooterFlowComponent extends LightningElement {
@api btnName;
handleSaveData(event){
if(event.target.name === 'Save as Draft'){
this.btnName = event.target.name;
console.log('btn name: ',this.btnName);
const attributeChangeEvent = new FlowAttributeChangeEvent('btnName', this.btnName);
this.dispatchEvent(attributeChangeEvent);
}
else if(event.target.name === 'Send Checklists'){
this.btnName = event.target.name;
console.log('btn name: ',this.btnName);
const attributeChangeEvent = new FlowAttributeChangeEvent('btnName', this.btnName);
this.dispatchEvent(attributeChangeEvent);
}
const navigateNextEvent = new FlowNavigationNextEvent();
this.dispatchEvent(navigateNextEvent);
}
handleGoBack(){
// navigate to the back screen
const navigateBackEvent = new FlowNavigationBackEvent();
this.dispatchEvent(navigateBackEvent);
}
}