Questions tagged [executioncontext]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
610 views

Which context do Record-Triggered Flows run in?

According to the table in the middle of this Salesforce documentation, record-triggered Flows run in system-context. At the bottom of this unofficial sf documentation, it says record-triggered Flows ...
parkerbbrown's user avatar
0 votes
1 answer
94 views

Getting incorrect value of global attribute set at connectedCallBack inside another method

I am reading a value from localStorage (in connectedCallBack) in an lwc that I have set in another lwc, it reads the value correctly and executes the logic also correctly below, problem is the global ...
Amax1's user avatar
  • 109
2 votes
3 answers
2k views

how to run apex in user context

We have integration between two modules and both are complete custom apex code . Module-1 need to call Module-2 logic via interface class . Is it possible to run module-2 logic in different specific ...
Hemant Kumar reddy's user avatar
2 votes
0 answers
343 views

Is there a special way to grant read access to objects in an Auto-Launched Flow?

Original post: I have created an auto-launched flow that runs as "System Context Without Sharing--Access All Data" and is using apiVersion 50.0. This flow can get records from some objects, ...
Dr.J's user avatar
  • 41
6 votes
0 answers
571 views

System.Quiddity Enum sync vs async

With the new Winter '21 release, salesforce makes it much easier to detect what is a current running context by means of Request.getCurrent().getQuiddity() method. This is great, thank you, ...
Oleksandr Berehovskyi's user avatar
1 vote
1 answer
127 views

Is there a way to know if a setup object has been updated in the current transaction?

We have a custom error logging framework built that currently inserts records to a custom Error Log object. We also have a lot of (chained) Queueables in use because have to update some setup objects -...
LVS's user avatar
  • 1,741
0 votes
1 answer
451 views

Automation Studio SSJS execution context

I have a Script task in Automation Studio that sends a small JSON payload to a rest api. The payload consists of the business unit, the Automation job name, a status and timestamp. My account has ...
Ron Stiffler's user avatar
3 votes
2 answers
1k views

Can I force a unit test to wait for a Sharing Rule to be created?

Ideally, I'd like to write a unit test to help me "dummy check" for unexpected effects of the upcoming guest user sharing setting changes. We'd had some controller/trigger code "gracefully handling" ...
k..'s user avatar
  • 1,197
3 votes
1 answer
229 views

Which user applies to the execution context when executing messaging.sendEmail?

I have a field that is used in an email template for which no FLS is granted in any profiles. The Apex code that sends the email using messaging.sendEmail() is invoked from a trigger so I assume it ...
RobD's user avatar
  • 404
0 votes
1 answer
209 views

Get Operation Context in Apex class

Is it possible to get the way a method is called in Apex? In my case, I need to determine how a trigger fires: if its called from a external API (jsForce) or if a user deletes a record through the ...
MMeadows's user avatar
  • 501
9 votes
3 answers
4k views

Queuable Apex logic in Constructor or Execute Method

I have a chained queuable apex class making an HTTP request to an external server. After each request comes back with a successful response, the next class will fire and make another request to a ...
MMeadows's user avatar
  • 501
9 votes
2 answers
2k views

Can someone clarify when a Trigger executes on a single record vs. multiple in one context?

This may be a silly question, but I've been surprised by Salesforce enough to potentially look foolish for confirmation! Apologies, the question itself was difficult to phrase. Fundamentally, since a ...
Natalie Paige's user avatar
4 votes
2 answers
577 views

Is it possible for Apex code to determine whether it is with or without sharing?

As an author of the code, I can, of course, know if the context is with or without sharing when I write my code into a class with either of these keywords. But what if I am writing my code into a ...
Brian Kessler's user avatar
1 vote
2 answers
1k views

Can I get end of execution context

I have a simple Logger class with a static list of log objects and two methods. One method adds logs to the static list and the other method inserts the list. Right now I am manually calling the save ...
Jordan Lee's user avatar
0 votes
1 answer
72 views

Salesforce execution flow

i read the steps of execution flow in saleaforce but i am new to salesforce so have confusion at some points. If I have inserted batch of records and i have a after trigger on the same object, which ...
user59223's user avatar
2 votes
0 answers
1k views

Workflow needs to run as specific user or profile for field update to work

I have create a form on a Customer Community where users submit records and in turn a time-based workflow is created to change the value of a field on that new record at a certain time. In turn, a ...
Swisher Sweet's user avatar
0 votes
4 answers
1k views

Which users context will SOAP apex class execute in?

I have a SOAP apex class which exposes some webservice methods to be calls from my applications backend. This code has some DateTime methods that return the values based on context user's timezone ...
Yogesh D's user avatar
  • 580
0 votes
1 answer
1k views

Apex execution context and DateTime class

I have a code which does this, Datetime dt = Datetime.NOW(); String starttime = dt.hour(); Now from the apex documentation, now() returns the current datetime based on GMT and hour() returns the ...
Yogesh D's user avatar
  • 580
-2 votes
1 answer
620 views

What is the execution time spent in the database for an DML or SOQL or SOSL?

Is it possible to find the execution time for a DML or SOQL or SOSL? What are the factors on which the execution time of these queries depend?
Peush Prasannan's user avatar
0 votes
1 answer
25 views

Can't Code Recursive-ish Single-Object Business Requirement -- is it me or the requirement?

Given this background: Firstly, a workflow or something on Contact is already in place that updates Contact.High_School_Lookup__c when a user saves a change to the value of Contact....
k..'s user avatar
  • 1,197
0 votes
1 answer
168 views

Execution Context Variable Scope In The Tidy Trigger Pattern

