We’re rewarding the question askers & reputations are being recalculated! Read more.

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
5 views

Possible error codes in @HttpGet request

i'm exposing a class as a custom web service. The data returned are the labels, values and if are active or not the values of two picklists of same object. I have to create a custom error structure ...
0
votes
0answers
4 views

How to create custom close case button when checked multiple chekboxes and click to close case button status should be closed?

I want to create close case button on list view on case object.If you checked multiple checkboxes and click to close case button selected checkboxes list status should be closed. I am new to ...
0
votes
0answers
8 views

Iterate cancel button on visualforce

Long time no see. I've got a question about iterating cancel button on the visualforce page. Here is the code: Apex Controller:(This is for finding class from Teacher_Schedule__c, which is a custom ...
1
vote
2answers
23 views

How to identify all the users who have access to a field

I have to prepare a batch class to list down users who has access a field. As example : Opportunity has a field say (Tax_id__c). Now I want to execute SQOL / or any API to identify number of users ...
-3
votes
0answers
19 views

VfPage to show list of Accounts with checkboxes and1save button, pagination.Select N Accounts & click save,these accounts will be create on new obj

Here's my code that i have tried. According to below code i am able to add selected accounts to new object. Here are the issues: Duplicate records are added to New Object. When unchecked on account ...
-1
votes
0answers
10 views

How to i get coverage for this methods [duplicate]

