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

Visual Clone Record via commandLink button

I am attempting to modify some existing Visualforce & Apex Code previously implemented by our Salesforce consultant. On my VF page, there is a commandLink button called "Create Renewal" which ...
0
votes
1answer
22 views

capturing required text from table using inboundemail service [closed]

How would I use my apex class to capture "Succesfully done" from the table body of the email, and insert it into the custom field? In the same way I would like to capture "Failed" also.
0
votes
0answers
19 views

insufficient access rights on cross-reference id while updating records through community portal

As a portal user while i am updating case records getting "insufficient access rights on cross-reference id". Thanks in advance!
-1
votes
1answer
20 views

How to display Einstein Analytics dashboard on external website

I have created this dashboard in Einstein Analytics Studio. Is there any way to display this dashboard on my external website.
1
vote
1answer
35 views

Using SOSL with wildcards in apex

I have a contact with name Test Contact in the Org. I run the SOSL like below in Query Editor and able to get results of contacts containing Test in their name: Find {*Test*} IN ALL FIELDS RETURNING ...
0
votes
1answer
29 views

Account and contact soql query

I want to retrieve all the contacts that have an account with soql query How do i find them Please find below query: Select accountid from contact where accountid in select id from account
0
votes
1answer
45 views

Batch apex class for student record [closed]

I want to create a batch apex that creates a student record for every contact that is linked with a account having checkbox eligible true. Student data should be taken from contact. My student record ...
0
votes
0answers
27 views

Display and populate ContentDocument with Lightning component

I basically followed this link and tried the exact same thing. Generate PDF from Lightning components I copied his Git code and tried the same thing. but the output I get is not what I expected. ...
0
votes
1answer
39 views

Deserializing a list of JSON String in an Apex Method

I am passing a JSON string to my Apex Method. When I try to deserialize it, I get the error: Method does not exist or incorrect signature: void deserialize(List, System.Type) from the type System....
0
votes
0answers
36 views

Soql query for self lookup on account

Trying to get a sub-query within the Account trigger. Account has a lookup to itseff self in field entity__c How do i get the entity__c records related to the parent account i tried the above soql but ...
0
votes
3answers
32 views

Setting a Map value within a method for a unit test

I still learning here but I am having a bit of trouble understanding this concept. I have a method kind of like this: public static List<Contact> newContacts() { List<Contact> ...
0
votes
0answers
16 views

Approval process test class unanimous approval required

I have a trigger that grabs approval comments and updates a custom field on an opportunity record. I am able to get 100% code coverage on test class when approval process requires one approver. ...
0
votes
1answer
19 views

How to create Box.com user from Salesforce Community User record?

I am looking for a way to create a user within Box.com if the user does not exist in Box.com after a Salesforce Community User record is created. How can I create a user in box.com if one does not ...
1
vote
1answer
48 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)
3
votes
3answers
62 views

Can a trigger with error ruin the batch it was fired from?

Consider I have a batch class which updates 50 records of Task. The batch class ran successfully and updated the Task records.Now the Task object has a trigger that runs on after/before update. Due ...
8
votes
1answer
66 views

Clean way to vary sharing at runtime in Apex?

