Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [code]

Code indicates that a question is to do with pages, controllers or similar, and not the declarative aspects of the platform.

Filter by
Sorted by
Tagged with
4 votes
1 answer
214 views

Optional chaining - change

I have code in production for many months and it start to be problematic. this code involve if condition with Optional chaining. Here is an example List<case> cases = [Select id, Status__c FROM ...
Raphael D's user avatar
  • 616
-1 votes
1 answer
44 views

How to access existing code in Salesforce

I am an admin but not familiar with apex coding. How do I access existing code? Is it through Developer Console? As I am looking through the related questions, I came across Visual Studio Code ...
DigitalCS's user avatar
-1 votes
2 answers
1k views

Expected double-quoted property name in JSON at position 6025 (line 1 column 6026)

I'm trying to view code coverage using my vscode but after running test if I enter in the class I was testing, I have this error and I can't see the code coverage and the percentage anymore. Thx in ...
Papa Ibrahima SOW's user avatar
2 votes
2 answers
115 views

Consistent spacing in Lightning card

I am displaying Lightning cards & have a problem where the card contents & card height of the cardsaren't lining up correctly when a certain field (TextAboveImage) has content or doesn't. ...
Michele Kleinhomer's user avatar
1 vote
1 answer
168 views

LWC: Making child cards grow with each other

I'm very new to all of this, so apologize if this is obvious to others. I have four cards that I am using in a parent lwc. The content of each is different, but I want all of the cards to be the same ...
Lauren Sweet's user avatar
-1 votes
1 answer
63 views

Queueable Apex Running For Long duration

I am triggering a queueable apex but the class running for very long duration is very small class and perform apex sharing.
Mkg789's user avatar
  • 1
0 votes
1 answer
38 views

How to Get the Least significant Bit in Apex?

Like in Java we have a function Integer.lowestOneBit(i) or return I & -i. Does Salesforce support it or not, If there is an Alternative?
prakhar gupta's user avatar
-3 votes
1 answer
77 views

Apex test class not working and fails

I have the following apex class: public with sharing class TT_DisplayRelatedOpportunities { @AuraEnabled(cacheable=true) public static List<Opportunity> getOppList(String recordId) {...
Marjan's user avatar
  • 15
0 votes
2 answers
69 views

How to Combine Setter Methods together with redundant code?

I'm thinking there is a lot of redundant code in my setter methods, and I'm wondering if there is an effective way to combine them to get rid of some of the redundancies. How should I go about doing ...
user avatar
0 votes
1 answer
251 views

Trigger to update Case Status if Status = Waiting on Internal and gets a new FeedComment

I have this block of code to update case status when we receive a new FeedComment on a case. But I want to update it to only update if the case has a status of "Waiting on Internal" or "...
Cella Mcgowan's user avatar
0 votes
1 answer
506 views

Can anyone help me with this error? static can only be used on methods of a top level type

public class CloneCaseController { public static void cloneCase(Id caseId){ // Retrieve the original case record Case originalCase = [SELECT Id, Subject, Description, ...
Samarin Banu's user avatar
1 vote
2 answers
56 views

Issue with overwriting a checkbox field through apex

if(e.No__c==3 && e.Contact__r.Completed__c==true){ e.Contact__r.Completed__c=false; System.debug('varcheck02'+e.Contact__r.Completed__c); System....
Sandeep's user avatar
  • 13
-1 votes
1 answer
369 views

Resend Docusign Envelope Through Apex Code

I am new to Docusign . I have a usecase which we need to resend docusign envelope based on the recipients those who are not signed . Did any one have a sample code means please share here
Krishna Babu's user avatar
0 votes
2 answers
290 views

Checking if Territory has Users

Is there a way to check if a territory has a user assigned? I tried using UserTerritory2Associations to query by a TerritoryId and log 'doesnt exist' or 'exist' if the result is null or not. But it is ...
Vicky's user avatar
  • 1
0 votes
1 answer
131 views

REGEX too complicated in breaking a soap API response

I am working on an apex class that makes a soap API callout and receives a response. To see the complete response in debug logs, I am using a splitString() method to break down the XML response at nth ...
Balaji Pooruli's user avatar
0 votes
1 answer
214 views

Salesforce Web-to-Lead Form Column Separation

I'm trying to separate the following into two columns. Separation after the "phone" field. I'm using the code provided by salesforce to upload to our website. Also hoping someone can help me ...
Bluefin's user avatar
0 votes
2 answers
70 views

replace prefixes

Im not sure if I doing this right, I got phone numbers in a form like Phone = '+421\+42199940054' Phone = '+421\+421%' . . . wrong thing are prefixes, wanted only second '+421' My code List<Lead>...
jur1s77's user avatar
  • 47
5 votes
2 answers
771 views

How does js files behave when same lwc is repeated in a component?

I'm working on an lwc where I noticed an interesting behavior. Scenario: I have an lwc with the name "myLwc"(imaginary). It has the following files. myLwc.html myLwc.js myLwc.js-meta.xml ...
Manu Murukesan's user avatar
0 votes
1 answer
2k views

sendEmail not working from Apex code/Anonymous Window

I am executing below simple lines of code to trigger an email to my Inbox. I am not receiving the mail and also I see on the logs that there are no errors Access level is already All Email in my org. ...
Ashfaq Mohammed's user avatar
0 votes
2 answers
90 views

Simple Apex code snippet not behaving as expected

Integer delay = 1; for(Integer i=1;i<=5;i++) { System.debug('Print '+i); Long sTime = System.now().getTime(); while ( (System.now().getTime()/1000 - sTime/1000) < delay){} } When ...
Suhasini's user avatar
  • 307
-1 votes
1 answer
43 views

Formula Field and pick list [closed]

IF(AND(ISPICKVAL(Employee_Title__c ,'Software Engineer'),50000, IF(AND(ISPICKVAL(Employee_Title__c ,'Senior Software Engineer'),70000, IF(AND(ISPICKVAL(Employee_Title__c , 'Team Lead'),90000, IF(AND(...
Leena's user avatar
  • 1
0 votes
1 answer
347 views

What is the meaning of double percentage signs with square brackets?

I am currently working inside a Marketing Cloud Landing Page. The page has code inside an HTML block. Some of the code is within a script tag like this <script type="text/javascript">...
Waldi's user avatar
  • 3
0 votes
2 answers
577 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> ...
Fgh999's user avatar
  • 35
0 votes
1 answer
752 views

Test class for covering running user current application info

I have a class where I am using a method that returns the application label of the current logged in user. I am using that class method in another class method and based on the returned app name, I am ...
Pratikshya Satapathy's user avatar
0 votes
1 answer
1k views

Update Custom Metadata Type Record

I have a controller that updates/creates metadata type records. It works fine for the creation of new records, but when I try to update existing records, I get this error duplicate value found: ...
Serhii's user avatar
  • 1
2 votes
2 answers
656 views

Does SOQL query on Attachment Object needs to be done asynchronously?

Problem statement: External system is creating a custom object record and placing an attachment to the same record via composite REST API. After Insert trigger code that runs immediately for further ...
arut's user avatar
  • 5,281
0 votes
1 answer
843 views

Visualforce Page Quote Template, Display jpg from Rich Text Field or Rich Text

In our quote templates, some sites have very specific site terms where logos have to be displayed in the Quote. Currently, the Site terms are in a Text field (Site_Information__C) that gets pulled ...
Thomas Legrand's user avatar
0 votes
0 answers
80 views

Split throught % of Open Rate

I have a journey where I send a 1st email and after that email I have to evaluate the opening % of that 1st email. In one way I will send another email to everyone who has an open rate > 20% and ...
CS_94's user avatar
  • 1
0 votes
1 answer
198 views

Will Method called in for loop with Update statement(dml) will have governerLimit Issue

I have below requirement ,i have called method in for loop ,i want to know 1.Will this cause an Dml governer limit issue? 2.how we can optimize the below code Requirements - Update Primary contact on ...
santu's user avatar
  • 3
0 votes
1 answer
79 views

Not able to check map condition in trigger

I have a requirement where on Update of account I need to check case if contactId is present and if that contacts Account is same as Case accountId then need to update one field. I have written some ...
santu's user avatar
  • 5
0 votes
2 answers
326 views

Better way of searching for values in apex list

I have a list of unique strings say 'one' to 'ten' as below: List<String> values = {'one', 'two', 'three','four','five','six','seven','eight','nine','ten'}; I have a requirement to check if the ...
Suhasini's user avatar
  • 307
0 votes
0 answers
2k views

Adding css/js code resources into a Marketing Cloud Landing Page (Preference Center)

I want to start by saying I am very new to html, css, and js. So this may seem like a stupid questions. After I upload my CSS file upload into Marketing Cloud using the code resource, I have added the ...
LGW's user avatar
  • 1
0 votes
1 answer
666 views

Alternatives for multiple If statements

I need to compare the fields and depending on that if its true then update a boolean variable and if its false then capture this field and get the label and append it to a string. I have like 10-12 ...
Raham's user avatar
  • 43
-3 votes
1 answer
698 views

Trigger Apex Trigger if a custom field (bool) is true

I have this code that sends information to a webhook, I only need to send information when the field WebTrig__c (checkbox) = True. I wrote this code but for both cases it sends the information to the ...
Elie Antoun's user avatar
-1 votes
1 answer
200 views

How to validate if records are inserting /updating through external tool(dataloader,workbench) and not from UI

I have requirement where i need to run method inside trigger only when if records are inserting/updating through UI not from (DataLoader/Workbench). Please suggest if we have any solution ..Not able ...
Sandy's user avatar
  • 7
0 votes
1 answer
145 views

Do we need to perform static and dynamic code analysis for packages that are published as unmanaged packages in salesforce?

Do we need to perform static and dynamic code analysis for packages that are published as unmanaged packages in salesforce? Or the salesforce platform take care of them?
user3361892's user avatar
0 votes
1 answer
353 views

Edit Lighting Web Component and retrieve code

My org recently had a lighting web component written launched into production. Unfortunately, the team we outsourced this to left off a necessary field. I would like to edit this code to include this ...
Mack Brooks's user avatar
0 votes
1 answer
1k views

Update fields but only if the value is changed [closed]

I would like to update a field in an object, only in case a value was received, otherwise nothing changes in that field. Is that possible? If yes, how? I can't use the following code because I want to ...
Randall Flagg's user avatar
0 votes
0 answers
102 views

Page Reference and If Statement

I am looking to add another if/or statement that will also look for if the phone number is Anonymous to be redirected to the contact page. Here is what I have. It is working but I need to add ...
Earlene Jones's user avatar
0 votes
1 answer
992 views

Split the string from right side to get the required output after second occurrence of special character

I have requirement to get the string by splitting right side Ex 1.abc-sgd-ajj-test output needs to be in string = abc-sgd test-string-split-exam-demo output needs to be in string = test-string-...
Sandy's user avatar
  • 7
-2 votes
3 answers
7k views

How to pass a list from one method to another

I have three methods: Method1: public static void method1() { // call method 2 that returns a list method2(); // call method 3 and pass list retuned from method 2 method3(myList); } Method 2: ...
MShal's user avatar
  • 31
1 vote
1 answer
329 views

PMD showing errors for one class, but not another class with the same issue

I just installed PMD and its pretty janky from my experience, for example I have two classes and it shows the "same name" error for one class but completely ignores it for the other class.......
happyLion's user avatar
0 votes
1 answer
1k views

How to avoid for loop and use map or some other technique for below logic [duplicate]

I have below code ,but not able to understand how i can avoid second for loop inside account please suggest public static void getOpenCaseOnAccount() { Map<id,user> userIds = new map<...
Sandy's user avatar
  • 7
-2 votes
1 answer
1k views

how to compare old and new values for specific fields in trigger

I have requirement where I need to compare few fields in account object, If there is any change in the value of any of the field I need to insert into log object. Those fields can be change later as ...
sandy's user avatar
  • 3
0 votes
0 answers
61 views

Generate random Password with Special Characters? [duplicate]

Is there a way to use the below code, but also add special characters? I need to generate a random 8 character password, that includes special characters. Is this possible? Any assistance will be ...
DevWannaB33's user avatar
1 vote
2 answers
6k views

How to find duplicate records from the list based on 2 fields values?

I have a requirement where I need to find duplicates and remove from the list, but I am unable to figure how to iterate and remove duplicates. Can anyone please help me with this? I don't want to use ...
SF_Learner's user avatar
0 votes
1 answer
2k views

Illegal conversion from List<OpportunityLineItem> to List<Opportunity>

Good day, Still finding my way around Apex. Please assist with the mentioned error. I'm not sure what's wrong with my code. In essence, I'm trying to retrieve information from a related list(Opp ...
DevWannaB33's user avatar
1 vote
1 answer
104 views

Help fixing Apex Error

Does anyone know how I fix this error in my aura lightning component? My action isn't retrieving the Opportunity records anymore. It was working fine last month, but has stopped working. I am new to ...
Sophia's user avatar
  • 31
1 vote
0 answers
633 views

Problem : Behavioral trigger abandon basket

I try to set up the behavioral trigger on the abandoned basket. I created the product catalog with the required fields including the product_code which seems important. I made sure that avaibility on ...
Golden Abagnale's user avatar
0 votes
1 answer
1k views

Assigning Task when opportunity it closed won

I have this code that creates a task when opportunity is closed won, however it needs to be assigned to one specific person only. trigger ClosedOpportunityTrigger on Opportunity (after insert, after ...
Alex van der Merwe's user avatar

1
2 3 4 5 6