The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
12 views

I want to start new line after .(dot) symbol. How can I achieve this

I'm copying data from RichText Area field to Text Area field,When I copied in Text area field,The data is displaying with HTML tags. So used below code to convert, ...
2
votes
1answer
34 views

Add blank space to a string in trigger

So I have a trigger that's working well - it looks at some multi-select fields on a Job object and then matches those to Accounts with the same values, pulling in the Account Manager's email address. ...
3
votes
1answer
51 views

Example of using String.format() with a number / does this function even work?

Per the docs format(String, List<String>) Treat the current string as a pattern that should be used for substitution in the same manner as apex:outputText. Which would lead me to ...
2
votes
1answer
28 views

Is there a simple way to convert any value direct to String in production code?

When I do a System.debug(whatever), SFDC doesn't care whether whatever is a String, a Date, a Datetime, a Boolean, etc... it just makes a string of it and dumps it in the log. But in the following ...
4
votes
1answer
68 views

How can I dynamically transverse SObject fields in Apex?

I am trying to dynamically create a CSV file from Case records. The fields for the CSV file will be determined in custom settings (and therefore shouldn't be hardcoded). Moreover, the fields may ...
6
votes
2answers
148 views

Sanitize a string before injecting it into SOSL

Is there a way through the .net framework or some other package to sanitize strings so that they can be safely used in sosl? Is there any larger standard that SOSL falls under? I was able to find How ...
0
votes
0answers
190 views

Creating REGEX for replacing all special characters except those between quotes

I need to build a regula expression to replace all the special characters in the string with space except those between quotes.I tried [^\w\'] but it replaces special characters ...
0
votes
1answer
97 views

Replacing multiple consecutive spaces with Pipe character

I need to replace multiple consecutive spaces with pipe character ,I tried various regular expression but i couldn't get the output .Can anyone give me solution for this
2
votes
1answer
170 views

Transform JSON with lists inside into form data in Apex

Is it possible to serialize this JSON to Form-data in Apex? The JSON we received: [{"vendorcode":"4444","startDate":"2014-03-02","client":[{"name":"John"}]}] We need to serialize it to Form-Data, ...
4
votes
1answer
416 views

Lower case SOQL with 'IN' operator

I am trying to make a SOQL query trying to match email ids with lower case: SELECT Id, Custom_Email_Id from Custom_Object where Custom_Email_Id IN :list_of_email_ids Here, I am trying to get all ...
2
votes
1answer
2k views

Test string variable for “Blank or Empty” in an apex trigger

I have a variable that successfully holds the result from a query in a trigger. I am able to use this variable to update the Contact record. However; if the query does not return records the ...
2
votes
1answer
622 views

Method does not exist or incorrect signature: [Id].contains(String)?

Error Error: Autocompletefields Compile Error: Method does not exist or incorrect signature: [Id].contains(String) at line 20 column 21 public class Autocompletefields { public ...
1
vote
1answer
79 views

How to insert a string into another string?

I am having a string String S1="https://www.microsoft.com/s/5f5wpyvu1cbdek2ld3as" I am having another string String S2="0000000/demowidget". I want to insert my new string S2 into my old string S1 ...
4
votes
1answer
983 views

Email Template Replace merge field

I have an email template which uses merge fields from a custom object. For reasons difficult to explain here, I have to write my own code to read the body of the email template in Apex, replace merge ...
1
vote
2answers
182 views

Set default value for method inputs

How do you set a default value for a method input? public void myMethod(String input1, String input2); I would like to allow people to only need to state one of the inputs if they want (and have ...
3
votes
2answers
446 views

Formatting Negative Numbers with Parentheses

Formatting numbers on a VF page, but I do a bunch of processing the Apex Class, so I would rather return the formatted String value from the controller. I am doing something like this, but I just ...
1
vote
2answers
173 views

String.rightPad() is failing to include padding

I'm trying to ensure that a certain string var is always exactly 10 chars in length. String.rightPad() seems to be exactly what I need but it is not behaving as expected. Integer maxLen = 10; String ...
2
votes
2answers
116 views

Unable to save URL's as a list of string values

I'm not certain if once I've created a URL via a string, it needs to be treated as a WebLink in order to save it in a list, but every time I try to save a list of them as strings, I get an empty list. ...
2
votes
1answer
1k views

Problem using string replace method

I'm attempting to replace a portion of a large text area using the code below without success. Have I misunderstood the proper usage of the string replace method, and if so, is there another ...
2
votes
0answers
67 views

Email 2 case comment - how to remove the original email

I'm creating a case comment from an inbound email. The created comment already contains the original email (see below). test reply 2 On Wed, Jun 19, 2013 at 10:12 AM, Support wrote: Dear itay, ...
3
votes
1answer
589 views

Curious string comparison issue when string starts with a dash

Try the following example in an anonymous Apex window: String s = '- Default - '; system.debug(s.CompareTo('Banner')<0); // True system.debug(s<'Banner'); // False s = '/ Default -'; ...
6
votes
3answers
887 views

Unable to use multiline with pattern

I'm trying to match a string with Pattern/Matcher, however it is failing because I cannot set Pattern.MULTILINE like the Java documentation uses. String testString = 'Line 1: Does not match\nCustomer ...
-2
votes
1answer
971 views

Pulling picklist options from a multi-value field

I am currently pulling select options for a multi-value picklist from a query which gathers field values from all of the child records from a certain __r relationship of an account. I would like to ...
2
votes
1answer
761 views

Replace text in Rich text area field with trigger

We're using the "Solutions" standard object as our knowledge base, with "Solution details" standard field is a Rich Text Area field (32000 characters). The field structure looks like this: Purpose ...
2
votes
2answers
385 views

Extracting number values in a text field then summing up

I have this field that gets populated by an external service and I want to extract the number values from it then sum the numbers up. For instance, see the text below United Kingdom: 3, Ireland: 1, ...
13
votes
1answer
3k views

Bug in String.split('.')?

I can hardly believe it but split() doesn't work on the . character: String createDate = '01.2.2013'; String[] cd = createDate.split('.'); System.assertEquals(3, cd.size()); // Boom! Tried with ...
5
votes
1answer
1k views

I need a String method in a Trigger to validate if a Rich Text Area is blank

I need assistance in evaluating whether a Rich Text Area custom field is blank using an Apex trigger. Rich Text Field name: Application_Workaround__c I have tried the following within the context ...
1
vote
1answer
515 views

Using RegEx Pattern Match to create DateTime fields in trigger

How do I write code with the correct syntax to run a pattern grouping match within a string, then replace the pattern groups found in the result so that they follow a desired pattern? I've never done ...
7
votes
2answers
254 views

Case sensitive highlighting of keywords

we have a rich text field in one of our objects that contains an html-document. I have created a search page and a user can click on a 'preview'-button which opens the html in a lightbox. I want to ...
0
votes
3answers
1k views

Comparing IDs - use String or don't use Strings

I have some logic where I need to iterate thru a bunch of Opportunities. I need to be able to determine when I hit a new Opportunity Owner ID. I try: String lastownerId = ''; for (Opportunity ...
9
votes
2answers
2k views

How do I do a case-insensitive replace all for a string?

I've got a project where I'd like to replicate some of the internal merge field functionality so users can build a link and it'd be really helpful if I could do a case-insensitive string replaceAll. ...
4
votes
1answer
2k views

How can I call a method from visualforce?

You would think this would be more obvious, but "how can I call a method from a visualforce page?" Say I have something like this: <apex:page controller="PreChatController "> <script> ...
2
votes
3answers
1k views

Encode Long Text Area field

I am working on some code that retrieves certain cases and then emails those cases as a csv. This is working to some extent. The problem I have is that one of the fields is 'Description' which is a ...
2
votes
1answer
523 views

New string methods substring Before/After, etc

I'm playing with the new string toys. I'm getting something out of a CSV (and I have very good reason to need to do that). I tried this: contents = contents.substringAfter('/n') and it's not finding ...