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
1 answer
13 views

lightning tree grid issue with displaying grand child data from apex

I have this below query . Where i am trying to display Opportunity name and products associated to it in a lightning tree-grid structure. The issue i am facing is i am able to display opportunity name ...
user avatar
  • 1,528
1 vote
1 answer
26 views

Queries on Large Object (>1 million rows) Fail to Execute

We have an object with approximately 1.5 million records in Salesforce. These records are created in an external system and synced with Salesforce every 24 hours. On a 24 hour basis, we delete all 1.5 ...
user avatar
  • 162
0 votes
0 answers
18 views

Can anyone help me with the test class for below apex code .(Before update) [duplicate]

Trigger : when user tries to update the owner field it must throw error public static void Comm(List<Account> newLists, Map<Id, Account> oldMap ){ try{ User currUser ...
user avatar
0 votes
1 answer
15 views

Sending email functionality is not working for site guest users

We have 1 VF page which is working fine previously for sending emails but now it is not working. All other functions from that Vf page are working only send mail functionality is not working which ...
user avatar
-1 votes
0 answers
32 views

getting" unexpected token: from" error in below test class

@istest public class DateMathHelperTest { @isTest static void DateMathHelpermethod1() { Epix_Date_Math_Logic__c edml = new Epix_Date_Math_Logic__c(); //edml.name = 'test'; edml....
user avatar
0 votes
1 answer
21 views

onrowaction in Lightning:DataTable is not working

I have a requirement, where I have to open a DataTable in the Model window after click into 'Select Template' Button. When Button clicked, all Templates records gets populated into Datatable, now when ...
user avatar
0 votes
0 answers
20 views

How is it possible that queueable apex jobs run for multiple hours and can not be aborted

Last week we had an issue with a queueable jobs which ran for more than 8 hours and thereby locking many records during this period. We were not able to abort this job and were obliged to sit it out. ...
user avatar
-1 votes
1 answer
18 views

What is messaging.singleemailmessage in Salesforce?

I am currently learning triggers in salesforce. What is singlemailmessage in salesforce ?
user avatar
0 votes
0 answers
17 views

Sending Email from Guest User Profile- Email No Receiving Email

I have created an LWC with a form by collecting the basic info, Then i will be sending the info to the email service. Below is the code string emailAddress = GetEmailServiceAddressUtility....
user avatar
2 votes
1 answer
50 views

Is there a way to test a SOQL query would retrieve a specific sObject without running a query

EDIT: on further research what I want is the Apex equivalent of Collection Filters I have looked at Query Utils but other than the complexity there seems to be lots of "DON'T USE THIS UNDER RISK ...
user avatar
0 votes
0 answers
23 views

Unable to fetch specific part of Apexlog using tooling API

public with sharing class FetchApex { @AuraEnabled public static void logs(){ ApexLog al = [SELECT FIELDS(all) FROM ApexLog WHERE LogUser.Name = 'Username' LIMIT 1]; String ...
user avatar
1 vote
0 answers
22 views

Trying to convert Apex to be used in an Aura Component Form

I am new to Aura Components, and I'm having a hard time trying to move them over from using Visualforce Pages and Apex. I am getting the following error: Non static method cannot be referenced from ...
user avatar
-1 votes
0 answers
18 views

Survey TEmplates

How can we call Survey Templates in Flows ??? I have created a survey Template in Survey Object and created a Flow in flowBuilder and tried to call the Survey Template in flows it is not working.
user avatar
2 votes
1 answer
34 views

Test Class Out of Bounds Exception

This is the first time I have messed with test classes, so there may be something I am simply overlooking. However, I am trying to test a simple class but am only getting an out of bounds exception as ...
user avatar
  • 31
0 votes
0 answers
35 views

Parse blob in apex

We have a @RestResource apex class using which we are receiving the JSON data from application which resides outside of salesforce through REST API. We parse this data to get the jobId from it and ...
user avatar
-2 votes
0 answers
24 views

I want this trigger to only run when the record type is = 'SOT Record' [closed]

trigger RollUpMaster_line_item on Master_Line_Item__c (after insert, after update, after delete, after undelete) { Set<Id> masterIds = new Set<Id>(); if(Trigger.isInsert || Trigger....
user avatar
0 votes
0 answers
24 views

Hi, Can anyone help me write test class for the following class [duplicate]

@RestResource(urlMapping='/InstallationWebService/*') global without sharing class Wx_InstallationWebService { @HttpPatch global static void updateContactGUID() { RestRequest ...
user avatar
-1 votes
0 answers
20 views

Cannot find apex-defined data type class in flow

I am having an issue. I need to use the any data type in my apex class to use in my salesforce flow. However with the following code, I cannot find the apex class in the flow builder when creating the ...
user avatar
0 votes
1 answer
33 views

Refresh/Reload an aura component

I'm trying to reload/refresh the complete aura component for some actions like after hit the submit button in component. Currently i'm refreshing the complete page by using location.reload(); . ...
user avatar
  • 1,455
0 votes
1 answer
30 views

Convert workflow rules with Evaluation criteria to Apex code

I have criteria in the workflow which need to convert to apex code. Here is the WF rule and criteria to convert. Rule Criteria: Opportunity: Status EQUALS Service Evaluation Criteria: Evaluate the ...
user avatar
  • 233
-2 votes
0 answers
41 views

Please help to write test class for this? [duplicate]

public class SKUProductUpdatePaymentTerm { public static void UpdateSkuPaymentTerm(List<Product2> newList, Map<Id,Product2> oldMapProduct2){ Set<Id> SkuSetID = new Set<...
user avatar
-2 votes
0 answers
34 views

How to pass the value of Radio button from LWC to Apex Class [closed]

I am having 2 radio options 1.Yes and 2.No where in javascript handle event i am able to get those values . I need to know how to pass that value to apex class and with that i need to perform some ...
user avatar
0 votes
1 answer
56 views

How do I set whatid to a custom object

I can’t set the what Id to the Id of a custom object. This has been asked before, but the answers aren't helping me: So many failures Including this one I took a picture of my custom object setting: ...
user avatar
2 votes
1 answer
77 views

A Variable Passed from my LWC to Apex Becomes Null

ISSUE The parameter name of my Apex method did not match the name of the variable when I called the method from JavaScript. ORIGINAL QUESTION I've never touched frontend before - I have no clue ...
user avatar
1 vote
1 answer
38 views

what are the components of the variable assignment log entry

on finest, my log entry looks like this: 09:30:19.490 (8458283328)|VARIABLE_ASSIGNMENT|[231]|this|{"c":"0x2980752a","tasks":"0x6e159af1"}|0x3de7ae9e It's a ...
user avatar
0 votes
0 answers
28 views

Is there a way to limit computer device login access through Transaction Security Policies?

I have a use case where a company wants to restrict salesforce login access to non-company computers. Can this be done using an Apex Transaction Security Policy?
user avatar
-1 votes
0 answers
16 views

Can we update <apex:outputField value="" in VF page with data from email template which user receives through Visualforce trigger [closed]

Once user receives an email and click on link, Visualforce page will be display. Can we update the page content with content used in email. Each user will get unique details on page content.
user avatar
-1 votes
0 answers
4 views

Can we update <apex:outputField value="" in VF page with data from email template which user receives through Visualforce trigger [duplicate]

Once user receives an email and click on link, Visualforce page will be display. Can we update the page content with content used in email. Each user will get unique details on page content.
user avatar
0 votes
1 answer
28 views

Is Apex Callout chaining from Javascript controller using Async/await or Promise possible?

I need to make 5 callouts serially. I have written 5 different apex classes. I want to chain these callouts from JavaScript controller using Async/Await or Promises. Had anyone worked on such scenario?...
user avatar
0 votes
1 answer
44 views

How to show results of map<> written in Apex from LWC JS and HTML

This is my Apex Class: public without sharing class VF_SurveyResponsePOC { public static Set<Id> setOfResponseId = new Set<Id>(); @AuraEnabled(Cacheable= true) public static ...
user avatar
  • 9
-1 votes
1 answer
39 views

Day calculation is not correct

Why this code is not providing the exact day of the week? Date d = System.today(); Datetime dt = (DateTime)d; String dayOfWeek = dt.format('EEEE'); System.debug('Day:'+dayOfWeek); When I execute this,...
user avatar
0 votes
1 answer
41 views

How to assign the lead owner data to contact in a trigger?

I'm trying to create a trigger that creates an account and contact when the lead status is changed to a given value. The contact value needs to come from the Lead Owner User. How can I achieve that? ...
user avatar
1 vote
1 answer
34 views

"Variable does not exist" error where variable is a class does exist

I have an Apex class OpportunityUpserter with a static method, where the static method makes a call to another static method in a class called IntegrationUtilities, as shown below. This gives me a ...
user avatar
  • 113
0 votes
0 answers
33 views

Community/Experience Profile User does not obey DMLOptions - triggerAutoResponseEmail = false

When running this code as a community user to create a case the Auto-Response email rule is being triggered Case myCase = new Case( AccountId = company.Id, ContactId = ...
user avatar
1 vote
0 answers
24 views

How to make a single column editable in Visual Force?

I am using visual force to show the parent and child at a single table. Now I want to make a child column editable. When I click on Class Notes Only the first row is editable but another row is not ...
user avatar
-1 votes
0 answers
15 views

Script or any way to change all my org Profile session time out time in session settings

Is there any way to create a script to change sessions setting to over 60 profiles in my org? I need to change the session time out option in profile session settings for all profiles (over 60). If ...
user avatar
0 votes
1 answer
41 views

How to populate records into specific wrapper structure?

There is an external system, from which I need to pull (via REST request) information about, let's say, brands and their categories. After the request, I need to collect the data in such structure: ...
user avatar
-1 votes
0 answers
20 views

Duplicate object with same field

With this code , I successfully duplicate the object Template__c by creating a new one . I need to do the same thing for the object Template_Section__c . Using the same function , and I want to have ...
user avatar
3 votes
0 answers
74 views

Apex tests fail in Dev Console Test Suite but pass when run individually

Background There is a test utility class Class is marked as @isTest There are 5 methods Methods are not marked as @isTest because they have parameters All methods are static All methods call ...
user avatar
  • 2,119
1 vote
2 answers
39 views

Prepopulating company name in Lead object

I want to prepopulate the Company field in the Lead object. The idea here is that I don't want a Company Name in my Leads ie the Account object is not necessary for me. Now, as you know the company ...
user avatar
  • 109
-2 votes
0 answers
29 views

Constructor not defined: [GenerateGLpostingBatch].<Constructor>()

I'm trying to delete a trigger (a simple task) but for some reason, I keep receiving the following error no matter how I delete/amend the trigger. Constructor not defined: [GenerateGLpostingBatch].<...
user avatar
0 votes
1 answer
14 views

Run Trigger handler class in execute anonymous with old map newmap

Trigger createCbQuoteTriggerHandler.getOpps(Trigger.new,Trigger.oldMap); Handler class public static void CreateOpportunity(Map<Id,Opportunity> oldData, List<Opportunity> newData){ ...
user avatar
0 votes
1 answer
31 views

Aggregate result not working in soql query

im new to visualforce and i have this problem: I have a sObject with customField1__c, customField2__c, customField3__c. In my main page (with a standard controller and an extension) i want to display ...
user avatar
0 votes
2 answers
30 views

How to rewrite that ternary operator code to if-else?

I can't understand that part of the code - how to rewrite this to if-s and else? Especially the partthis.map1?.containsKey(custom_object__c?.workflow_status__c) List<custom_object_2__c> ...
user avatar
  • 3
0 votes
1 answer
45 views

Apex Class CallOut

I'd like to apologize in advance as I'm quite new to writing APEX Classes / Triggers. I've followed a tutoriel of which the aim is to POST a comment to an external system, in this case it's Jira. I ...
user avatar
-1 votes
0 answers
34 views

Write the following apex trigger [closed]

Anyone can help me to write following trigger: Find the first 2 contacts with the highest salary and update the name in a custom field separated by a “,”. Create a new custom text field on account ...
user avatar
0 votes
0 answers
42 views

Is it right way to check CRUD Permission in LWC?

import { LightningElement, wire } from 'lwc'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; import ACCOUNT_OBJECT from '@salesforce/schema/Account'; export default class CheckPermission ...
user avatar
  • 1
0 votes
1 answer
45 views

Test class for schedulable apex sending email with list of opportunities

Hi please help me write a test class for a schedulable apex class that sends an email to all users who have a checkbox on their user checked. //Send email to users where receive Grants email = TRUE ...
user avatar
  • 21
0 votes
1 answer
27 views

How do you identify OpportunityLineitems that span 12 consecutive months?

I'm trying to identify Opportunity products from the same Opportunity and the same product that spans 12 consecutive months based on start date/end date fields. I can easily tell if one line is 12 ...
user avatar
  • 3,336
-1 votes
0 answers
22 views

Execute trigger event if data is came from authorized app [duplicate]

I have created an apex trigger on behalf of client using rest API for an update event on case object. I want to execute this trigger only when the case is created using rest api through my connected ...
user avatar

1
2 3 4 5
685