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.

5,404 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
-2
votes
1answer
284 views

Account Sharing Error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

this is apex sharing code, but the problem is this when I'm creating acc, entering parentId of acc which I have created as demo user, error public class ManuallyShareAccount { public static void ...
-2
votes
1answer
63 views

How to save large Data in salesforce Database or Custom Objects?

I have a pretty large data that cannot be fit in Text Area Rich. Is there any File Storage Option available through which large data can be stored in salesforce from Apex Class
-2
votes
1answer
42 views

Send email (Visualforce Email Template) included Visualforce component which render after update action

Want to send email after update with multiple records I have used Visulaforce Email Template with Visulaforce component having controller. Visulaforce component that getting list of record in table ...
-2
votes
2answers
113 views

Null pointer Exception in Apex controller

I am getting "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object" in Apex controller when i click on update link pop up. Its showing in query with " ulstAsset ".I am newbie ...
-2
votes
1answer
36 views

Is it possible to update longTextBox without overwriting existing values?

I have an long text box field that contains values. I need to append new values into the long text box field without overwriting the old values. Is it possible to populate the old values and add the ...
-2
votes
1answer
92 views

iam inserting an Opportunity record, but I need it to have HasOpportunityLineItem = true (HasOpportunityLineItem read only field)

iam inserting an Opportunity record, but I need it to have HasOpportunityLineItem = true (HasOpportunityLineItem read only field) present HasOpportunityLineItem = false but i need to ...
-2
votes
1answer
105 views

Add the Case to Parent case based on Email Id or case Status using Workflow/Process builder

Suppose i have case in salesforce Case1 and email Id-abc@gmail.com Now second Case is Created case2 and email id -abc@gmail Another case is created case3 and email id-abc@gmail.com So, Case1-->abc@...
-2
votes
1answer
262 views

How to save the related list data changes from visualforce page?

I'm trying to save the data from visualforce page to salesforce.But after click the save button no action performed. Please check it once this line <apex:commandButton id="saveBtn1" value="Save" ...
-2
votes
1answer
76 views

How to add a comment to an opportunity?

I'm trying to update/attach the activity comment with the opportunity comment. trigger trgTaskComment on Task (before insert) { Task[] Comment = Trigger.new; for (Task newActivity : Trigger....
-2
votes
1answer
1k views

Variable does not exist: RecordTypeId

I have record types in Asset object in my target org. In the test class which am trying to deploy to target org, i have referred recordtypeid. Iam trying to deploy the test class via ANT but on ...
-2
votes
1answer
549 views

How to update multiple records from one page?

how to update the field(Next_Step__c ) of multiple records via one Visualforce page, i have write save method but its not update the multiple records vf page: <apex:page Standardcontroller="...
-2
votes
1answer
70 views

trigger has 42% coverage in sandbox but 0% when deploying

This is driving me nuts... My trigger has 42% coverage in my sandbox but it won't deploy saying that the coverage is 0% (code below) The test method both inserts and updates an opportunity. I'm ...
-2
votes
1answer
115 views

How to Compare Salesforce Contact email with All accounts related contact emails?

Here i have taken one "salesfore Contact" and "all Acounts related contacts" here i'm trying to compare all accounts related contacts email addresses with single salesforce Contact email addresses ...
-2
votes
1answer
186 views

Getting error while writing test class

When i am trying to write a test class for my class (NameProjectTDfromAccolade).. I am getting the below error System.TypeException: Invalid conversion from runtime type List to Map on line ...
-2
votes
1answer
45 views

Issue with Visualforce Grid Save Button

I am facing issue with Custom Visualforce Grid During Save . When i click Save Changes Button I am getting below error System.ListException: DML statement found null SObject at position 3 Error is ...
-2
votes
1answer
174 views

Static Resources zip file - Restricting access

Is it possible to restrict access to the static resource zip file which can be accessed using a URL /resource/1502326xxxxxx/images from portal? How should I restrict a portal user from downloading ...
-2
votes
1answer
206 views

I am trying to update ownerID field of task from the text field.but getting error

