Questions tagged [executioncontext]
The executioncontext tag has no usage guidance.
39
questions
2
votes
3
answers
984
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 ...
2
votes
0
answers
240
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, ...
6
votes
0
answers
379
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, ...
1
vote
1
answer
96
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 -...
0
votes
1
answer
364
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 ...
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" ...
3
votes
1
answer
137
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 ...
0
votes
1
answer
148
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 ...
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 ...
8
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 ...
3
votes
2
answers
429
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 ...
1
vote
2
answers
912
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 ...
0
votes
1
answer
56
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 ...
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 ...
0
votes
4
answers
840
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 ...
0
votes
1
answer
941
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 ...
-2
votes
1
answer
565
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?
0
votes
1
answer
24
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....
0
votes
1
answer
151
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 ...
2
votes
1
answer
467
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 ...
22
votes
1
answer
969
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 ...
2
votes
1
answer
645
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 ...
5
votes
0
answers
578
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....
24
votes
4
answers
12k
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 ...
1
vote
3
answers
594
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 ...
1
vote
0
answers
173
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 ...
4
votes
2
answers
87
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....
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 ...
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?
4
votes
1
answer
23k
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 ...
4
votes
1
answer
236
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 ...
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 ...
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 ...
1
vote
1
answer
64
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 ...
0
votes
2
answers
38
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 ...
0
votes
2
answers
167
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 ...
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
...
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 ...
6
votes
1
answer
168
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 ...