I may need to make many @RestResource Apex classes run either with sharing or without sharing where that option is selected at runtime. But this approach (that I am using at present): /** * Allow ...
0
votes
0answers
10 views

How to create sharepoint instance? [closed]

I wanted to build connection between sharepoint and Salesforce.For that I need a sharepoint instance. How Can I create sharepoint instance.what are the requirements for that? Thanks, Chandu
1
vote
0answers
83 views

Get Multi select picklist and update corresponding category using custom metadata type

We have a Custom Metadata Type which shows the relation between a product of interest and categories. When a product of interest is selected we would like the corresponding categories to be selected. ...
0
votes
0answers
17 views

Internal Server error:Unexpected exception from predictAsync future

I'm trying to classify image using Einstein.I wrote following function in server side controller to classify the image @AuraEnabled public static Einstein_PredictionResult ...
0
votes
1answer
48 views

Map lead custom field (Account__c) with Standard Account field 'Parent Account'

I have a requirement in which I have to create a custom lookup field on lead object which selects the account Account__c and during the lead to account conversion I have to map the field with 'Parent ...
0
votes
1answer
20 views

Updating CampaignMember Record via RESTful web service

Also new at APEX and this is my first crack at it. I want to update some fields on the CampaignMember object when I catch a Webhook on a force.com site. I have the Webhook working, however I am having ...
1
vote
0answers
14 views

Automatic Properties and Collections

Wondering what is the syntax (if there is any at all) regarding adding elements to a collection defined as an automatic property. Heres the automatic property defined in Class SharingCreator public ...
5
votes
0answers
49 views

Add Community members via Apex?

Is it possible to add/change/delete Community members using Apex? I know how to do this via the UI (see picture below), but I'm looking to automate some things on the demo side of the business for ...
0
votes
0answers
13 views

Allowing Profile's Access to their Respected Links

I am currently working on a piece of code that will allow a certain group of profiles launch out from Salesforce to another web application. Any other profiles will be staying on Salesforce. I have ...
0
votes
0answers
28 views

Batch Class and SOQL Implications: 1% of the time a record gets updated that shouldn't

pretty high level question here based on some of the erroneous updates I'm seeing (less than 1% of total records processed). I'm currently running a batch class (50 record batch size). It is a ...
-2
votes
0answers
31 views

Need help in creating HTTP callout [closed]

// Calling webservice PegaCallbackService.SendValidationStatus(Json.Serialize(pegaResponse)); public class PegaCallbackService { @future (callout=true) public static void ...
0
votes
2answers
50 views

Providing date in custom label and use it in my apex class

I have a requirement where I have written batch class to delete old records(Have to house keep old records for many objects as we don't use them). Just to test it I have created it in my Dev org for ...
0
votes
2answers
29 views

Is there a way to retrieve a PageReference parameter from a Lightning Component?

There is a requirement to show a modal pop-up forcing our user to choose a reason from a dropdown when loading a Case that meets specific requirements. The following line of code redirects to a ...
0
votes
1answer
23 views

How to pass the parameter from trigger to validation rules?

I have a trigger on Contract Object, whenever the Contract record is updated the contract section in the associated opportunities will also get updated with the latest Contract data but while updating ...
1
vote
1answer
28 views

Query on Process builder Scheduled Actions

We have 100+ scheduled Process builders that triggers based on conditions. As a end user We want to show which process builder Actions scheduled related with Lead/Contact object as creating child ...
-2
votes
0answers
19 views

Email Message Object or Case Object Possible to Email Alert…??? How can we Achieve Can we Please Help Me [closed]

I am Newly in salesforce Support Process Team... when ever email is send case will be created(Email To Case) and sub case is created. when ever sub case is created Pearent case status will be ...
0
votes
3answers
44 views

Trigger not updating last login from user to account object

I created one trigger on the User object which will update the last login to account if the account name matches with user.Name field. but somehow my trigger is not at all updating the LastLogin ...
-1
votes
1answer
52 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
0answers
20 views

Email Alert possible to Email Message object ? if it is possible ? how can we achieve in salesforce? [closed]

Setup-->Home-->workflow -->Email alert--> New email alert -->Object (Drop down field ) In that Object drop down field we required to list the "Email message" Object also
0
votes
0answers
29 views

Error Occurred During Flow Action name not found: null. Need to force Class Compilation?

I've occasionally been running into a problem when installing a managed package I'm creating. A simple Screen Flow where at the end it is using an Action to call into an InvocableMethod I am providing....
0
votes
1answer
40 views

Recursive Before Update Trigger Overwriting Saved Value with Null

UPDATE: Okay, so I've identified the issue. A workflow rule that checks for a specific opportunity stage and updates a datetime field with NOW() if true. Why would this field update undo other field ...
0
votes
1answer
35 views

Marketing Cloud SOAP API - How to Retrieve Latest Subscribers?

How to perform a retrieve request to retrieve the LATEST subscribers from Salesforce? <soap:Body> <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI"> <...
3
votes
1answer
112 views

Value Of Object After Insert Remains The Same

I've a simple conceptual doubt - Would really appreciate if someone would explain me the reason for this behaviour: I'm inserting a new contact from console and following is the snippet: Contact c = ...
2
votes
1answer
36 views

Apex Class setting Opportunity Close Date

I am trying to remove the section of the apex class that references the close date but I am getting an error that record creation failed when selecting my button. Do you have any suggestions? {public ...
0
votes
1answer
25 views

Update OpportunityLineItem before insert/update

I have built a trigger to update Opportunity Line Items discount based on quantity before insert/update. There are custom fields to define the quantity tiers and discount to be assigned. The code is ...
0
votes
1answer
57 views

Site.forgotPassword() Failing In Test Class - Code Coverage Not Reached

I am trying to successfully run Site.forgotPassword() in a test class, but the method is returning False when used in my test class. I have tried using real Users (as demonstrated in the code below), ...
5
votes
1answer
152 views

How to get list list of flows accessible by a User based on Permission Sets?

In order to provide more granular and controlled access to flows, all our flows are enabled with access setting of "Override default behavior and restrict access to enabled profiles or permission sets"...
3
votes
1answer
71 views

More efficient to query or to loop through a bulk return of sObjects

Kind of a vague question but I am writing some "rollup" or summary queries that in totality will collect right around 340 account records between the 4 of them. These are rolling up from (client) ...
2
votes
1answer
52 views

APEX: Access to a sObject Field via String(dynamically)

I have an object instance of a sObject, for example Product. Product2 x = new Product2(); Now I can access the field of object like that x.Name = 'Bruce Wayne'; My questions is about this .Name ...
8
votes
1answer
80 views

How to opt out of FLS validation when a SOQL query is run by a trigger?

I have a large Salesforce application with hundreds of SOQL queries. Currently, the code uses Schema.DescribeFieldResult data to determine if the logged in user has rights to each field in the SELECT ...
0
votes
1answer
27 views

Set Dynamic value for an readOnly field- Case Number

On my page am doing a search (Case Number) and storing the Data in the user record, So whenever the user login back trying to display the records based on old search. In that case, Trying to build a ...
-1
votes
1answer
18 views

Test Class For Http callout Post [duplicate]

Kindly Provide me a feasible solution to write the test class for this below code` public class ActiveCampaign { @future (callout=true) public static void createUser(String Email, String FirstName, ...
1
vote
1answer
44 views

Account Trigger on owner change to restore ownership of contacts not owned by the new owner

I am having issues getting sucess with my account trigger. Would really appreciate someone taking a look. I can't even get a compile :( The requirement I am trying to code for is this. If I have ...
4
votes
0answers
45 views

Architecture decision: use canvas app or lightning out?

Suppose we need to develop an app which can be used both inside Salesforce and in another web site. And definitely we don't want to duplicate the code. So basically there are two options here: ...
3
votes
1answer
39 views

What is the permission that governs reading Custom Permissions? [closed]

Our managed package has some custom permissions that help provide an elevated set of capabilities to some users. We have recently run into an issue with some people seeing this error message: "Read"...