Apex trigger TaskCreate caused an unexpected exception, contact your administrator: TaskCreate: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to ...
-2
votes
1answer
363 views

Show warning message from the Case Trigger for the 6th Auth Request in Salesforce?

How we can show the warning message from the trigger ? I know that its not possible using trigger, but seeking some guidance around it. I have a trigger on Case, which checks if the client/requester ...
-2
votes
1answer
237 views

How to write test method for the Map<Id, Case> oldCasesMap = (Map<Id, Case>)oldSobjsMap;

I am taking a reference from the link: Can we merge if else condition in a single test class method?. I have a code something like below and I want to write the test class for it. Map<Id, Case>...
-2
votes
2answers
586 views

How to implement Trigger on junction object to update field on contact

I have a junction object called contact_role__c between contact and a custom object called property__c. I need to update a field on contact object whenever a new property__c is created. This is what i ...
-2
votes
2answers
163 views

setToAddress issue in email service

I just need to add the setToadrress to singlemessages email service,,objIDs holds the id's to add for setToaddress can anyone help me public void sendEmail(){ Set<ID> objIDs = new ...
-2
votes
1answer
43 views

apex code coverage

kindly let me know to resolve the following test class issue. apex:- public void associateLanguageAndCountry(String userId, Country_Language__c countryLanguage){ User user = [SELECT ContactId ...
-2
votes
1answer
882 views

How to change the permission sets via Apex

On Account Object there is a lookup field callled as 'AccountManager' where I can assign the user(Lookup(User)). Now there is a tab called as "Account Team "(Under the Account) where I can add ...
-2
votes
1answer
1k views

Code coverage for test.isrunningtest()

if(!test.isrunningtest()){ try{ String day = string.valueOf(system.now().adddays(2).day()); String month = string.valueOf(system.now().adddays(2).month()); ...
-2
votes
1answer
458 views

oldMap in Apex Class

I am new in apex coding and I dont understand map very well, I just want to understand what this code means.. Thank you in advance, please bear with me. public class sample_class{ public void ...
-2
votes
1answer
231 views

upon checking checkbox field on parent need to check child records exist or not

I Have a Parent Account object in this i have check box field "No Asset exist". when ever i am trying to check the checkbox it need to show error message if Assert records exist for this Account ...
-2
votes
1answer
778 views

How to rerender apex:form when action invoking from apex:page… please comment

<apex:page showHeader="false" sidebar="false" controller="ContinuationController" action="{!startRequest}"> <apex:form id="result"> <br /><br /> <apex:pageBlock > ...
-2
votes
1answer
59 views

Currency Summarization Trigger

I am trying to create a trigger that will summarize currency fields on custom object records (Property_Rate__c) and then input the sum into a lead field. Here is what I have. For clarification, each ...
-2
votes
1answer
40 views

System.NullPointerException: Attempt to de-reference a null object ,sravn

I am new to apex help me for this, what is the changes i need to do public class MyCustomController{ Public Account acc; public MyCustomController(){ List<Account> lstAccount = [select id,Name,...
-2
votes
1answer
2k views

How to resolve HTTP Version Not Supported or StatusCode=505 error?

18:05:15.047 (47002596)|CALLOUT_REQUEST| [217]|System.HttpRequest[Endpoint=https://rest1.bullhornstaffing.com/rest- services/32qip/search/Candidate?BhRestToken=5a9c3e65-bad6-45c7-91d3- 14b1f9452fd8&...
-2
votes
2answers
1k views

how input field can converted into output field in visualforce page

how we can hide input fields of a custom object on a button click and output field comes in place of input field with inserted data using apex class and visualforce page?
-2
votes
1answer
61 views

Writing a test class for methods

I am having troubles figuring out how to write the test class for the following method in my class. Any help would be greatly appreciated. public Oppty_Search_IntegrationOperation....
-2
votes
1answer
605 views

Error: Compile Error: Invalid foreign key relationship: Advance_Milestone__c.FFS_Milestone__c at line 28 column 44

Folks am getting this error - Basically want to update the ( parent object - Advance_Milestone__c - custom fields ) based on the values of the custom fields in its child (FFS_Milestone__c). PS - ...
-2
votes
2answers
542 views

WSDL Testing using soapUI

I am testing a custom WSDL using SoapUI. when i try to run the wsdl it consumed the salesforce record but noting displayed on SoapUI.But when i checked in the salesforce it shows that the record has ...
-2
votes
1answer
740 views

PDF send as email attachment not opening

We have 2vf pages (1page per quote creation and 2nd page to generate PDF but both pages using same custom controller.On click of button I'm sending email with generated PDF but in mail its not opening ...
-2
votes
2answers
2k views

how to cover catch block in this method in test class

public pagereference savePassword() { if((objAccountTemp.Contact_Name_1__c != null && objAccountTemp.Contact_Name_1__c != '' && objAccountTemp.Affiliate_User_Name__c != null &...
-2
votes
1answer
3k views

Constructor not defined error in batch class

I am testing the scheduled batch class in salesforce, during which i am getting the below error : " Error: Compile Error: Constructor not defined: [LicenseOptimizer_BatchClass].(String) at line ...
-2
votes
1answer
186 views

After insert not updating the fields from contact BATCH CLASS [TRIGGER]

CLASS global class ModifiedDate implements Database.Batchable<sObject> { List<Contact> ctt = new List<Contact>(); String query= '[SELECT Id,Name,Phone,CreatedDate,LastModifiedDate,...
-2
votes
1answer
421 views

Incompatible value type Object

I am getting the following error while adding elements to a map. Error:- Incompatible value type Object Code:- public class CR_Report{ public void Completed_CR_Report(){ //Compare old zip ...
-2
votes
2answers
799 views

update only one cell of a table on button click

I can update available to sold and sold to available on any button click but problem is whole column changed .. i want when i click on change status only that row status should change. rest of rows ...
-2
votes
2answers
60 views

Written Test class it says code coverage is 84% need to upto 100 % i need struck in this line query?

Apex Class Code: public class task1 { public string obj{set;get;} public integer year{set;get;} public list<account> acclist{set;get;} public list<contact> conlist{set;get;} public list&...
-2
votes
2answers
91 views

How to use developer console in salesforce?

I am writing apex class in developer console in salesforce but it cannot save in my salesforce account. Help me in this regard
-2
votes
1answer
422 views

How to remove the row from a Visual force page using Apex Scheduler class?

I am Saving dates in 2 fields like follow, Using Visual force page and controller to enter multiple Row's, now i want to delete a row if the End Date is Passed Today, Can any one help me how to ...
-2
votes
1answer
171 views

Null pointer exception in deletion trigger

I want to write trigger to restrict user to delete the record. I have two public groups: group1 and group2. if the current user does not belongs to group1 or group2 and if current user is not a ...
-2
votes
1answer
115 views

How to handle the situation in apex when retrieving the data

How to handle the situation in apex when retrieving data from object with condition and no rows will return? if (list.size() > 0){ //some code } else{ //other code } but it shows error ...
-2
votes
1answer
671 views

How to access and display the field in VF email Templates from the junction objects

I need to display a field in an Visualforce email template.The Field is from a junction object1. Case has a junction object (junction1) which is related to another Junction object(Junction2) thereby ...
-2
votes
1answer
394 views

how to test the batch code?

How to write test class for this code 75% coverage or not? global class SearchAndUpdate implements Database.Batchable<sObject>,Schedulable { global final String Query; public Set<...
-2
votes
1answer
137 views

apex trigger issue with dynamic soql

custom object: schedule_c fields: Runway_C and date_C Runway_c is a picklist field having track1 and track2 values. date__c field is datetime field. i having the the records in schedule object e.g ...
-2
votes
1answer
743 views

How to redirect save button

How to redirect save button to a Managed Installed visual force page. In UI Page, when save button is clicked it opens a popup window of installed managed vf page in it after selecting the options ...
-2
votes
2answers
168 views

AfterInsert:System.NullPointerException: Attempt to de-reference a null object Null pointer exception

Error on creating a lead in salesforce: Apex trigger LeadConvert caused an unexpected exception, contact your administrator: LeadConvert: execution of AfterInsert caused by: System....