Skip to content

Commit

Permalink
Merge pull request #85 from tsalb/soql-datatable-add-current-user
Browse files Browse the repository at this point in the history
Fix for #84 by adding CurrentUserId bind variable
  • Loading branch information
tsalb authored May 7, 2021
2 parents 8eba897 + aa82bde commit fee0339
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils-core/main/default/lwc/soqlDatatable/soqlDatatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import { LightningElement, api, wire } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import { getRecord } from 'lightning/uiRecordApi';
import Id from '@salesforce/user/Id';
import * as tableService from 'c/tableService';
import { generateUUID } from 'c/utils';

Expand Down Expand Up @@ -264,6 +265,9 @@ export default class SoqlDatatable extends LightningElement {
if (this.queryString.includes('$recordId')) {
this.queryString = this.queryString.replace(/\$recordId/g, `'${this.recordId}'`);
}
if (this.queryString.includes('$CurrentUserId')) {
this.queryString = this.queryString.replace(/\$CurrentUserId/g, `'${Id}'`);
}
// Backwards compat, this needs to go second since syntax above is preferred
if (this.queryString.includes('recordId')) {
this.queryString = this.queryString.replace(/recordId/g, `'${this.recordId}'`);
Expand Down

0 comments on commit fee0339

Please sign in to comment.