Patlatus
  • Member for 8 years, 5 months
  • Last seen this week
How can I assign a permission set to a user in a test context?
Accepted answer
29 votes

This question is marked as unanswered, despite it was answered in the comments. Let's revise the answer here: PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = '<required permission ...

View answer
Passing Parameter Into Schedulable Class
22 votes

What about passing parameters through constructor and storing them in instance variables? public class Dummy_Schedulable_Class implements Schedulable{ public List<String> names; public ...

View answer
How do I retrieve Lightning Web Components using Ant Migration tool or mdapi:retrieve command from SFDX?
Accepted answer
20 votes

The new Metadata API component is called LightningComponentBundle The following XML code should be added to package.xml: <types> <members>*</members> <name>...

View answer
Unit Test - Creating Custom Metadata
19 votes

There is possible hack to have different values in tests than it is in organization. This is a good way to have your tests always stable and 100% covered even if custom metadata is changed or removed ...

View answer
LightningComponentBundle "Not available for deploy for this API version" error
Accepted answer
18 votes

Looks like I have found already a culprit here. It is very important to check sourceApiVersion property of project.json configuration. Looks like this value was 44.0 in my project. Probably because ...

View answer
Test that a Platform Event was published?
Accepted answer
18 votes

My colleague suggested the following solution. Events can be stacked in static property and then checked in assert. So trigger can be refactored like following trigger CustomObject on ...

View answer
Can you use generics in Apex?
12 votes

I guess we all need to vote here to make them hear us and allow generics in Apex. This is the only way how generics can appear in Apex. If no ones votes they think we don't really need them.

View answer
Insert Custom Metadata for Unit Test
11 votes

There is possible hack to work around impossibility of insertion of custom metadata records. For this hack you just need to put query for custom metadata into separate property which should be ...

View answer
Making a callout in Apex to Marketing Cloud SOAP API
Accepted answer
11 votes

So first of all you need to perform login action to retrieve fuel OAuth token. Request format is following due to the documentation POST https://auth.exacttargetapis.com/v1/requestToken Content-Type:...

View answer
Unable to open developer console
11 votes

I had the very same problems on Sandboxes. I have opened Salesforce ticket and they referred me again to this SSE post. And also to a similar SSE post. Jermaine's answer to that post helped for me. ...

View answer
What are the minimum and maximum valid dates in Salesforce?
9 votes

Initially I have found an answer here, but the link provided in that answer, was broken. Finally found a corresponding valid link in the documentation Minimum and Maximum Dates Only dates ...

View answer
Lightning Community, can i make change password Lightning Page, not VF?
Accepted answer
9 votes

Lightning framework is evolving and Salesforce adds new features in each release. I see that documentation suggest that you might use Lightning Community Builder to use Lightning Components to modify ...

View answer
How to retrieve or deploy Custom Metadata Records by ANT Migration Tool?
Accepted answer
9 votes

Gosh! This works: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm#meta_custommetadata <types> <members>*</​members> <name&...

View answer
Unit Test: You have uncommitted work pending. Please commit or rollback before calling out
8 votes

There were several Salesforce issues related to System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out Besides of the issues mentioned, ...

View answer
Why it is forbidden to import several Apex Methods at once in LWC module?
Accepted answer
8 votes

Looks like here by "default" imports meant only imports which import one item from the module, so I have to use the following workaround. import Method1 from '@salesforce/apex/LWCController.Method1'; ...

View answer
Why promoted unlocked package is still not available to install in production?
Accepted answer
8 votes

Looks like promote commands reports success status before the package gets actually promoted, so ISV should wait some time up to an hour to wait until the package gets actually promoted

View answer
What is origin of error Entity is not api accessible (Line: 1, Column: 8)
Accepted answer
8 votes

I had a line like following Project p = projectsMap.get( projId ); When I changes this line to Project__c p = projectsMap.get( projId ); everything has been saved ok. Actually I meant Project__c (...

View answer
How to avoid error Cannot read property of undefined using two LWC Wired properties
Accepted answer
7 votes

To avoid this problems, it is needed to surround the code with <template if:true tag, usually it is clear and obvious when we rely on load of one parameter. However, when the code depends on two ...

View answer
Unable to understand and fix problem LWC1010: Failed to resolve entry for module
Accepted answer
7 votes

Looks like LWC references are case-sensitive and they should be referenced in the exact case like following <aura:component > <c:simpleTable/> </aura:component> While if we ...

View answer
How to know if a field is part of a compound address field and thus is not permissionable
Accepted answer
7 votes

There is an easy way to determine if field is a real field or a part of compound field. There are two tables in Salesforce which correspond to compound fields and its components. If a field can be ...

View answer
Getting Page Layout associated to a Profile/RecordType
7 votes

If you are interested in solution which would work only for Salesforce Classic, I have it. It is possible to make Tooling API ProfileLayout Object Query [ select Layout.Name from ProfileLayout where ...

View answer
How to query the 'Metadata' field from 'FieldDefinition' with SOQL?
7 votes

Tooling API Documentation refers only to Tooling API queries. This is not obvious that Metadata is available only for Tooling API Calls. This is not obvious but actually FieldDefinition and ...

View answer
Is there any fix or workaround for Gack with Error ID: 622456132-619398 (-1311433241) related to `SurveyInvitation` object?
Accepted answer
6 votes

I had the exactly same error, it happens when a SurveyInvitation record is shared to an user, but Survey itself is not. It is easily to verify if this is the same error by removing the InvitationLink ...

View answer
Scratch org creation error failures: meaning
Accepted answer
6 votes

ERROR running force:org:create: getaddrinfo ENOTFOUND battlestar-x-wing-50517.m y.salesforce.com battlestar-x-wing-50517.my.salesforce.com:443 This means a related DevHub organization is expired, ...

View answer
How do I create a managed package with SFDX?
Accepted answer
6 votes

Ok, looks like I have to create Developer Edition org and register a namespace there and then link it to my Dev Hub org due to documentation https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev....

View answer
Deserialize History record with read-only fields?
Accepted answer
6 votes

I think the problem is that JSON uses strict concrete type definition. You can't write something like AccountHistory history = (AccountHistory)JSON.deserialize('{"NewValue":a}', AccountHistory....

View answer
How can be avoided error SINGLE_EMAIL_LIMIT_EXCEEDED Email limit exceeded if need to send email to one single user?
Accepted answer
6 votes

Looks like I have found an answer very long time back but didn't write it down. So today I started investigating this again and decided to store the solution found somewhere. It is interesting that ...

View answer
How do I check CRUD and FLS in apex?
Accepted answer
6 votes

Please refer to this knowledge article. Basically you just need to add some checks like if (!Schema.sObjectType.Contact.fields.Name.isAccessible()){ return ''; } or if (!Schema....

View answer
Unit Testing a SOQL Method
Accepted answer
6 votes

It is a best practice to separate unit tests from functionality tests. If you run your method from trigger on contacts insert and you want to cover functionality, you can write some method like this ...

View answer
Is there a way to read all Inactive values of Picklist?
5 votes

Vote for idea https://success.salesforce.com/ideaView?id=0873A0000003biYQAQ to have Salesforce implement this, for the current release there is no way to obtain inactive picklist values

View answer
1
2 3 4 5
13