Hot answers tagged

4

Provide hardcoded fields in query locator? I believe you can do this, this gives a compile-time check Database.getQueryLocator([SELECT Id FROM Account]); Src:https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database_batch.htm#apex_Database_QueryLocator_getQuery


4

The fact that "type" is one of the keys - and is also a reserved keyword - tells you that yes you need to use JSON.deserializeUntyped anyway as Pranay suggested. If a section contains unstructured data, you need to figure out what possible data structures you are willing to extract data from and then write Apex code to handle extracting them. In general ...


3

You can also consider generating them based on a date and time. The current date will never repeat in the future, even if you delete the records. A customer created now could be number 1719071915, for example. Can you identify the mask used? Day Year Month Minutes Hours Pros: It is not random. It will not repeat itself. You can reverse it to get the ...


3

Your test class isn't performing any inserts. You're guarding your inserts with logic on a field that you don't populate and which is therefore null: Lead l = New Lead(Company = '', FirstName = 'First', LastName = 'Last', leadSource = 'Website', lead_SubType__c = 'Contact Requested'); leadList.add(l); if(l.Referring_Brand_Id__c == '0010H00002SuHKtQAN'){ ...


2

Partially. You can always establish static references to the involved fields and sObjects, and build the query dynamically with templating. I never like seeing queries built by string concatenation anyway. List<String> fieldList = new List<String>{ String.valueOf(Account.Id), String.valueOf(Account.Name) }; String query = String.format( ...


2

The <apex:param> component used with <apex:outputText> is intended to provide parameters to the output text component for use within a message formatter: Within <apex:outputText>, there’s support for the tag to match the syntax of the MessageFormat class in Java: <apex:page> <apex:outputText style="font-style:italic" value=...


2

You are trying to reference an attribute SBQQ__LineItems__r on a List<SBQQ__Quote__c>, but this type does not have that attribute. Rather than referencing the collection, you need to reference a single record within it. List<SBQQ__Quote__c> quotes = [/*query*/]; for (SBQQ__Quote__c quote : quotes) { for (SBQQ_QuoteLine__c lineItem : quote....


1

This relationship field bu.Sales_Rep__r will only be populated in your test if: A relationship has been established by some logic that sets the Sales_Rep__c field first The test code then does a query that includes the related object Otherwise bu.Sales_Rep__r will be null resulting in the error you see.


1

The issue was in lwc import. import getTotalNetPriceFromSAP from '@salesforce/apex/SFMS_SubscriptionsOverviewController.getTotalNetPriceFromSAP'; But for Continuation it must be: import getTotalNetPriceFromSAP from '@salesforce/apexContinuation/SFMS_SubscriptionsOverviewController.getTotalNetPriceFromSAP'; Import apexContinuation This question is ...


1

You should remaster your code like this: //with LIMIT 1 List<Contact> contacts = new List<Contact>(); contacts = [SELECT Id, OwnerId FROM Contact LIMIT 1]; if (contacts.size() > 0) { String ownerId = contacts[0].OwnerId; List<Account> acc = [SELECT Id FROM Account WHERE Id = :ownerId]; } Or like this: //without specified ...


1

What you're trying to do is called a variable bind. The documentation on that can be found here. Taking a small excerpt from that page... SOQL and SOSL statements in Apex can reference Apex code variables and expressions if they’re preceded by a colon (:). This use of a local code variable within a SOQL or SOSL statement is called a bind. The Apex ...


Only top voted, non community-wiki answers of a minimum length are eligible