Could you help me on getting test method coverage: public static String insertarLog(String strInterfaz, String strSolicitud) { Logs_Interfaces__c objLog = new Logs_Interfaces__c(); objLog....
0
votes
1answer
16 views

Variable does not exist - Batch Apex Query

I have a Batch Apex which is invoked from process builder. I can see Ids are coming into the variable (please see debug log) but same variable inside the query gives "Variable does not exist" error. I ...
0
votes
1answer
19 views

Test class data created before 'runAs' user not visible

My test class sets up a Community User and some data prior to doing a runAs the new user. In the runAs section I call a controller which requires the use of the data I created earlier, but it doesn't ...
0
votes
1answer
31 views

Aggregate Query on 900K records - how to do this?

Hello fellow developers, I need to run an aggregate query on 900K telephone records to add up a field (grouping by phone line id) and record results in the "summaries logbook". I have tried ...
0
votes
1answer
16 views

component.set not setting attribute value from data.getReturnValue in action.setCallback

I am using this component: https://developer.salesforce.com/docs/component-library/bundle/lightning:map/ and instead of having a hard coded I am trying to grab the billing and shipping addresses from ...
0
votes
1answer
18 views

Can't Consume POST request but Dev Console shows url is being hit with requests

Afternoon, We have a vendor that is trying to send POST requests to a method in we have hosted using Site Guest User. Here is our code snippet that we are using to see if the request is even ...
1
vote
1answer
22 views

LWC: Create New Instance of Custom Apex Class in Javascript

Im fairly new to LWC so any advice is appreciated here. How do I create a new instance of the OnboardingPeopleResult apex class below using javascript of my LWC? public class OnboardingPeopleResult { ...
0
votes
2answers
19 views

Apex trigger to update “minutes to first response” not passing test

I have written the following Apex trigger: trigger FeedThis on FeedComment(after insert, after update){ List<Case> updates = new List<case>(); List<id> userList = new List&...
0
votes
0answers
17 views

Multiple callouts dependant on each other in an InvocableMethod

I have an InvocableMethod apex function being called from Flow in which I make a total of 8 Web Callouts. They are all dependant on each other - so web callout 2 uses params returned by web callout 1 ...
0
votes
1answer
14 views

Data export Download issue [on hold]

How to open/ retrieve the actual attachments from the zip file from weekly data export In Data export , i selected Case object and started Export .. I received more than 20 zip files .. After ...
0
votes
1answer
35 views

Best way to schedule a batch job repeating in short frequency

Requirement Run a batch in every other 15mins in the clock (i.e. clock time 00:15, 00:30, 00:45 01:00....). Method 1 - create a schedulable to run the batch every 15mins. Pros: it allows me, in ...
1
vote
1answer
20 views

Date formatting for SOQL String - unexpected output

I have '273' added as a day with the following line: DateTime.newInstance(dStart.year(), dstart.month(), dstart.day()).format('DD-MM-YYYY'); so the output looks like '273-09-2019' - what gives? I ...
1
vote
1answer
20 views

Error when pulling PDF from HTTP response

I have a question regarding this post: handle PDF content in HTTP callout When I try the above code I'm getting this: "Unrecognized base64 character: %" The logs show this as well: 19:53:04:658 ...
0
votes
0answers
16 views

Link Child Records To Parent Record After Parent Record Has Been Created

I have a custom object called Pronto__c which is a parent of OpportunityLineItemSchedule. When a Pronto record is created (data is being passed from an external data source), it has the Id of a child ...
-3
votes
1answer
18 views

How to download Case attachments through workbench [on hold]

How to download Case attachments based on Queue or RecordTypes by using Workbench ? can someone pls provide SOQL Queries ?
1
vote
1answer
21 views

Load data from incoming email CSV attachment

I would like Salesforce to create some records for me based on data that is incoming in an email's CSV file attachment. I've investigated the Email Services functionality, and set up an address, ...
0
votes
0answers
11 views

Navigation inside Visualforce page not working for lightning component

While trying to reuse the lightning experience in visualforce Page classic. A generic reusable button is built and been reused. However for visualforce we cannot use the same as overlaylibrary was ...
2
votes
2answers
31 views

How to use order by in Big Object Query?

I am trying to query records from big object in a list, using the following query Select Edit_Date__c ,CreatedDate,Field__c ,Loan_ID__c ,New_Value__c ,Old_Value__c ,User__c, System_Updates__c, ...
-1
votes
0answers
27 views

How to go about creating a Repeating Dropdown Picklist? [on hold]

So I've been tackling this problem where I need to create a dropdown picklist that once selected you click an add button and it renders a new dropdown picklist without the previous selected value ...
-1
votes
2answers
44 views

Not able to improvie the code coverage for the class [duplicate]

I am not able to cover the lines for the below class which is in bold(four stars) and method called "getAccountMaxPriorityTerritory", can anyone help me how to do that please. Below is the method ...
0
votes
0answers
10 views

How to get the EURO currency value?

I want to only EURO currency from this below currency field and save to another field how to do ? Here EURO currency is Corporate Currency.
0
votes
2answers
37 views

How do I create a Community User in apex code?

I need to create a test class for a community user, so need to first create the user, then do my test as that user. I'm struggling to get the Account for the User though. What is wrong here? The last ...
0
votes
1answer
24 views

Apex extracting fields from a trigger to create a custom JSON

I have created a trigger for Order Object and only want specific fields to be pulled from that object to create a custom JSON data structure. I have tried saving the fields that I need from the object ...
0
votes
1answer
25 views

Removing an element from a List

If I remove an element from a list, do all the elements to the right of it shift left? List<Integer> ints = [1,2,3,4,5]; ints.remove(0); printf( ints[0] ) --> 2;
0
votes
0answers
17 views

Passing parent id to child record in VisualForce

I am using a custom button on the parent Custom Object page which will launch a VF page to allow the user to input one or many child records. I would like to pre-populate the Parent Id for each new ...
-4
votes
0answers
21 views

System.AssertException: Assertion Failed: Expected: prefers to be contacted by email., Actual: Prefers to be contacted by email

Contact jane = new contact(FirstName='Jane',LastName='Smith', Email='jane.smith@example.com', Description='Contact of the day'); insert jane; Contact Jane2 = new contact(FirstName='Jane',LastName='...
0
votes
0answers
32 views

Is there any tool that can do event logging for Apex

I have a website that is built with Visualforce page and apex. I want to have logging feature added to the apex (trace, debug, info, ...eror, fatal). I know you can do this using debug log but my ...
-4
votes
1answer
30 views

Unexpected token '&lt;'

List<Contact> conList = new List<Contact> { new Contact(FirstName = 'Joe',LastName='Smith',Department='Finance'); new Contact(FirstName = 'Kathy',LastName='Smith',Department='...
-2
votes
1answer
26 views

trigger on Opportuntiy partner account [on hold]

In which release we can expect to write a trigger Opportuntiy partner account ? Does anyone have an idea on this?
0
votes
1answer
46 views

programming - How to convert text value to a field

In Object Alpha, I have two fields Field currentDate__c = Date.today().format(); (say) and field relevantfield__c= “Partner__r. lmn_currentDate_c” (this field value changes and specifies when this ...
0
votes
1answer
34 views

JSON Formatting error

I have a requirement wherein I have to strictly format the body of the request as below. { "body": "* Case Number: 1406800\n* Primary Contact Name: Larry Brown Portal \n* Test:SampleTest" } ...
0
votes
1answer
41 views

Is having multiple triggers per object still a bad thing, considering a trigger per application?

I started working with Salesforce in 2015, and since then I've been told by mentors and the Salesforce community on the Internet that having multiple triggers for a single object is bad practice, ...
0
votes
2answers
31 views

An Apex error occurred: System.QueryException: List has more than 1 row for assignment to SObject [duplicate]

I have 2 objects Case & Level agreement ( Don't have any relationship between both objects) I want to compare Task Category value for both objects ...When I write below query on Apex class getting ...
1
vote
0answers
15 views

Updated field values doesn't reflect immediately on the detail page in lightning

I have written a VF Page & Apex Class to update some value on a object when clicked on a button & redirect back to detail record page. This logic works perfectly fine in classic mode but the ...
0
votes
1answer
35 views

How to do a recursive batch?

I need to do a batch which calls itself until a condition is true. I don't know how to start. I've tried some things but I got an infinite loop. The idea is: I have a start date Ex: 2019-01-01 Make ...
0
votes
0answers
12 views

Send to JSController the translated value of a picklist and Id of force:inputfield Lightning

I'm trying to do two things here : catch an on-change event on a picklist using: <force:inputField>. and get the aura: Id getting the translated value and not just the API. CMP: <aura:...
2
votes
2answers
28 views

Heap Space Question

I have a system.debug() that outputs the result of division of the currently used heap space by an integer. It always shows 0. What could be the root cause of this?
0
votes
0answers
23 views

Change checked custom fields from two different list

i really need your help. Im actually a beginner in dev so maybe you can tell me whats wrong with my code. I have to make two list of Accounts, each account have a custom field named "Nivel__C" (...
-2
votes
2answers
32 views

How to call report in xlsx file format

could you please help me how to call report Xlsx file format, i am tried to below code, but i am not get the result: public class BatchUtilClass { @future(callout=true) public static void ...
0
votes
1answer
15 views

Optional parameter in apex (sending email with PDF)

I have Messaging.SingleEmailMessage method return type that requires several parameters when its called, the code is below; public Messaging.SingleEmailMessage createEmailMessage(Id templateName, Id ...
0
votes
1answer
27 views

How to avoid Apex CPU time limit exceeded error with Process Builder?

We have multiple rules setup for Case using process builder but one of the rule seems to be failing throwing CPU Time Limit Exceeded error. The process is failing at this step where i am updating ...
1
vote
1answer
34 views

What is the correct approach to create an Event in Apex for another User with their Timezone?

I'm trying to create an event for another user which needs to appear on their Calendar (in that user's Timezone). e.g. Current user's Timezone is Australia/Sydney, I need to create an event for a New ...
0
votes
1answer
22 views

How to get the value of a blob as a string in Apex?

I'm building a Google Drive integration to push files over. I have it working--with one significant problem. When I query VersionData from ContentVersion it return a blob. When I pass my blob in the ...
0
votes
1answer
18 views

Add a hyperlink in the body of the notes

I am trying to add a hyperlink to an Opportunity in the body of a note record. Something like this note n = new note(); n.ParentId = {OpptyId}; n.title = 'Note from code'; n.body ='<a href=' +...
-2
votes
0answers
30 views

asynchronous window salesforce to remove all PII [on hold]

Is there a best practice to writing a script to run and remove all PII in an org? Would you have to do this all at once or in separate objects?