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
1
vote
0answers
28 views

Can't save map from Lightning Component back to apex

I'm truly stumped by this one. I have a map of ContentVersion docs. The keys are: "Mine" and "Yours" Depending on who is logged in, you can edit field values in the datatable that has "Mine" in it, ...
0
votes
0answers
9 views

Lightning Container NPM - no controller and/or function found

I am working with the lightning-container npm package and have a call in a React app uploaded as a static resource. This simply onClick, calls the LCC.callApex method as below. LCC.callApex("...
2
votes
0answers
25 views

Apex replay debugger, which log file?

I'm trying to use the replay debugger and it seems like it would work great if I could easily find which log file just got created. I'm just doing one operation through the salesforce application (...
0
votes
0answers
20 views

Is there a way to use page headers with PageReference to send key and secret securely?

I have an old bit of code that does a redirect on a Visualforce page to a secure web-based app. It constructs a PageReference and puts key and secret required by the external app and other somewhat ...
0
votes
0answers
34 views

How to process CSV file uploaded to library in apex [closed]

How to process CSV file uploaded into library in Salesforce. Steps: User Login to salesforce Search 'Files' in App Search Navigate to Library (Eg: JustAnotherLib) Upload CSV File (Eg: CSV Records....
1
vote
1answer
37 views

How can I use queueable Apex instead of a future method with arguments?

I have an @future class, SubmitOnApproval which is called when an opportunity is approved. This class is below: public without sharing class SubmitOnApproval { @future public static void ...
1
vote
1answer
22 views

Lightning component Service Console, get and edit content of Quick Action Email Message

im trying to develop one Lightning Component for Service Console who is in charge of GET\EDIT entire\parts of Email in Case Management Quick Actions (screenshot) when the user click on the button of ...
0
votes
2answers
38 views

update List<sObject> of heterogeneous types

I have a List filled with n numbers of different object records. I want to pass this list to execute the method of the batch class and update the records. for eg: there are 3 objects object A, B, C ...
1
vote
1answer
19 views

Capturing HttpResponse StatusCodes

I'm trying to capture a HttpResponse StatusCode in a @future method so I can then send it to an email to alert a dev of a possible issue and also alert the Salesfroce user of the error. I have found ...
1
vote
1answer
37 views

OFFSET limit exceeds while implementing pagination for listing of users

Currently, we are trying to populate all users of salesforce in a Visualforce Page with page per limit of 1000 using Database.getQueryLocator (shown below) Database.getQueryLocator('select Id,...
-3
votes
0answers
28 views

Auto update parent account status when all child records are status is set to completed? [closed]

hello everyone i am new to salesforce And i am to trying implement a logic where status of parent object will be auto set to complete when all its child is status is completed.?here salesforce ...
-2
votes
1answer
42 views

Map<String,Map<String,List<Account>>> difficulty in creating this structure in apex

I have a scenario in Apex controller wherein I need to create following map: "Map<String, Map<String, List<CustomObject__c>>>" The query is below: SELECT Field1,Field 2 FROM ...
-1
votes
0answers
31 views

Update field in a relationship(lookup) [closed]

i have two objects Account(Standard object)---House(Custom Object) update the price of all Houses of the same type, with The following logic: when the price of a house is changed, the price all the ...
0
votes
0answers
26 views

Set Chatter Group Picture Using Lightning Web Components, APex [closed]

To be able to set a Chatter Group we need to follow the setPhoto methods in connect API and converting data being uploaded to blob input as mentioned in these below articles. Look at setPhoto methods ...
0
votes
1answer
48 views

Is there a straightforward way, with Apex to determine the creation order of a given Object's child records (i.e. which was created first?)?

Hoping to avail myself of the great minds in this group... I am creating code that syncs two custom fields. One of these fields is on Opportunity and the other is on Contact. The sync will happen ...
2
votes
1answer
38 views

Tooling API Inactivate Apex Trigger

I am trying to inactive Apex Trigger using tooling API. I don't see any errors, I am getting "Success" message, but Trigger is not getting updated with inactive flag. String json= '{ "...
-3
votes
1answer
24 views

Need help Schedule Test Class for tast create on Opportunity

I need help on the test class for this schedule on Opportunity. Getting error on below code with comment and only 35% coverage code. global class OppJob_Task_1stPhoneFollowup implements Schedulable { ...
1
vote
1answer
36 views

HTML in APEX not giving correct base URL with ahref

Account acc = [Select Id,Name,Owner.Name FROM Account WHERE Id =: accId]; String HtmlBody='Attention Data Analyst,<br><br>'; HtmlBody+='Please verify the Account: ' + '</b&...
0
votes
1answer
16 views

REST API GET Callout and test method

I have created a class Apex class to get info from and external database and insert the info to the account before save. The method is called by a trigger. Everything is working fine but I am getting ...
0
votes
0answers
20 views

How to change Organization Owner

Is it possible to change the Company Information owner? I am facing an INACTIVE_OWNER_OR_USER error which is due to the owner being an inactive user. Does not appear I can query for OwnerId either to ...
0
votes
2answers
27 views

Error : Expecting '}' but was: 'for'

public class TaskOneOpty { List<opportunity> opp1 = [select id,amount, StageName from opportunity]; List<opportunity> opp2 = new List<opportunity>(); for (opportunity OP:opp1) ...
0
votes
2answers
23 views

AggregateResult query limit

I'm trying to query for all unique accounts that has a first name, last name and person email by using this query: List<AggregateResult> checkUniquePersonAccounts = [ SELECT count(Id), count(...
-1
votes
0answers
14 views

Create Salesforce Territories through Integration [closed]

I need some guidance here. Let me first tell you the problem statement that I am trying to solve. In my case, Customer is creating and maintaining (adding accounts, users etc.) territories outside ...
-3
votes
1answer
29 views

I'm hitting our soql limit when I added new code

I've tweaked an unmanaged package to include an additional Affiliation upsert and it's causing my limit to exceed. if someone can please suggest what I can do to fix the following I would appreciate ...
4
votes
1answer
41 views

Is it Possible to Change a User's Email and Reset Password at Same Time via Apex Code?

When using the Saleseforce UI, it is possible to change a user's email and send them a password at the same time by changing the email and clicking 'Generate new password and notify user immediately' ...
1
vote
1answer
26 views

LogUnsubEvent SOAP API call to Marketing cloud not Unsubscribing Subscriber

I am building a custom Integration between Sales Cloud and Marketing Cloud using the LogUnsubEvent call to unsubscribe a subscriber and get the metrics updated correctly on the reports providing the ...
1
vote
1answer
36 views

Salesforce to Xero integration using Named Credentials by OAuth 2.0

I am trying to do the integration between Salesforce and Xero by using Named Credentials (Authentication Protocol is OAuth 2.0). I created an Auth provider - Then created Named credentials of OAuth 2....
0
votes
0answers
13 views

Relationship between FeedItem and EmailMessage [closed]

I need to create custom component to Show Feeds on Case, I need to manage EmailMessageEvent, I have looked on and found that All Emails are stored in EmailMessage object and all feeds stored in ...
1
vote
2answers
57 views

Before/After Trigger

Question When a Billing Address is modified, get the new Postal Code. Then check which Contacts on the Account are outside that Postal Code. If 1 or more Contacts are outside of the Postal Code, mark ...
1
vote
0answers
23 views

Deleting ObjectPermissions record fails in apex batch but succeeds in two separate apex transactions

I have a Apex Batch job that "cleans" object permissions on permission sets automatically based on some rules. Essentially in each batch execution I am deleting all ObjectPermission records to a ...
0
votes
0answers
15 views

Multiple File upload on public visualforce feedback form

I'd like to provide a multiple file upload module on a public visualforce page and I'm struggling with the upload process. As the upload process requires to have a record ID, how can I save the ...
0
votes
1answer
35 views

Is there a way to call standard Quick Actions from a LWC?

I'm trying them all and it seems impossible. The thing I'd like to do is call the "Create PDF" Quick Action for the Quote object from a LWC. I tried debugging the browser and see what happens when ...
-1
votes
1answer
33 views

No such column 'LastPasswordChangeDate' on entity 'User error

I am trying to access LastPasswordChangeDate field on the user object in my apex class. However, when i do so through my community user i am getting no such column of User. If i try through an ...
-1
votes
0answers
18 views

Calculate SLA due Date field based on created date for some record type [closed]

I have a field called SLA due date on the Case I am trying to calculate the SLA due date based on created date and status of the case using trigger . Not Sure what am I missing
1
vote
1answer
17 views

Is it possible to remove of filter keysets by a standard method and only maintain keyset which start with a string

I query over Custom metadata to get 1 record(settings) with custom fields "MdtFieldsAcc" I pass the fields in a map with .getPopulatedFieldsAsMap() and then currently remove 1 keyset (Id). Is there a ...
0
votes
0answers
19 views

is Sharing rules get recalcuated on deployment of Same OWD

I have one repository where i have OWD for account,contact and some other custom objects which is same as in salesforce org. Is Sharing rules getting recalculated if I deployed the same OWD. Please ...
0
votes
1answer
27 views

How to remove dom response from a loop

I have a dom class handler which I am calling from batch class. I am looping through the response to perform dml operations across certain objects. Since I have to use the response across different ...
0
votes
0answers
10 views

Why does Messaging.renderStoredEmailTemplate require that the running user have access to the User object?

Discovered this recently because a trigger was failing when triggered by a community user. Can't figure out why this should matter though, with the apex running in system mode and all. Is this ...
0
votes
1answer
27 views

unable to call SOAP API from apex class

I have the below wsdl file (the original one is larger than 1MB, so I only copy the parameters I need): https://pastebin.com/3J23zm7K However, as Salesforce doesnt support xsd:extension base, I ...
-5
votes
0answers
50 views

Named Credential not working with Apex SOAP Callout [duplicate]

I am trying to use Named credential in the SOAP Apex callout in an Apex Class generated from WSDL ( wsdl2apex) to integrate to the Salesforce Marketing Cloud. I am using merge fields to populate the ...
-3
votes
0answers
24 views

Need help in clearing PMD Errors [closed]

global with sharing class APTS_OrderRevRecCallback implements Apttus_RVConfig.CustomClass.IRevenueFeeCallback { PMD Cyclomatic complexity is high of 79 (Highest 19) global void ...
0
votes
0answers
36 views

My LWC is not calling my Apex method

I created a LWC that calls an apex method from an apex class. The LWC is inside an aura component that is being used as a quick action to create a new record on another object based on the data from ...
2
votes
1answer
22 views

In Apex, how do I know if my user can contribute content to a particular library?

Is there a way to discover if the current user can publish content to a specific Library using either Apex or Javascript? Use Case I have a shared library (DeveloperName = Shared_Forms) that many ...
0
votes
0answers
17 views

How to make actions from notification?

Every time a new User logs into the org, they have to accept some policies regarding assigning assets to them etc. They should get a notification with the possibility to accept the agreement, which ...
2
votes
0answers
61 views
+50

lwc getFieldValue from a custom external object

I am creating a LWC that handles data from an external object. I have access to the recordId through @api recordId;, but I need to get the externalId from this object as well. Currently, I have call ...
0
votes
0answers
28 views

System.Debug() appears to be summing additional logged values

I'm running the following code, and I just want to log the total amount of deletes, and the total amount of records passed into the method and return the total amount of records that were processed ...
0
votes
1answer
23 views

Multi selection allowed failing in object describe

My code fails for multiselection of describe object iam getting following error. System.NullPointerException: Attempt to de-reference a null object Error is in expression '{!showFields}' in ...
-3
votes
0answers
19 views

Insert/Update the Salesforce Records from the SQL Server [closed]

I am new Salesforce and I am trying to understand what is the best way to Insert/update the records from the SQL server DB in to Salesforce. There is a DB view, can we directly call the DB view from ...
0
votes
1answer
16 views

Partial page rerender on record update (apex:actionPoller)

I have a visualforce component that displays parts of a record named "tvCase__c". This record may be updated from another component or outside, but the component should always display the most recent ...
9
votes
4answers
73 views

Run more than one async jobs from Future/Quable context

We have created a process which must work asynchronously (limits and architecture reasons) and it was working fine. Some time later we have started to work with BigObject. And as long as writing to ...