+ Start a Discussion
Haseeb Ahmad 9Haseeb Ahmad 9 

Help on Lightning action button

Hello everyone. 

I need your help/guidance for looking at the lightning action button as I am not able to figure out why the lightning action button not working when I click on options and I get this message but nothing happened.
User-added imageHere is the code in .HTML file inside lwc
    <!-- <div class="slds-text-heading_small">If your profile is either Solutions engineer, Professional Services or System Administrator
            you will have the option to create a Word or PDF SOW. If not the SOW will be saved as PDF.</div> -->
            <lightning-button variant="brand" label="Create PDF SOW" title="PDF SOW" onclick={createPdf} class="slds-var-m-left_x-small"></lightning-button>
    <template if:true={showSecondButton}>
        <lightning-button variant="brand" label="Create Doc SOW" title="PDF SOW" onclick={createDoc} class="slds-var-m-left_x-small"></lightning-button>
    <template if:true={error}>
            The following error has occured. {error}
            Please report error to salesops.
    <template if:true={results}>
           Results :{results}. please click the close button at the bottom of this dialog.

Here is the code I have in .JS file inside lwc
import { LightningElement, api, track } from 'lwc';
import getCurrentUserProfileName from '@salesforce/apex/LightningUtils.getCurrentUserProfileName';
import generateSOW from '@salesforce/apex/ZuoraDocumentGenerator.generateSOW';
export default class QuickActionDocGen extends LightningElement {
    @api recordId;
    @track showSecondButton = false;
    @api profileName;
    @api error;
    @api results;
    connectedCallback() {
            .then(result => {
                this.profileName = result;
                console.log('User Profile : ', result);
                // All the logic that we will use to show one or two buttons
                const profilesWithSecondButton = ['Solution Engineer','Professional Services','System Administrator'];
                this.showSecondButton = profilesWithSecondButton.includes(result);

            .catch(error => {
                console.warn('Error Getting User Profile', error);

    createPdf () {
        this.results = generateSOW(this.recordId, 'PDF'); // calling apex method with record id and pdf
    createDoc () {
        this.results = generateSOW(this.recordId, 'DOC'); // calling apex method with record id and Doc

Can Anyone please help me with this? thank you.