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

Uncovered Trigger Scenario in Duplicate Record Checking

We have a custom object called Request__c which has 4 custom fields BusinessAccount__c(Lookup to Account),AssigneeAccount__c(Lookup to PersonAccount),RoleName__c(Picklist field), Status__c(Picklist). ...
0
votes
1answer
9 views

I write a Iframe controller and for my visualforce Pdf but getting an error Unknown constructor 'EstimatedCostsheetCtrl.EstimatedCostsheetCtrl()'

This is vf pdf <apex:page standardController="Opportunity" extensions=" EstimatedCostsheetCtrl" renderas="pdf" showheader="true" sidebar="false"&...
0
votes
1answer
34 views

LWC build Title component

In the process of developing an lwc component that can accept values such as Title, font size and icon name during LWC configuration and the padding and margins should be same as Salesforce out of the ...
0
votes
1answer
32 views

After update Trigger to avoid hitting governor limits

We have a custom object(Request__c) with lookup to PersonAccount(AssigneeAccount__c) and Account(BusinessAccount__c) similar to AccountContactRelation(ACR) standard object. There is a requirement ...
0
votes
1answer
17 views

Record id is different when fetching in vf page controller

public with sharing class FeeEstimatePdfController { private final Fee_Estimate__c feeEstimateRecord {get;set;} public FeeEstimatePdfController() { Id currentRecordId = ApexPages.CurrentPage()....
0
votes
1answer
24 views

Validation Rule is failing tests on Stage, but not on Dev or Prod -- everything appears to be the same across all 3

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Due Date is a Required Field: [Due_Date__c] Stack Trace: Class.TestDataFactory....
0
votes
0answers
16 views

Controller to Check if date is within Daylight Savings Time (DST) and adjust date

i appreciate the help. i am a first year Salesforce Developer and have a challenging scenario. I have a VF Email Template i send to my customers with details of a future appointment. the ApptTime (...
0
votes
1answer
21 views

Time field from SOQL in Apex not populating time in <apex:input type="time"/> because of .000Z in Time field

There is a time field in Salesforce Attendee_Arrival_Time__c. When querying in apex it is displaying time as 01:49:00.000Z and due to that it is not populating time in visualforce <apex:input type='...
0
votes
1answer
612 views

Pass values from php from to the salesforce [PHP Integration]

I Have a generic PHP Application Form which has around 20 fields(say First Name,Last name,Mobile,Position etc ) .I am integrating this form to create a record in salesforce. How can i pass the values ...
0
votes
0answers
15 views

Getting a VF Component to communicate with a new tab?

I want to implement some copy functionality that opens a new tab with the original object being copied, while the copying takes place on the original tab. Since the user gets navigated to the new tab ...
0
votes
1answer
13 views

use dynamique CSS style

I have a question I have in my HTML code three different : <div> </div> -the first contains an image -the second calls for a template that contains two or more fields -the third contains ...
7
votes
7answers
12k views

Is there a limit on HTTP Callouts within 24 hours?

Can someone please help me out with this: "What is exact no of HTTP callouts we can make in 24 hours?"
0
votes
1answer
28 views

Can a Trigger Handler be used on 2 separate Triggers, so that if 1 runs the other doesn't and vice versa

Can a Trigger Handler be used on 2 separate Triggers, so that if 1 trigger processing the data onto another object, and then the other trigger is prevented by the handler, and vice versa when the data ...
0
votes
1answer
26 views

Allow only Admin Key-User to delete the form

I want to allow only the user that have Admin Key-User as role to delete the form , now also the Admin Key-User can't delete if the conditions in trigger are corrects . =>this is my trigger trigger ...
0
votes
2answers
27 views

Whats wrong with my Apex Class? It throws ERROR Please reference your WSDL or the describe call for the appropriate names

In Execute Anonymous it works fine Code: List<Room__c> c=[SELECT id,Name,Customer__c FROM Room__c]; System.debug(c); But in Apex Class it throws an error as Didn't understand relationship '...
1
vote
0answers
14 views

How to redirect edit button to vf edit page and standred edit page based on record type

I have 4 contact record types ,among them one is a vf page ,others are standard pages ,currently i am able to redirect the standard pages to standard edit page ,but vf page is stuck on loop VF Page &...
0
votes
1answer
29 views

Send email using guest user

I have created an LWC with a form to create a Lead and placed it on the community site which is public. Now when a Lead is created there's a trigger that is supposed to run and send an email to the ...
1
vote
0answers
21 views

How to disable CRUD/FLS check from fflib domain layer for only some specific flows. By default it is enabled for all flows using base class

1- I am using fflib for my managed package. 2- By default CRUD/FLS are enabled for all domain/selector flows (Using Base class) 3- In a specific method which is used by site guest users, I want to ...
-2
votes
0answers
16 views

FlowRecordRelation Usage? [closed]

I am trying to understand how the FlowRecordRelation object is populated. What purpose does this object serve? I am an avid user of Salesforce flow and currently see that there are no records ...
0
votes
1answer
37 views

How should i use setTimeout in this js code in lightning component so that popup opens after 2 min? [duplicate]

const isCookie = getCookie('pre-trial-survey'); if(!isCookie && IS_GUEST) { setCookie('pre-trial-survey', false, 30); this.showPopup=true; window.setTimeout(function() { }, 120000);//...
1
vote
2answers
2k views

Error : Value provided is invalid for action parameter 'recordId' of type 'Id' in LWC imperative call to Apex

I have a simple LWC component that shows Contacts of a selected Account, i am calling the Apex method imperatively from my JS code while passing the Account recordId. Here is the Apex method signature ...
9
votes
2answers
560 views

Field filter does not Work for Text Formula field used in SOQL

I have a simple SOQL query on Account which has a field Full_Address__c which is joint of Billing Street, City Zip. When I use this field as a filter it doesn't return the records: Example: String ...
0
votes
0answers
39 views

How to use external api using apex triggers [closed]

I want to trigger an event when a job is created. It should create this job in the livehire too. This is my class where I am getting access token public class _Token { @future(callout=true) ...
9
votes
1answer
281 views

Exeception line numbers are not reliable

I spent quite some time debugging an issue because the stack trace line numbers were not correct and wanted to share my findings. The problem seems to be 10 Years old and fixed, but under specific ...
1
vote
1answer
470 views

Remoting request invalid for your session

Any possible way to keep the remoting request still working. Let's say a guest user was on our visualforce page and open a new window and do the login. Out visualforce page is a single page ...
0
votes
0answers
23 views

Update queable apex with list iteration for loop to process 10 records at a time

I have an existing queuable apex class that is taking a collection of records from an autolaunched flow and passing them via the List recordIDs ivocable variable. There is an iteration for loop to ...
-1
votes
0answers
23 views

Need create queues for product group [closed]

How create queue for product group! I have apex class with help i create new Lead and i have apex trigger and with him help i create product! But i don't know how create queue for product group. ...
6
votes
1answer
2k views

Trying to get SymbolTable of an Apex class and get null

I'm quering Apex classes using Tooling API QueryResult queryResult = toolingConnection.query("select Id, ApiVersion, Name, NamespacePrefix, SymbolTable, Body from ApexClass where NamespacePrefix = ...
3
votes
1answer
15k views

CANNOT_EXECUTE_FLOW_TRIGGER Error

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to ...
0
votes
1answer
29 views

How to use Custom Settings or Custom Metadata to dynamically add fields to code

I have written apex code to copy the data of a few specified fields from Order record to Order Line Item record when their values are modified. The problem here is every time a new field has to be ...
0
votes
1answer
26 views

Trigger on ContentDocumentLink object which sends an email each time i upload a file in account object

Things I have done:This is my code.Earlier I had done it without using an email template by using a subject and body in my apex code itself.It worked fine and each time I uploaded a file in account ...
0
votes
0answers
21 views

PageReference not working when using in controller of custom aura component on Experience Cloud Site

I have a Vf page render as a PDF, I want to send an email along with the pdf from an apex class(which is an aura component controller). The process is running for guest profile users. Below is my code:...
1
vote
1answer
32 views

Query using bind variable returns nothing

Still a beginner here learning to use SOQL and I am not sure why this is returning nothing. I start off with using a txt file as a static resource and reading its contents which in my case are report ...
0
votes
0answers
10 views

Determine Template Section from Custom CPQ Visualforce Page

I am building a series of Quote Templates with CPQ and attempting to build a custom table using a Visualforce page and the custom Template Content object. This works fine but I can't seem to be able ...
17
votes
4answers
3k views

Can Apex code tell if you are impersonating a user vs actually being logged in as that user?

I would like my Apex code to know the difference between me being actually logged in as a particular Salesforce user, versus being logged in as an administrator and impersonating the user (because I ...
0
votes
0answers
16 views

How to avoid governor limit while reading and deserializing a json attachment more than 4MB

I have a JSON attachment on ContentVersion object with the file size of 4MB, While trying the read the file and prepare the data for the custom report using lightning component it reached HEAP limit ...
2
votes
2answers
6k views

Get last modified data older than 30 days from now in SOQL

I wrote the code for the condition: delete data where LastModifiedDate is older than 30days from today. Code: data= [SELECT Id, Name, Type, Status, LastModifiedDate FROM Account ]; for(...
-1
votes
0answers
16 views

List View creation event

Is there any way to catch the creation of a new List View? Because I have methods that should run immediately after creating a new List View.
0
votes
2answers
689 views

component in visualforce email template

I am getting a controller error when i am trying to add a visualforce component to my email template, im struggling to debug why i'm getting the error? Error: Unknown constructor 'outboundEmails....
0
votes
1answer
17 views

Where to find navigation bar metadata in experienceBundle

I created a community using the Partner Central Template, added a few tabs besides home in the navigation Bar clicking on which opens up the salesforce object pages. Now I can see those object pages ...
1
vote
1answer
769 views

How to troubleshoot when converting an Account to Person Account fails?

I'm currently migrating around 2000 accounts to person account via apex. For some reason, it fails on one account. I have checked that it meets all the criteria (one child contact, same owner, same ...
2
votes
0answers
26 views

Google Captcha Static Resource to VisualForce Page

I am using google Re captcha in my Visual force Page as below The below one is working as expected. VF Page: <apex:page sidebar="false" showHeader="false" standardController=&...
0
votes
1answer
48 views

Passing Array of object to apex class LWC

I have array of object which contains two different objects data e.g Secction__c and Question__c @track addSectionRecord = [ { id: '', section: '', sort: '', Question: [...
1
vote
1answer
45 views

LWC Component not working. Trouble passing parameter to APEX

I have to admit its been a while since I wrote an LWC component. I have the HTML which basically loads a different page (view) depending on if a condition is true. There is one part of my JS which is ...
0
votes
1answer
32 views

Getting Report Info using Apex

I was looking to see if I could gather the following highlighted parts from a report programmatically using Apex. These are the headings you would see if you go to the folder where the report is ...
2
votes
2answers
2k views

How to upload an image as a binary file via the Linkedin API v2 with a 'POST' request

I want to know how to make a proper 'POST' request to upload an image as a binary file to Linkedin via their API. This is what they say in their documentation (https://docs.microsoft.com/en-us/...
0
votes
0answers
65 views

what is best way to make Apex callout asynchronously? [closed]

I need to make an Apex Callout from salesforce to 3rd party website. This process needs to run once or twice a day. As this is not real time integration, and data can be large, so decided to go for ...
3
votes
3answers
4k views

Email not being send in apex

I have below code I am using but somehow I neither catch any exception and in debug logs it shows success still I do not receive the email. I checked with deliveribility settings which is fine and set ...
1
vote
1answer
2k views

Setting a from address in SingleEmailMessage not by organisation wide email address

I have a requirement where the ‘from address’ need to be changed . According to business logic cannot use “Organization wide email address” When ever the record is updated , From address should ...
0
votes
2answers
468 views

How to update task due date as last working day of current month

I want to update a task due date as last working day of the current month for only one recordtype using an apex class. It should exclude the weekends and holidays. I wrote the code below to achieve ...

1
2 3 4 5
665