Code indicates that a question is to do with pages, controllers or similar, and not the declarative aspects of the platform.

learn more… | top users | synonyms

0
votes
1answer
18 views

How do I cover 'addError' in test class

My Requirement is I have to cover so.AddError() in the test class. Apex Class: if(accountToUpdate.Inactive__c== true && accountToUpdate.Inactive__c <> accountBeforeUpdate.Inactive__c) ...
0
votes
0answers
14 views

I can't get my email to be responsive for Android's email app (Gmail on Android is pretty much fine)

Here's a chunk of the code (the whole thing won't fit): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <...
-3
votes
1answer
40 views

Code Coverage 0% Cant add to salesforce

I'm just trying to put this code into production and its not letting me! Trigger OppProdLine on Opportunity (before update) { list<opportunity> sl = trigger.new; list<...
0
votes
0answers
13 views

MST Rules Engine - access the ExpressionDisplayText__c of the successful rule

We are using MST Rules Engine to evaluate to which queue to send a custom object (let's call it HotelLocation__c) record. The user guide gives a snippet of code to include in the calling class... ...
1
vote
2answers
58 views

Can we get list of fields(matadata)

I need something like this **Field Label Field Name/API Name Data Type** Standard Campaign Campaign Lookup(Campaign) Standard City City ...
4
votes
1answer
50 views

How to initialize date type variable

I am using date type variable public Date arrivalDate {get;set;} now my question is how we will initialize this variable in constructor in proper way, if I use this whats the meaning of 1,1,1. ...
1
vote
1answer
58 views

Is this Apex coding similar to Java scripting?

I don't have prior knowledge in coding. But would like to know and learn more about Salesforce Development and coding in Apex. I heard that Apex is more or like Java script, Is it true? Whether a ...
0
votes
1answer
35 views

test class -standard controller

public with sharing class accountsearch { public String searchvalue{set;get;} public string mymessages{get; set;} public String searchtext { get; set; } public Boolean val{get; ...
4
votes
1answer
53 views

What can I use instead of <apex:tabPanel> in Lightning Experience

I am using in a Visualforce page to displaying of fields from an object that contains more than 100 fields and it is working as expected. I want to create a version of this sort of layout in ...
0
votes
1answer
55 views

Date Filter with AMPScript

I am trying to pull out Tracking Event data, using the "TrackingEvent" Object Type. I need to find tracking event data for a subscriber within the last 30 days. How do I create a simplefilterpart ...
0
votes
2answers
61 views

Error: Compile Error: expecting a colon, found 'oli.OpportunityId' at line 6 column 80

here i am trying to fetch opportunity lookup id from opportunityLineItems bt getting this error.- Error: Compile Error: expecting a colon, found 'oli.OpportunityId' at line 6 column 80 can ...
1
vote
1answer
46 views

Debug log shows data in list but Visualforce page is not displaying anything

In order to help HR manage license allocations for our HCM app, I worked up a proof of concept for a simple vf page that shows which users are assigned a specific permission set, and also are ...
0
votes
0answers
14 views

How to login and post project using codeshare?

I have been trying to submit a project in codeshare. There seems to be no login available in this page. Is codeshare still functional or is there any other site to submit projects for salesforce? ...
0
votes
1answer
27 views

Hide code in packages [duplicate]

I packaged a visualforce page and its controller but the code is still able to be seen. How can I hide my code? Thanks in advance.
2
votes
1answer
126 views

Nested IF Statements

We are moving to use X-Author to upload our planner information into Salesforce via their excel app. The excel spreadsheet has been set up prior and fields are pretty fixed. We are trying to map their ...
4
votes
2answers
370 views

How can I hide my code in visualforce page?

I developed my app, The controller is complete, and also the visualforce, but I need to hide my code at installing the app in another salesforce account. How can I make this possible? Is there any ...
1
vote
1answer
38 views

Configure Auto-Number with initials related to another object

I have an object called Project where stored the name of the project and its key, respectively: My Project Name, MPN Then I have a direct child object called Sprint followed by Issue where I have a ...
3
votes
0answers
96 views

Team Foundation Server as source control for Salesforce Project?

Does anybody has experience on using Team Foundation Server as source control for Salesforce project? We are currently using Git but management wants to start using TFS as source control going ...
-1
votes
1answer
41 views

Can't Get Unit Test Coverage Above 7/16 (43%)

I've hit a wall. I cannot find a way to get my test coverage above 7/16 (43%)! I feel like I've tried everything, but nothing seems to make a difference, unless it causes my test crash. Can someone ...
0
votes
0answers
16 views

Unable to re-deploy a deleted class which are causing low code coverage

I've looked for a similar case but I was not able to find any. I've deployed (deleting) in PROD a class which is now causing a code coverage of 33% and I'd need to restore it to have 75%+ code ...
1
vote
2answers
47 views

How can i increase code coverage test class?

I am new for test classes even I written test class it's covered 34% but I need to increase code coverage. Please can any one help me out how to increase my code coverage, please find below my apex ...
0
votes
1answer
32 views

FIXED: Code request: Pre-populate Oppty Name

I've received an ask to have the "Opportunity Name" standard field be pre-populated when creating a new Opportunity in the format of "Account.Name - TODAY()"; as to create a cleaner naming convention ...
1
vote
1answer
53 views

Indenting multiple apex code and pages

Is there any new tool to do code indentation for multiple Apex classes and vf pages at a single stroke?
0
votes
1answer
28 views

How to Test a Trigger — Test Passes But Doesn't Cover Code?

I've created a simple trigger that posts a user's field entries to chatter whenever they create or update a new record on the Weather Tracker custom object. It works. The problem I have is writing ...
5
votes
1answer
69 views

Apex Bug (?) Null Field Values of Cloned Instances Don't Persist?

I want to take the state of a source record, clone it, and apply the clone to a target record. But I'm encountering an issue in which a null field on the clone does not nullify the field on the target....
1
vote
0answers
105 views

Salesforce Integration from third party app

I'm making saleforce integration from 3rd party app, I made callout(rest API) and got response xml schema (xsd) format. I'm trying to generate apex classes from xsd, wsdl generation is not working ...
3
votes
2answers
249 views

Is this an abuse of ternary operator and inline SOQL or is this acceptable?

I have written a function like the one below to check if there is atleast one occurrence of a given Id in either of the two objects. I am having doubts on if I should use an if branch or use a ternary ...
0
votes
1answer
23 views

Compile Code Error Help

I keep testing Jeff Douglas' Dynamic search controller and I'm getting a compile error code. Error: Compile Error: Method does not exist or incorrect signature: Contact.interested_technologies__c....
0
votes
0answers
24 views

Merge Leads Process Salesforce

I am creating a Merge Lead Counter on Leads, it is working fine at the moment but does not increment when a lead is merged more than twice or thrice. Can you explain what am i doing wrong. I have ...
-1
votes
1answer
232 views

Incompatible key type Decimal for Map

Any Idea on how to solve this error? Thankyou! Map<Integer,Map<String,Decimal>> BERYear = new Map<Integer,Map<String,Decimal>>(); List<Budget_Exchange__c> beList = [...
0
votes
1answer
82 views

downloading event log file from apex code [duplicate]

Can we download the event log file directly from apex code.(i.e., without using rest explorer/webservices manually.Everything should be written in Apex code only). Regards, Sravika
0
votes
1answer
52 views

I am trying to understand code coverage in Salesforce

I have read several blogs, but wanted to clarify few things. Is code coverage calculated for each class or over for the entire org? Does it include the code coverage of managed packaged? During ...
2
votes
1answer
310 views

Dynamically serialize or deserialize properties in apex

I want to have dynamic properties in my JSON structure, something like this - { "payload": { "one": { "x": 1 }, "two": { "x": ...
2
votes
2answers
141 views

Changing Oppoturnity Owner to a Lookup User Id field on the Opp Object

I want to create a trigger on the opportunity object to change the opportunity owner (if their profile is a Service Engineer) to the field called "Sales Rep Owner" which is a lookup user field on the ...
-3
votes
1answer
36 views

Trigger Test Class code coverage not increase over 29

I have written the trigger below trigger CreditrequestTrigger on Credit_Request__c (after update) { String body = ''; String subject = ''; List<User> Userlist = new List<User>([SELECT ...
2
votes
1answer
146 views

Trigger for counting child records via roll up summary relationship

We have a Destinations object which is linked to Supplier products object via a lookup relationship. There are two types of supplier products(marketplace and curated) We want to count the number of ...
3
votes
2answers
105 views

Email Alerts to Customers using Work Flow processes

Creating a work flow email alert. Would like to send out to customers email found in opportunity under contact roles. Currently, the only options are to select from drop down recipient type. Is there ...
1
vote
0answers
126 views

Are there any automated Apex refactoring tools?

With reference to a Stack Overflow question from 2009... In the last six years, have any automated Apex refactoring tools been developed? I'd like to do simple refactorings like "extract method", ...
1
vote
1answer
122 views

Apex Code Coverage - need help with constructing Apex Class test code

I am looking to complete the Code Coverage requirement for deploying Apex Classes. I have taken the inbound email class that Salesfoce has made available for use with custom objects, but now I need ...
0
votes
1answer
53 views

Template changes font code when editing

I have created a template from different content areas based on free format. The problem I have is that at first all the content is charged on the template but when I want to edit the content of that ...
-1
votes
1answer
59 views

Code coverage help! I need help writing the test class for a trigger

My issue is that although my test class (below) passes, I am getting 0% test coverage on the trigger. Not sure why?!! Below are my trigger and test class: Here's my trigger: trigger ...
1
vote
1answer
162 views

Casting 0.00 decimal fields to null check in APEX

I'm working on standard page and what is the best way to cast any 0.00 to null check? I have a situation where I want to check to see if the decimal value is 0.00 but is that consider to be a best ...
3
votes
3answers
726 views

Getting dynamic Record Type name/id

Is there a way I can find out what recordType the user have selected? I have put together the apex code : private String getRecordTypeSelectedId(String recordTypeName) { String rtId; ...
1
vote
1answer
109 views

Is there a way to capture what RecordType user has picked using apex code

I have few different record-types in my object and I like to know either by Id/Name what record-type the user have selected and based on that record type selection I have to perform some logic behind ...
-2
votes
3answers
53 views

Updating a field which is a lookup on ather custom objects

UPDATE 3 Here is my complete code I have so far; I have trigger on vendor__c object trigger vendorTrigger on vendor__c (after insert, after update) { vendorController vencont = new ...
0
votes
1answer
372 views

“expecting a colon” where clause

As you see that I'm calling doQuery() and I'm instantiating object and creating a record and as soon it creates a record I'm getting the ID and once I got the ID I'm querying again to get the Name of ...
1
vote
2answers
304 views

apex visualforce code review

Are there any tools which can be used freely to review apex and visualforce code written and provide some suggestions about code improvement and applying best practices. I need to check quality of ...
0
votes
1answer
292 views

Q: Need to add a list but not sure were in the code

I have a Visualforce page. When you selected a product. I need the "OpportunityLineItem.ListPrice" and "OpportunityLineItem.Terms_c" fields to show the value. The only way I can get the system to show ...
6
votes
4answers
2k views

96% code already used. How to manage it?

We are using a developer sandbox for development. When i go to System OverView > Business Logic > Code Used, i see that we have already use 96% of the amount of code we can write. Can we get it ...
5
votes
2answers
140 views

Is there a more efficient way of getting an object by related list?

I've started programming in Salesforce in January 2015. Most of my code uses this methodology : : List<String> accountIds = new List<String>(); for(Account account : accounts) { ...