Questions tagged [system]
The system tag has no summary.
40 questions
0 votes
0 answers
59 views
What is wrong with System.runAs in Test Class?
I am doing some test class wherein I have to use the System.runAs(userA) to update the record. The assert method that is checking the updated field is working perfectly fine inside the System.runAs. ...
0 votes
2 answers
64 views
Are there any limits on salesforce initiated system emails?
There is a limit to 5000 single emails sent to external email addressed from Apex code or flow. Does this limit count for the system generated email for Experience Cloud welcome email?
0 votes
1 answer
99 views
Is there a good way to get the call stack in Apex?
I'm currently working on a logger object that will include a field for the Call Stack on every log entry. This is done automatically by the logging class for any log entry, not just exceptions. ...
0 votes
0 answers
84 views
Test Class Inbound Change Set Errors: System.AssertException: Assertion Failed: Unexpected error message: Script-thrown exception
I've been trying to get an Apex Controller and Test Class into Production, but just can't get passed the same errors, regardless of changes on the user profile type or utilising setMessage() to store ...
1 vote
0 answers
176 views
Formula.recalculateFormulas() returning System.HandledException: Script-thrown exception(System Code) When State and Country populated on Lead
LeadTrigger BeforeInsert has some logic that relies on the formula fields on Lead in the logic and using the Formula.recalculateFormulas() to get valid values in these fields. This logic was working ...
3 votes
2 answers
219 views
fflib CRUD check conflicts with Flow System Context
I have built a simple POC flow Flow - specifically creating and updating an account when the flow is running in System Mode Without Sharing - but using the Experience Cloud Guest Site User. When I run ...
0 votes
1 answer
71 views
.get method not returning value even though I copy/pasted the key into it
I'm creating a map based on a custom object in my org. Basically this is the code for it. Map<String, String> translationMap = new Map<String, String>(); List<StageNameTranslation__c>...
0 votes
1 answer
165 views
converting DateTime to String returns the wrong Date as a String
I have the following code to get the DateTime for EST Time Zone Timezone tz = Timezone.getTimeZone('America/New_York'); DateTime now = Datetime.now(); Datetime localTime = now.addSeconds((tz.getOffset(...
0 votes
1 answer
236 views
Query all subscribers to find the subscriber key related to the contacts from mobile Data View
I would like to retrieve users who received sms and retrieve their salesforce ContactID. I had created a Data Extension from the template of the SMSMessageTracking DataView in a child Business Unit. ...
2 votes
0 answers
202 views
Why doesn't the System user have access to the CollaborationGroup records?
I've created a test class and a simple flow below that illustrates the issue with the System user. Two test methods are doing a simple SOQL query on the CollaborationGroup records (one with a Standard ...
0 votes
2 answers
926 views
How to prevent system admins from viewing certain fields
I need to block the read and edit field access on a custom object to all system admins except for one system admin. I could encrypt these fields but system admins can still enable the permission and ...
0 votes
1 answer
269 views
Is there ANY WAY to SCHEDULE this CODE?
private static void scheduleTEst(Set<Id> sObjectId, String cronJobDetailName, String className, Integer hour) { List<CronTrigger> scheduledExecs = [SELECT Id, CronJobDetail....
0 votes
1 answer
721 views
Date formatting not working properly [duplicate]
I have my locale set at (GMT-05:00) Central Daylight Time (America/Chicago). And I am using the below Apex. DateTime d2 = System.Today() ; system.debug('date is '+d2); // date is 2021-04-10 00:00:00 ...
10 votes
0 answers
7k views
What is the purpose of the "System" User?
There's lot of information about the Automated Process User in Salesforce where it's used to make automated system-level changes by Salesforce. However, I noticed that we also had a user called System ...
6 votes
2 answers
1k views
System.assert() in production code? (vs. custom exception)
It's come to my attention that you can use System.assert(), System.assertEquals(), etc. outside of test classes in Apex. I've seen a lot of custom Exception classes written that do nothing but extend ...