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

Combine two variables in lightning component

How to combine two variable in same variable . I want to get both of values in another variables groupMembers3. const groupMembers = component.get('v.usersToAdd').map(u => u.Id) ; const ...
0
votes
0answers
44 views

Help, Trailhead unit Create a permission-based test

I am trying to complete the Unit Testing on the Lightning Platform module and am stuck on the Create a permission-based test. I get the error "At least one of the test methods in '...
0
votes
1answer
36 views

Field Not Writeable

I have an Apex Class which updates the User.IsPortalEnabled field. But it throws the error: Field is Not writable. How can I fix this error? public without sharing class UserHandler { public ...
0
votes
0answers
34 views

Code coverage issue RecordType.Name required [duplicate]

I am trying to fetch the RecordType.Name in a list, but my list doesn't has the value displayed. Please find below the block of code and the list 'clist' where I need the RecordType.Name This is in a ...
0
votes
1answer
32 views

How to put in SQL to see only records that in the field do not have specific data in the marketing cloud?

I am facing a problem when trying to filter the leads and contacts that come from CRM to be used in email marketing. The idea is that the filter does not add people who have the field conta.Name equal ...
0
votes
0answers
29 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
41 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
29 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
47 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
30 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
46 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
45 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
33 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
97 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
145 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
11 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
33 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
43 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
25 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
17 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
23 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
190 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
35 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
103 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
40 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
30 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
249 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
132 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
235 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
274 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
117 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
45 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
51 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
263 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
122 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
42 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
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
99 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
215 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
450 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
3answers
7k 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 "...

1
2 3 4 5