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

4
votes
1answer
73 views

Tools for code Evaluation [closed]

is there any tools to test the logic at what point will hit the saleforce governor limits (applicable only)?? Any sophisticated tools other PMD to evaluate your code against the salesforce best ...
0
votes
1answer
18 views

AMPscript IndexOf / If Product Included in list

I'd like to display a bulleted list of available products (i.e. Prod1, Prod2, Prod3) based on a list of already-purchased products stored in "Product List" column. I've gotten far enough to think that ...
0
votes
2answers
43 views

How to check if a particular value in a set?

I am taking input values from a CSV file using an Apex class. Whenever the currency code is null it's hitting validation error: Currency ISO Code: invalid currency code: ". " So to handle that,...
1
vote
1answer
43 views

How to compare values in Excel file before uploading?

Inserting excel file using apex, I have 4 columns in file,Column-1 (Name) can contain duplicate values. I want to perform check if column-1 has same values (for example A) and column-2(codes) has ...
2
votes
3answers
103 views

How to check the field value is same for all the records in the list?

I am retrieving records in the list and I want to check if the field Code__c is same for all the records. If not I want to give an error and make sure the field value is same for all the records in ...
1
vote
1answer
36 views

Redirect Back to visualforce Page after successful attachment from a second visualforce page

I have a visualforce page having a Case detail view from which there is a link which opens a new visualforce Page for attachment for that particular case. I am opening that attachment visualforce page ...
0
votes
1answer
30 views

Change Date & Time Format in AMPScript Populated content

I'm working on an e-mail in SalesForce Marketing Cloud that uses AMPScript to populate and event start time. The data extension field that populates the AMP Script is set as a text field, ...
1
vote
1answer
43 views

How to check the map key value with field value?

I am trying to write condition in the class if "field1__c is not equal to map1 key value and field2__c is not equal to map1 key value " then it should throw an error. After assigning when I checked ...
0
votes
1answer
29 views

How to add map value to the object field?

I am inserting records using excel file on VF page. So based on the values I want to map the product names while inserting. I am trying the below code it is inserting all (I want to insert record if ...
0
votes
1answer
24 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
25 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
41 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
17 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
61 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
57 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
67 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
38 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
59 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
62 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
66 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
57 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
29 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
143 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
394 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
2answers
43 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 ...
4
votes
0answers
107 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
17 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
48 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
35 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
55 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
71 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
114 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
257 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
24 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
25 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
260 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
92 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
331 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
148 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
162 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
124 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
140 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
125 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
61 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 ...