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
0
votes
0answers
7 views

Salesforce CPQ Code Issue in calculating New new revenue

Error: Apex trigger SBQQ.ContractAfter caused an unexpected exception, contact your administrator: SBQQ.ContractAfter: execution of AfterUpdate caused by: System.DmlException: Insert failed. First ...
0
votes
0answers
39 views

Your code coverage is 73%. You need at least 75% coverage to complete this deployment [duplicate]

Already run test but no luck. public class UNILAB_NMAP { /* wrapper class to store required properties for "lightning:map" component' */ public class accountLocationWrapper{ @...
0
votes
2answers
27 views

Optimization of code removing extra if and else block

I need to remove the extra if and else loop as per the req and need to make it short for reading of the code should be easy. can anyone suggest some better for below: if (data[0].FA_N__c) { ...
0
votes
1answer
32 views

Is it possible to use <pre> / <code> preformatted text field within a LWC component HTML file?

I'm trying to display code as text, unrendered. However, when I use the <pre> or <code> tag with html tags within it, LWC is rendering what is inside those tags in the browser instead of ...
0
votes
0answers
29 views

SOQL EventRelation is Test Class

The issue with SOQL on EventRelation filtered by Relation.Type is working as expected during normal execution. However, while executing the following LOC in test class it causes failure. Code: List<...
0
votes
2answers
35 views

Relationship queries

I have started learning relationship queries. I have created a new field in case, contacts and opportunities which are related to accounts.I want to update that new field with account's type field. I ...
0
votes
0answers
34 views

Package Retrival is not working

We are trying to retrieve the package from Salesforce Developer org While performing the retrieve we are getting errors for the below components. [sf:retrieve] package.xml - Metadata API received ...
0
votes
1answer
32 views

Design Pattern Help: Extended Interfaces with methods that shared the same functionality/code

I'm trying to figure out the best pattern for the code below (example: not actual code). IOpportunitiesA and IOpportunitiesB are extending the base interface and they have a similar method, ...
3
votes
2answers
55 views

VS Code - Snippets Library?

Before I go through and recreate all my most commonly used snippets in VS Code, does anyone know if these have been created for apex already? ..and if so where I can find them? I have checked in the ...
1
vote
1answer
50 views

Prettier formatting tabSize and printWidth

In VS Code preference, I set the Tab Width = 4 and Print Width = 120, but when I format, I can still see the tabSize being 2. Is there any other configuration that I need to do? Thanks.
0
votes
0answers
9 views

Can we update the status in approval history of any object?

So i created a approval process in which if the approval criteria is not matched it is auto rejected. To that i updates the case status to Approved whenever it gets auto rejected in before update ...
0
votes
1answer
29 views

AMPscript in HTML - check c

I'm writing a code for personalize an email with product name , image, price (all in the same lines, three "boxes) The current layout include a visualization of up to 4 products and a structure like ...
0
votes
1answer
42 views

Apex trigger To throw an error if case is updated with ContactId Which is associated with Account

I have requirement where on Case Update if ContactId in same of accounts contact associated with that case then needs to throw an error. Example; Case 1 AccountId 1 and contactId 1 If case 1(...
0
votes
0answers
19 views

Logic to update account on basis of cases and contact match [duplicate]

Requirement- I need to get all open cases from account and need to see in that open case if account related contact and case contact is same if yes then add that contactId in accountContact__c text ...
0
votes
0answers
24 views

new instance of object creation for updating a record

Requirement-I have custom object request__C where i am storing sourceAccount ID and TargetAccountID. My requirement is to update the field in request object with max contact in any of the account. ...
0
votes
2answers
36 views

Not able to get max amount and update the status in Apex

i have requirement where i need to get all orders from account and need to check max amount from that order and need to update the status of order to InProgress. then from account1 ==>order4 needs to ...
0
votes
1answer
13 views

not able to update contact based on the requirement-seems bulkification issue

i have requirement where i am passing list of accountuuids to method 1.If contact with same accountname not present then create new contat call as shadow contact 2.if contact with same accountname ...
0
votes
1answer
16 views

Access audit trail data outside of salesforce

I need to pass audit trail data to informatica. Can anyone suggest how informatica extract the data. is there any way to query audit trail or any standard api to fetch data
0
votes
1answer
22 views

Apex class on Lead needs to review

Requirement-- I have one custom Object(Lead_map__c) where values are stored Like leadSource={'Web','Email','Phone'} and respective userIds in userId_assignee__c column Whenever lead is updated with ...
0
votes
1answer
29 views

Difficulties to retrieve values from Junction object in apex

Requirement I have 2 objects(sale_product,sales_Product_parts) one product can have many parts and one part can be assign to many product) i have created juntion object to achieve this. My ...
0
votes
2answers
28 views

facing issue to build a trigger on Opportunity to create a task

Requirement- I need to create a task on the opportunity when stage changes to Need analysis. but if a task with description already presents with 'Need analysis' for this opportunity then no need to ...
0
votes
0answers
94 views

System.JSONException: Invalid numeric value: Leading zeroes not allowed at input location [1,2]

I am getting the error mentioned in title of this question when I am calling one of my class method from a test class which is there to send the email with an attachment. Inside that method which is ...
-2
votes
1answer
25 views

Not able to update account using rest API

I am trying to update account record using Rest ,but i am getting error **CALLOUT_RESPONSE [17]|System.HttpResponse[Status=Bad Request, StatusCode=400]** Code global class AccountUpdate{ static ...
0
votes
1answer
53 views

need to add where clause in Rest API Get request in apex

/services/data/v39.0/query/?q=SELECT+Id,Name,AccountNumber,Type+FROM+Account+limit+10 i need to add where clause here LiKE :- /services/data/v39.0/query/?q=SELECT+Id,Name,AccountNumber,Type+FROM+...
0
votes
0answers
31 views

need to update Auth provider from apex class

I have requirement where i need to update authProvider Execute as User from Apex code. I have wirtten a code but i am facing below error on update **DML operation Update not allowed on AuthProvider** ...
0
votes
0answers
13 views

How can we correct an ALT attribute accessibility issue with the igodigital tracking code?

The tracking code from SalesForce is causing accessibility issues because it's got a title tag, but no alt attribute. Assistive technology will often skip the title tag and instead rely on the alt ...
0
votes
1answer
161 views

How this method call works? 'Schema.sObjectType.Contact.isDeletable()'?

I'm struggiling to understand this line of code: Schema.sObjectType.Contact.isDeletable() I've read on the Apex Developer Guide that isDeletable is a method of the DescribeSObjectResult class that ...
1
vote
2answers
104 views

How to Document and correct indentation on apex [closed]

How can I automatically correct the indentation of my apex classes on Visual Studio Code?? I installed the Uncrustify extension but it is not working. Also is there any way to document my methods ...
-2
votes
1answer
141 views

If condition for Values in Map<string,List<string>in apex

I have below snapshot where i just wanted to check if map is having the value 20 in it or not. How i can write if condition for list of string values map<string,List<string>> getmap=new ...
1
vote
2answers
250 views

Code Coverage Failure trigger deploy on production

i have a code for trigger: trigger SendDisbursement on Opportunity (after update) { if (!System.isFuture()){ for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.old[i]....
1
vote
1answer
55 views

Explanation of an notation List<name.test> nameList

I have a piece of code as following: List<name.test> nameList In List is name a class or object. Why would we use such an annotation? Or for example: method(name.test variable)
-1
votes
1answer
92 views

Need superscript of # in apex

I have one string which needs to change with Superscript string str="ABC#"; I want add replace superscript with #. please suggest Let me Explain with Example Suppose I enetered a string **My Name ...
0
votes
1answer
35 views

Unable to view data on Lightning component but can View in console log

I am relatively new to Lightning and trying to learn it via one of the youtube tutorials and used same code for practice but I am not able to see the data on my Lightning component page. I could not ...
0
votes
1answer
45 views

Code Coverage=0%

my developer createed the following trigger and Apex Test Class. For some reason, the coverage is 0%. I need to deploy it ASAP and he already left for the rest of the week. any help is highly ...
1
vote
2answers
177 views

I do not have Prod access in my org. I want to know can we edit Lightning component in Production?

Can we edit Lightning component in production?
0
votes
3answers
106 views

Clean code way to process a list of objects

Let’s say you have a list of Accounts and you want to populate their birthday with the same date. However, you also want this method to be reusable. What is the best way to do this in APEX? So far ...
0
votes
1answer
26 views

Trigger code error

I am really new to triggers and not sure how I fix this error, please help. Thank You, Lorr
-1
votes
1answer
23 views

How to call this method from web service in my test class [duplicate]

I am not able to call this method in my test class: WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'https://www....
3
votes
1answer
41 views

Does the latest API on classes,triggers,and components provide a performance benefit over older APIs?

My thought is "no", but wanted to see if anyone had any information on this. I would assume the versions simply control how you can interact with the features in Salesforce (ex. methods you can use, ...
0
votes
0answers
25 views

Error whenever trying to insert list of records into VisualForce Page from custom controller? [duplicate]

I currently have a visualforce page with a custom controller that counts the amount of records that has a field marked as a specific status from a picklist. I need to be able to display those records ...
0
votes
0answers
22 views

Event Invitees Notification and Response in Salesforce Lightning

I am trying to build custom functionality with apex code. when Events is created in Lightning and Invitees is added to it, Email notification to invitees should be sent with Accpect or Ddecline option....
0
votes
0answers
15 views

Apex Code Coverage for if/else if test class [duplicate]

if (userList.size() > 0 ) { String profileName = userList[0].Profile.Name; if (profileName == 'CP_CorporateAdminUser' || profileName == CP_SystemConstants.CORPORATE_OPERATION) { ...
0
votes
0answers
17 views

Trigger.newMap and Trigger.oldMap not able to pass the correct values in the test Class! [duplicate]

I have a scenario to cover in the Test Class Whenever Case is assign to queue from User : particular field must get blank: public static void wmgRemoveOldGroupQueue(Map<Id,Case> newMap, Map&...
0
votes
0answers
73 views

Download Attachments and Salesforce Files from Visualforce page

I am trying to modify Visualforce code to allow for the download of an attached file to the Incident ticket. Currently the file is listed with this code, but I need it to be a clickable download ...
0
votes
0answers
179 views

Avoid Using Hard Coded Credentials for Authentication

We have done the code review by salesforce,and got "Avoid Using Hard Coded Credentials for Authentication" at quite some places where ever we are setting up Authorization Header.(On the 5th line of ...
1
vote
3answers
383 views

toLabel(RecordType.Name) and RecordType.Name in the same SOQL query

How to use toLabel(RecordType.Name) and RecordType.Name in the same SOQL query? I am trying to retrieve both the values and use them. If I can get the query to work then how can I refer the values ...
5
votes
2answers
6k views

LWC get url parameters in Community

I'm trying to retrieve url parameters through a lightning web component in my Community. For exemple : wwww.my-community.com/my-page?test=true How can I, in the new LWC framework, get the parameter "...
0
votes
1answer
215 views

Delete Account that are not associeted with a case

i want to delete all Acccounts in my Org that are not associated with a case in the apex console. How can i do it? Thanks in avance
2
votes
0answers
175 views

How can i get data from a report in apex code but only from the first grouping level?

I have a report that has more than 1 grouping level but i only need the data from the first grouping level of each row returned. I have 125 rows for the first grouping level, i only want that data. ...
0
votes
2answers
618 views

Abandoned cart Journey using data from Track Code

In Marketing Cloud (SFMC) I used the track code to add cart and purchase. How can I use the information about the abandoned cart in a Journey? Do I need to use any event? I can see in Web ...

1
2 3 4 5