Skip to main content

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
2 answers
1k views

Get values in a List from JSON

I'm doing a REST API call to get the global value set and trying to deserialize the JSON result to get the picklist values in a List. Here is the JSON: { "size": 1, "totalSize"...
1 vote
1 answer
1k views

Salesforce data move utility (SFDMU) plugin

I found in the forcedotcom github repo this plugin: SFDMU; i've read the documentation, but i didn't understand how it works for sObjects relationships. Can someone with more experience with this ...
0 votes
3 answers
54 views

How to find the max amount of an opportunity without using aggregate result in apex trigger?

Trigger Handler: public class oppHandler { public static void updateoppName(List<Opportunity> oppList,Map<Id,Opportunity> mapoldOpp) { Set<Id> accIds=new Set<...
0 votes
1 answer
840 views

Field is not writeable: Account_Merchant__c.Merchant_Name__c

I'm trying to chage the value of Account_Merchant__r.Merchant_Name__c, if it's blank to 'Missing name'. But i get the error Field is not writeable: Account_Merchant__c.Merchant_Name__c. What is could ...
1 vote
0 answers
27 views

Graph api and Flow Triggers

I'm really new to SalesForce api and processes. My requirement is to update a custom object in SF 'customObject'. The records are logically grouped with a field 'fieldGroup'. After create/update of a ...
0 votes
1 answer
24 views

How to create a Apex Trigger to reassign record ownership of Email-to-Case Attachment and Files to Case Owner?

In our Org, Email-to-Case Attachments are also stored as Files. And that the default owner is an Admin. When a case with an attachment is reassigned to another user (non-admin), the attachment ...
-1 votes
1 answer
25 views

How can I inject an Account Id into a vf page url after redirecting to that page?

We currently have a basic homepage for our experience site which we think it pointless and want to replace with a custom vf page that is an account record page. If a user logs in through the log in ...
1 vote
2 answers
424 views

How to lookup Calculation Matrix without Calculation Procedure

How can i lookup data from a Calculation Matrix without making a Calculation Procedure? I have already tried using this Apex class called: vlocity_cmt.DefaultPricingMatrixLookupImplementation. The ...
2 votes
4 answers
5k views

Batch Apex to trim leading zeros

Can I write a batch apex to trim leading zeros from couple of fields. There are 2 number fields with around 1 million records with leading zeros. Batch apex or any other way? Which should be much ...
2 votes
1 answer
72 views

Error relinking cloned line items to the cloned sobject record

The below is what I am trying to do - Get a list of purchase orders with its line items. Update the status of the purchase Orders to Rejected. Clone the purchase orders with its line items. Set the ...
0 votes
1 answer
34 views

How to do an Apex class test coverage [duplicate]

How can i test this code, and The response class os on another page global class Taxa_datadas { @InvocableMethod(label='Get Conversion Rates' description='Retrieve and sum conversion rates within ...
1 vote
1 answer
95 views

In APEX, is it possible to add content inside a BLOB?

I have a piece of JAVA code as follows: public static byte[] PackFile(String file) throws IOException { File f = new File(file); if (f.exists()) { String fileName = f....
0 votes
2 answers
52 views

Get full Endpoint of a NamedCredential-based HttpRequest without making a SOQL

So you have an ordinary code that makes a callout using Named Credentials: HttpRequest request = new HttpRequest(); request.setEndpoint('callout:NamedCredentialName/someAdditionalPathHere'); ... ...
-1 votes
0 answers
18 views

How to get value of chat started from body to field value by using trigger

public with sharing class LiveChatTranscriptTriggerHandler { public static void onBeforeUpdate(List<LiveChatTranscript> newTranscripts) { for (LiveChatTranscript transcript : ...
0 votes
1 answer
37 views

AppExchange Application

As a salesforce partner we are going to upload a managed package to AppExchange. We need to update our codebase and upload it to apply. I tried using the code analyzer, but the topics were very ...
0 votes
0 answers
17 views

Platform Events and NetSuite [duplicate]

I want two way sync with NetSuite with realtime data updates. I feel that Platform Events will be the best solution for this but I am curious how authentication works when publishing to them. Also ...
1 vote
0 answers
15 views

How to pass parameter from Lightning flow to Lightning Email Template to LWC

I have a requirement to display a list of records in email. Records are constructed from 3 objects. Since it's not possible to use a list in the Lightning template I decided to use LWC in the ...
4 votes
4 answers
12k views

Possible to Break Out of a Loop in Flow Builder?

Background I've set up a nested loop, containing two loops in total, in a Flow: If certain conditions are met while iterating through records in the loops, I would like the Flow to exit/break the ...
1 vote
0 answers
25 views

Request.getCurrent().getRequestId() returns the same id if called inside a queueable chain

So if a have a chain of queueables that send outbound messages I grab the requestId using Request.getCurrent().getRequestId() and send it with the request for uniqueness it returns the same request ID ...
0 votes
1 answer
963 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
0 answers
14 views

How to create a dashboard filter that works as case owner for case report type and created by for email report type

Same as the title. I want to create a dashboard filter that works as "Case Owner" filter for case reports (based on case custom report type) and "Created by" filter for email ...
-6 votes
0 answers
41 views

What is the basic skill to become a Salesforce developer? [closed]

I'm a fresh graduate and planning to start my career in salesforce domain. Anyone to give me a right path way to become a salesforce developer?
0 votes
1 answer
34 views

is that possible to check current managed package version name on post install script

When upgrading managed package, i need to check current pacakage version name contains BPM then i need to remove picklist values using post install script. how to check current pacakage version name? ...
0 votes
0 answers
27 views

Salesforce Apex - POST multipart/form-data Content-Type + TEXT

This is the second case that I open regarding this topic to ask more specific questions (the first Using blob variables in apex code) In the first one they already indicated to me a first solution ...
0 votes
3 answers
1k views

execute apex code from a aura component

Im trying to create a group in a chattool using aura component in salesforce. when i run the code for creating a group in developer console it runs fine. But i want to to execute when user press a ...
1 vote
1 answer
27 views

@RemoteAction - static method variable access

is there any way to access the variable outside the method and inside the same class? 'selectedvalues' List variable is declared as static variable in same class @RemoteAction public static List<...
0 votes
1 answer
44 views

SOSL query on ContentVersion not returning consistent results for all users

I need to search for keywords in some files in Salesforce. I am using the following SOSL query for the same: FIND {search_term} IN ALL FIELDS RETURNING ContentVersion(ContentDocumentId, FileExtension, ...
0 votes
1 answer
3k views

Code Coverage to test Custom metadata in Trigger Class

i have a Trigger class with metadata and i want to make a test class, but i don't know how i do with custom metadata. The custom metadata is a list that automatically adds member status to each ...
1 vote
1 answer
5k views

How to create contentversion by using file url?

We want to create ContentVersion related to the account object. We have one field on account which contains the URL of the file(png/jpg/pdf). And by using that URL we want to create ContentVersion. ...
0 votes
0 answers
36 views

Using blob variables in apex code [duplicate]

Good afternoon, A while ago I made a post on this topic to see how to send blob variables from a visualforce to the controller. Finally I did not find any solution that was useful to me, so I chose to ...
1 vote
1 answer
140 views

What is the difference between Blob.valueOf and EncodeUtil.base64Decode?

I've a scenario where i'm saving the file as content version is attching to a record when i use blob.valueOf() it's failing and when i use EncodingUtil.base64Decode() the method is creating record . I ...
0 votes
1 answer
4k views

How do I insert a multiple list of records into an object which is from the result of a SOQL query in trigger?

I get multiple records from the records list and now I want to insert as new records in an object. Should I create a map or should I do that? records output is checklistTemplate__c:{Name= Test, Id = ...
0 votes
0 answers
20 views

why is richtext field replace function in before insert not working?

I am trying to replace the Prefix of the image tag URL in the RichText Field. Below is the sample code. trigger Comment_Before_insert on Comment__c (before insert,before update) { trigger. New[0]....
0 votes
1 answer
1k views

Flow Complex Apex Defined

I'm trying to pass an apex defined variable from LWC to flow, the class looks like this: public class Subs { @AuraEnabled public String name{get;set;} @AuraEnabled public List<...
0 votes
1 answer
494 views

B2B Commerce: Error getting or creating webcart

I'm trying to run some apex tests in our Webstore (there's just one in the org), in a scenario that the test class creates dummy user/account/contact/buyer group/products/cart to finally test some ...
0 votes
3 answers
851 views

How to manage both single and an array of json reponse from the same external system?

I have a situation where when I make a callout I get a single json response like this: { "Person": { "Infomration": { "IndividualInformation": { ...
2 votes
1 answer
446 views

TABSET_LIMIT_EXCEEDED error when assigning permission set to automated process user

I'm attempting to assign a permission set to the automated process user but I'm getting the following error: System.DmlException: Insert failed. First exception on row 0; first error: ...
-1 votes
0 answers
23 views

Test Coverage less than Actual Coverage

I'm working on creating and updating test classes for my company's org, but I'm running into an issue where the code coverage for a particular Apex class in currently showing as 32% after all tests ...
0 votes
1 answer
1k views

Pass parameter to apex class method referenced in trigger through LWC

I have a trigger where I'm calling a method from handler class and I'm passing the trigger.New to that method like this: if(Trigger.isBefore && Trigger.isInsert){ List<Lead> ...
2 votes
2 answers
2k views

update and insert not working

Upsert not working..update and insert not working..need help I have tried using the example given in salesforce visual force developer guide for upsert. It just inserts a new row. I tried in a ...
1 vote
1 answer
48 views

SALESFORCE_AUTHENTICATOR Enabled for a user

How to identify if a given user is already linked with SALESFORCE_AUTHENTICATOR. I want to delink user from SALESFORCE_AUTHENTICATOR using an apex logic but before doing it I want to put a validation ...
2 votes
1 answer
1k views

Check from Apex whether user has verified their email

I am currently using the System.UserManagement.sendAsyncEmailConfirmation method to send a verification email to new community users when they sign up. I can create a view from the Users page in setup ...
10 votes
2 answers
1k 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
1 answer
999 views

setCallback returning error state for saving records to salesforce

currently I’ve been following the aura components module in trailhead, with the main variation being that I'm using the Opportunity object, and I’ve run into a road block. For some reason when I try ...
1 vote
1 answer
33 views

Variable does not exist compile error

I am running into the good ol' variable does not exist error while creating a simple trigger on the case object. As other posts here have suggested, I've checked for a class with the same name as Case ...
1 vote
1 answer
159 views

Is There an Apex Equivalent to a Flow Scheduled Path?

We have a Case follow-up process defined in a Flow as a Scheduled Path. Is it possible to implement the same functionality in Apex? Under the hood, is the Scheduled Flow Path implemented as a ...
6 votes
1 answer
1k views

Can I get all existing Pages for a Community using Apex?

I would like to create a custom component to use in Experience Builder, and this component will allow a configurable navigation to another page. I would like to use a dynamic picklist with Apex to get ...
0 votes
0 answers
31 views

How to fix SLDS updates in new release, issue for tab icon color

I have following code working perfectly with tab icon color brings up perfectly. Suddenly after today's release patch it got failed, Any idea to enable tab icon color ? HTML: <template> <...
0 votes
1 answer
41 views

Update Last Modified Date One day before in Test Class

How to update last modifed Date five minutes before in Test Apex class? Datetime yesterday = Datetime.now().addDays(-1); Test.setCreatedDate(testLeadTwo.Id, yesterday); Test.setCreatedDate(...
2 votes
1 answer
842 views

Is there a way for describing a List View and determining columns within APEX (without metadata service api)?

I've been reviewing the very promising APEX Metadata Namespace in Summer '17 (API v40.0) - Release Notes (Preview) But I'm unable to find any reference for retrieving ListViews of any Object. I'm ...

1
2 3 4 5
739