From 508953799b138adfa347ebfdebfd5528cd1ff12c Mon Sep 17 00:00:00 2001 From: theo Date: Wed, 20 Nov 2024 17:07:20 +0100 Subject: [PATCH] Update utils.db() to handle without sharing case --- force-app/main/default/lwc/bolt/utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/lwc/bolt/utils.js b/force-app/main/default/lwc/bolt/utils.js index 0fa4d68..cda931d 100644 --- a/force-app/main/default/lwc/bolt/utils.js +++ b/force-app/main/default/lwc/bolt/utils.js @@ -9,6 +9,7 @@ import { } from "./bolt"; import soqlQuery from '@salesforce/apex/Bolt.soqlQuery'; import soqlQueryWithoutCache from "@salesforce/apex/Bolt.soqlQueryWithoutCache"; +import soqlQueryWithoutSharing from "@salesforce/apex/Bolt.soqlQueryWithoutSharing"; /** * Useful method to pass as an input a custom label formated as an ES6 template literal * like this : Hello ${name} @@ -132,6 +133,7 @@ export const allMxnDone = (self, maybeSuspendedMixins) => const USER_MODE = 'WITH USER_MODE'; const UNCACHED = 'UNCACHED'; +const WITHOUT_SHARING = 'WITHOUT_SHARING'; const ARRAY_TOKEN = '$ARRAY$' /** * @param {string[]} req @@ -173,9 +175,12 @@ export const soql = async (req, ...args ) => { else mode = null; if(query.includes(UNCACHED)){ query = query.replace(UNCACHED, ''); - console.log('DB',query, JSON.stringify(params)) return soqlQueryWithoutCache({query, params: JSON.stringify(params), mode}); } + else if(query.includes(WITHOUT_SHARING)){ + query = query.replace(WITHOUT_SHARING, ''); + return soqlQueryWithoutSharing({query, params: JSON.stringify(params), mode}); + } return soqlQuery({query, params: JSON.stringify(params), mode}); } -export const db = soql; \ No newline at end of file +export const db = soql;