You need to sign in to do that
Don't have an account?
Pooja Nekkalapudi
create a new task buttom using row actions in LWC , how to attach the row ID to the WhatID
import { LightningElement, track,api, wire } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CurrentPageReference, NavigationMixin } from 'lightning/navigation';
import { handleMonitoringLog } from 'c/ent_MonitoringLogFacade';
import getColumnNames from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.getColumnNames';
import updateProspects from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.updateProspects';
import getDualListBoxVals from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.getDualListBoxVals';
import removeMeFromTeam from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.removeMeFromTeam';
import { loadScript } from 'lightning/platformResourceLoader';
import jQuery from '@salesforce/resourceUrl/ent_JQuery';
export default class slDatatableWrapper extends NavigationMixin(LightningElement) {
@track data = [];
@track relatedData = [];
@track draftValues = [];
lastSavedData = [];
@track queryColumnsString='';
@track columns;
@track columnsActions=[
{ label: 'Edit Company', name: 'edit' },
{ label: 'Edit Industry, Sector, Sub-Sector', name: 'edit_industry'},
{ label: 'Manage Board Members', name: 'manage_board_members'},
{ label: 'Manage Sponsors', name: 'manage_sponsors'},
{ label: 'Remove Me from Coverage Team', name: 'remove_me'},
{ label: 'New Last Activity', name: 'logcall'}];
-
-
-
-
handleRowActions(event) {
var eventName=event.target.dataset.id;
const actionName = event.detail.action.name;
const row = event.detail.row;
this.prospectId = row.Id;
this.prospectName=row.Name;
switch (actionName) {
case 'edit':
this.isModalOpen=true;
this.showChildTable=false;
this.showEditForm=true;
this.childListHeader='Edit';
this.showDataSpinnerChild=false;
handleMonitoringLog({Action_Taken__c:'Click',Component__c:eventName+'.'+actionName,Status__c:'Success',URL__c:window.location.href,Record_Interacted_With__c:this.prospectId});
break;
case 'manage_board_members':
this.isModalOpen=true;
this.showChildTable=true;
this.childListHeader='Board Member';
this.showDataSpinnerChild=true;
handleMonitoringLog({Action_Taken__c:'Click',Component__c:eventName+'.'+actionName,Status__c:'Success',URL__c:window.location.href,Record_Interacted_With__c:this.prospectId});
break;
-
-
-
-
case 'logcall':
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'task',
actionName: 'new'
}
});
break;
}
}
How to get this row action logcall to pass in the rowID as whatID for new task
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CurrentPageReference, NavigationMixin } from 'lightning/navigation';
import { handleMonitoringLog } from 'c/ent_MonitoringLogFacade';
import getColumnNames from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.getColumnNames';
import updateProspects from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.updateProspects';
import getDualListBoxVals from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.getDualListBoxVals';
import removeMeFromTeam from '@salesforce/apex/PA_My_Prospects_Datatable_Cont.removeMeFromTeam';
import { loadScript } from 'lightning/platformResourceLoader';
import jQuery from '@salesforce/resourceUrl/ent_JQuery';
export default class slDatatableWrapper extends NavigationMixin(LightningElement) {
@track data = [];
@track relatedData = [];
@track draftValues = [];
lastSavedData = [];
@track queryColumnsString='';
@track columns;
@track columnsActions=[
{ label: 'Edit Company', name: 'edit' },
{ label: 'Edit Industry, Sector, Sub-Sector', name: 'edit_industry'},
{ label: 'Manage Board Members', name: 'manage_board_members'},
{ label: 'Manage Sponsors', name: 'manage_sponsors'},
{ label: 'Remove Me from Coverage Team', name: 'remove_me'},
{ label: 'New Last Activity', name: 'logcall'}];
-
-
-
-
handleRowActions(event) {
var eventName=event.target.dataset.id;
const actionName = event.detail.action.name;
const row = event.detail.row;
this.prospectId = row.Id;
this.prospectName=row.Name;
switch (actionName) {
case 'edit':
this.isModalOpen=true;
this.showChildTable=false;
this.showEditForm=true;
this.childListHeader='Edit';
this.showDataSpinnerChild=false;
handleMonitoringLog({Action_Taken__c:'Click',Component__c:eventName+'.'+actionName,Status__c:'Success',URL__c:window.location.href,Record_Interacted_With__c:this.prospectId});
break;
case 'manage_board_members':
this.isModalOpen=true;
this.showChildTable=true;
this.childListHeader='Board Member';
this.showDataSpinnerChild=true;
handleMonitoringLog({Action_Taken__c:'Click',Component__c:eventName+'.'+actionName,Status__c:'Success',URL__c:window.location.href,Record_Interacted_With__c:this.prospectId});
break;
-
-
-
-
case 'logcall':
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'task',
actionName: 'new'
}
});
break;
}
}
How to get this row action logcall to pass in the rowID as whatID for new task
You have the Row which is an SObject record. Take the field on that Sobject that is equal to the task id. You might need to change your Apex method to include the TaskId in your query.