I've read through Nuances of Working with Tidy Trigger Pattern, but I'm still struggling to understand something: For what portion of the life of the "execution context" does an attribute of the ...
k..'s user avatar
  • 1,197
2 votes
1 answer
490 views

Does a lightning component action calling apex always get a distinct execution context?

The documentation on server-side queuing does not explicitly state whether each action gets its own execution context. Neither do the docs on Apex Transaction. The Trailhead on execution context sides ...
Christian Szandor Knapp's user avatar
22 votes
1 answer
985 views

Why use Platform Events in standalone native apps?

In Summer '17 Salesforce released Platform Events - a native messaging system accessible via Apex and several APIs. I assume the main use case for such a feature is to allow integration of Salesforce ...
Robert Sösemann's user avatar
2 votes
1 answer
780 views

Queuable Apex - chaining jobs vs calling other classes synchronously

I'm learning Queueable apex and want to make sure I understand what the benefit of chaining jobs is, as opposed to simply calling other class methods within the method synchronously. Here's my ...
Lachlan B's user avatar
  • 313
6 votes
0 answers
704 views

Can we detect context inside a Lightning Component which has implemented 'force:lightningQuickAction' interface?

While working on a Lightning Component that can be invoked inside a Lightning Record Home Page as well as Quick Actions. But I need to present different User interface in both context of the component....
VarunC's user avatar
  • 5,940
24 votes
4 answers
14k views

Dynamically Determine Calling Context?

We have various ways of invoking apex. Triggers, Inbound Webservices, @InvocableMethod,@RemoteAction and what not. Often we call some or other utility methods from these execution contexts. I have ...
Pranay Jaiswal's user avatar
1 vote
3 answers
636 views

How are records batched from Time-Based Workflow updates

Wonder how Salesforce handles batching records in relation to execution context. For example, if I have a static variable that tracks the records being processed by a trigger: trigger MyTrigger on ...
NSjonas's user avatar
  • 10.1k
1 vote
0 answers
175 views

Past due Time-based workflow with criteria set from other workflows

I have a very unique condition happening during a time based workflow that is causing some unexpected behavior. I am curious to know if anyone has had a similar experience and if I am correct in ...
Chris's user avatar
  • 1,675
4 votes
2 answers
89 views

Is "System.QueryException: non-selective query" Only Thrown From Triggers

Is it true that "System.QueryException: non-selective query" is only ever thrown from a trigger? If so, where is this documented and what happens when an identical query (one that throws "System....
Grokodile's user avatar
  • 673
2 votes
1 answer
39 views

Number of Execution Contexts during Callouts

I am trying to understand how execution context works with respect to callouts. Use case : Whenever an Account's status is updated to "Ready for Integration", a REST callout will happen towards an ...
Varun's user avatar
  • 3,093
11 votes
2 answers
3k views

In Apex, what is the difference between the "execution context" and a transaction?

What are the boundaries of the execution context? What are the boundaries of a transaction?
the_rj's user avatar
  • 155
4 votes
1 answer
24k views

Update same record in after insert/update in a trigger context

I searched a bit for some informations about the need to make an update on a record in after insert/update trigger context. I found that the common feedback was to move the Business logic in before ...
Klodj_Meta's user avatar
4 votes
1 answer
255 views

Using sObject variables in Execution Context

I started learning about Execution Context and I got this question: Let's say I have a static sObject variable in the beginning of my Execution Context filled by a select. In the middle of the ...
Airton Gessner's user avatar
7 votes
3 answers
3k views

Can future execution start before the synchronous execution is completed

Is there a way for @future annotated method to start execution before the synchronous request which invokes it has completed. In other words, do I have some guarantees that the timing will look like ...
ipavlic's user avatar
  • 3,694
3 votes
1 answer
1k views

How can I create over 10,000 records with information from Visualforce?

I have an inventory input page that I am working on and I am running into an issue where I need to create more than 10k records. The problem here is that all the information needed is not stored in an ...
Chris's user avatar
  • 1,675
1 vote
1 answer
66 views

What are the tradeoffs of rendering partial Visualforce content in an iframe?

I have a Visualforce page whose controller extension is calling a class to make a web service callout and displaying some data on the page. I'm in the process of optimizing the Apex and page away from ...
Brian Mansfield's user avatar
0 votes
2 answers
42 views

Winter 15 - Validation Rule

I have the following validation rule for a Custom Object: AND(ISPICKVAL( transp__SFT_Trip__r.transp__SFT_Status__c, "Encerrada") , $Profile.Name != "Administrador do sistema") It only let the admin ...
Airton Gessner's user avatar
0 votes
2 answers
170 views

SOQL returns outdated records in Visualforce PDF

I appear to have a very weird error. I have a business case where I have a button on an opportunity which generates 2 records (related to that opportunity via master-detail). After those records were ...
pjcarly's user avatar
  • 7,451
5 votes
1 answer
1k views

Are static variables reset per batch during bulk DML operation? (Executing triggers for field updates)

A while back I had a trigger issue where I needed a trigger operation to execute exclusively on the second update or an update after an insert. So I had some code like this: Trigger Handler Class ...
Programmable Medley's user avatar
5 votes
2 answers
1k views

Is there a way to know what operation invoked a Trigger in the Trigger code?

I want to execute different logic in an update Trigger, depending on whether the Trigger was invoked by an operation through: a Visualforce page vs. others like standard Page Layout external ...
Intigris's user avatar
  • 336
6 votes
1 answer
171 views

Is DML allowed in the current context?

So I can check for isbatch, isfuture, etc... Is there a way to know if the current context allows DML? We've implemented a exception logging object, but if a class is called from a getter or ...
Shane McLaughlin's user avatar