Questions tagged [apex]

Questions relating to Apex, the native programming language for the Force.com platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

INVALID_CROSS_REFERENCE_KEY, You can only assign users to permission set groups that have the “Updated” status

I'm struggling to assign a mocked permission set group in a test class. The test class fails because of the following error: INVALID_CROSS_REFERENCE_KEY, You can only assign users to permission set ...
0
votes
0answers
19 views

rest api integration error - invalid signature

I need some help here with REST API Signature Generation. Signature generation doc is at: https://developers.woohoo.in/docs/get-started-title/oauth-2-0-protocol-recommended/oauth2-0-signature-...
0
votes
1answer
26 views

Join multiple JSON strings in Apex

I have a requirement to display Accounts-->child Accounts-->Tasks-->Child Tasks in the JSON. Here is my Apex code: List<Account> accountRecordsList = new list<Account>(); List<...
-4
votes
0answers
19 views

Unit testing for value that need to return image value in a custom object

i want to test that if checkbox is checks, Attachment__c needs to contain image if else will get an error. Attachment__c is a rich text area. My test class: @isTest public class TestPraTrigger { ...
1
vote
2answers
79 views

Unable to escape the governor limits (Too Many SOQL Queries: 201)

My governor limits are getting exceeded because i need to use count() for each individual fieldName and check fieldName != null, and return it's individual value But there are over 300 fields, how to ...
1
vote
2answers
47 views

New LWC Actions in Salesforce

Looks like in the current release Salesforce has made LWC Quick action "Generally available" but the tag that we use in LWC quick actions which is lightning-quick-action-panel is still in ...
0
votes
0answers
13 views

How to get code coverage in apex trigger? [duplicate]

I'm new to apex trigger in Salesforce, can help me on how to have the code coverage for me to move my custom object to production? Really appreciate if you could help me with this. Thanks a lot in ...
-2
votes
1answer
22 views

Code Coverage wont Push Tru After IF

I was trying to create a unit test for my APEX Class. But i was wondering the Test wont push thru after IF statement but i was using an existing leads (046933) for testing.
-3
votes
0answers
33 views

How to check and validate BAC and IBAN values in Apex [closed]

I need a function in apex to validate The IBAN and BIC values in my form . Any help please . I found only the code below to validate the IBAN ,but i don't have any idea how to check the BAC public ...
1
vote
1answer
23 views

Filter records by categories SOQL

I am trying to build a query, that will return books with all information including genres of that book. I have 3 objects: Book__c in which I have all information about books, Genre__c in which I have ...
0
votes
1answer
38 views

No apex action available for class.method error

I am getting a very weird error. My LWC Component is referencing two methods from an Apex class. Everything was working fine. Suddenly after a week, I am getting this error: /{"message":&...
-1
votes
2answers
42 views

Programmatic (Apex code) approach advantages

Generally, when is it most suitable to use apex instead of a declarative approach? Also please share a link or resource if possible?
0
votes
0answers
12 views

Inline Edit and Row level Actions

Scenario: I want to use an account standard object action to create numerous Catalog__c custom object records. Catalog records will be imported using a csv file. I want to display the records in a ...
0
votes
2answers
21 views

Structural Question - Record Triggered flow and Apex Trigger Together?

This is a general question and i would like an opinion from the experts. I have to do something on Account that is too simple and can be achieved with the use of record-triggered flow. However, we ...
0
votes
0answers
12 views

How can I highlight/select a tree node when on the record page

Problem: I have a lightning:tree that display a list of numbers, with a parent and child nodes. When clicking on a node, the user navigates to the page related to the number. I need to have the node ...
0
votes
1answer
29 views

Bulkify Aggregation Trigger

Is there a way to combine the two aggregates below. public class AccountClass { public static void UpdatePartnerRollup(List<ID> AccID){ // Get Opp Account Map<Id, Account&...
0
votes
0answers
15 views

How to Display/Preview the Images/Docs stored in salesforce in aura fom [closed]

I have a user filed form along with docs images and are store in the Files section of the Application object. Now there is a Preview Button on click of that, admin should see that particular image on ...
1
vote
2answers
64 views

Where to place database activities on a SoC architecture

Considering a SoC architecture where the following classes exist: InvoicesService - Service Layer- Invoices -Domain Layer- Let's say, in a new InvoicesService method I need to insert Contact records....
0
votes
1answer
18 views

How to cover the constructor in the test class of the salesforce

I have completed almost around 71 percent of my test coverage ,,but not sure how to cover the constructor in my test class can anyone help me out. Below is my constructor. public String oppId {get;set;...
0
votes
1answer
26 views

Concatenate 2 list values into single record in apex

List1<account>: ({Name=Acc1, type__c=Marketing,Agree__c=no},{Name=Acc2, type__c=Sales,Agree__c=yes}) List2<account>: ({Name=Acc1, Sla__c=new},{Name=Acc2, Sla__c=pending}) I need to ...
0
votes
1answer
30 views

method does not exist or incorrect asignature?

If someone could help me, according to me I am doing the correct assignment of the method parameters, but it tells me that, if someone has an idea it would be very helpful. this is code to evaluate: ...
0
votes
0answers
36 views

Chaining of Batch getting counted against API Requests, Last 24 Hours

This is strange for me and a new information to me. But calling a batch or recursively calling a batch is contributing to API Requests of org. I did test this in my own dev org, where no external ...
-1
votes
0answers
19 views

Multicallout mock response data is null

I am trying to cover a class in which each method has multiple callouts. For that, I have created multicalloutmock, but it works for the first response but for the second and third it is returning ...
0
votes
0answers
23 views
0
votes
0answers
12 views

Automatically generate Content Document public link?

I have a custom object that will always have an attached file upon creation, then the public url to this file should be used to populate a field in a related object. After some research I found out ...
4
votes
2answers
436 views

Infinite queueable chaining, what is the drawback?

As mentioned here Because no limit is enforced on the depth of chained jobs, you can chain one job to another. You can repeat this process with each new child job to link it to a new child job. What ...
0
votes
0answers
14 views

Handle new data from a merged Lead

I have a process that is sending Lead data out of Salesforce. The system of record is Salesforce. 3 months later, the Lead data sent comes back into Salesforce with updated data. There is a chance ...
0
votes
1answer
23 views

What is the 'SFDC_Devconsole' debug level?

I am trying to retrieve error logs for a batch apex class and am creating a new user trace flag for the running user. The standard preset is 'SFDC_Devconsole' - will this trigger debug logs to show ...
1
vote
0answers
33 views

Difference in count for PermissionSetAssignMent when GROUP BY either Id or Name

I have following two queries SELECT COUNT(Id), PermissionSetId FROM PermissionSetAssignment GROUP BY ROLLUP(PermissionSetId) ORDER BY PermissionSetId LIMIT 1 And SELECT COUNT(Id), PermissionSet....
0
votes
1answer
33 views

Using a String to access an object's parameter (APEX)

I have a list that contains an object's parameters that I'd like to access from the object. Below is an example of what I am trying to do //temp is the name of an object which contains all of the ...
0
votes
0answers
48 views

Set Text Field as a URL link in a custom object using Apex Trigger

I am looking to add a URL into a text field in a similar fashion to the way you can add a HYPERLINK in a Formula (Text) field. I have already taken a look at the information in How to give a URL field ...
-1
votes
1answer
19 views

Salesforce RestResource GET API is unable to identify special characters passed in query string

I have created a RestResource API class with GET method. It is supposed to accept the email passed as an input via the query string, and perfom logic based on that email received. It all worked fine ...
0
votes
1answer
30 views

Map of Key with List Object print empty Object in LWC

Trying to Create the Map in JavaScript for key as program and List of Object. Below is the Json Object JSONPObject.program = [ { "Id": "a0l5e000002mFg8AAE", ...
0
votes
0answers
20 views

BillingGeocodeAccuracy - missing field error

We are receiving below error only in PROD but not Sandbox when we query Account from Boomi connector. Also our Boomi Integrations are up and running since 2 years. It never errored before and suddenly ...
0
votes
1answer
32 views

Batch class to update a lookup field on CASE Object

I am new to Salesforce development. I want to write one batch apex which will look into user object and see if manger field is getting updated for User record, then it will update user manager for all ...
0
votes
0answers
25 views

Deserialize nested JSON and create Parent-child records in Salesforce

An external system is sending us a JSON of Parent-Child-Grandchild records. Initially this worked great with REST calls where you can send nested structures for these relationships and respective ...
1
vote
0answers
28 views

“The value of a parameter contains a character that is not allowed or the value exceeds the maximum allowed length”

I'm getting this error when trying to override standard button of a custom object that is part of a managed package: "The value of a parameter contains a character that is not allowed or the ...
-2
votes
1answer
36 views

i need a little help ): with constructors in apex class

public class OrderItemWrapper{ @AuraEnabled public string orderItemName; @AuraEnabled public decimal orderItemQuantity; @AuraEnabled public decimal orderItemAvailableQuantity; @...
0
votes
0answers
20 views

How to display data from objects shown in ERD without affecting performance?

Current State: We created a reportType with "Contact, Interaction & Interaction Contact" objects and displaying the report on Account object using this process: Displaying Summary and ...
0
votes
1answer
31 views

Salesforce too many soql queries 101 whle inserting bulk data. I need to check if the contact is all ready present or not before inserting a new conta [closed]

public static void ContactFromAccount(List<Account> NewAccountList){ list<Contact> contactList = new list<contact>(); for(Account a : NewAccountList){ ...
1
vote
1answer
36 views

Unable to capture AuraHandledException in test class

Controller method: @AuraEnabled public static customObject__c getInfo(String recordId){ try { customObject__c rec = new customObject__c (); List<customObject__c > ...
0
votes
1answer
36 views

callout inside for loop [duplicate]

I am inserting multiple records in a transaction then i have to send those details to another system. Currently after inserting i am querying the records in a list and inside for loop doing the ...
0
votes
0answers
17 views

XML is failing after escapeXML()

Today I faced a problem that my XML can't path a validation, after using the escapeXML() method. The reason is that '&' escaping as '&AMP_;' instead of '&amp_;'. Does anybody know the ...
0
votes
0answers
15 views

Experience Builder: Custom Self Register Component

When a guest user tries to register for the community with an existing email address, he gets following error. Your request cannot be processed at this time. The site administrator has been alerted. ...
0
votes
2answers
30 views

System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

public class CurrencyConvertorClass { public static Decimal convertCurrencyToINR(Decimal eur){ Decimal inr = 0.0; HTTP h = new HTTP(); HTTPRequest req = new ...
0
votes
0answers
14 views

Access the cookie set by one of my Visual Force page in a lightning component

I'm trying to access a cookie I set in a visual force page in a lightning component , but Im unable to find a way to do so. what I notice on my browser is that cookie is set a different domain for ...
0
votes
0answers
13 views

Send emails through apex - synchronous

I have a lightning component quick action on Opportunity that sending emails to Offer__r.Contact where Offer__r is a related list of Offers on the Opportunity. I have a need to update a counter fields ...
0
votes
0answers
15 views

How to query records using SOQL along LIKE operator when the org data is greater than 1,000,00?

hope you all are doing great! I am facing difficulties in implementing a requirement. My aim is: Take a string parameter, and search based on it. Execute SOQL (For example SELECT Lastname FROM ...
0
votes
0answers
22 views

How to show different picklist values for a field in record edit form in LWC

We are using a record edit form in LWC. For one particular picklist field we want to display different picklist values based on the value of some another field. How can we achieve this?
0
votes
0answers
17 views

Type or LeadContactId NULL in Trigger.New CampaignMember

trigger cm on CampaignMember (after insert) { for(CampaignMember cm : Trigger.New){ System.debug('cm.Type '+cm.Type); System.debug('cm.LeadOrContactId '+cm.LeadOrContactId); } }...

1
2 3 4 5
649