Questions tagged [string]
In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. In Apex it is considered as any set of characters surrounded by single quotes.
498
questions
0
votes
0
answers
30
views
Concat Multi Opps ID To One String
I'm newbie in this. I have an idea like this below:
Example: I have a list Opp With 20 Close Won of only one user, I set up a flow (schedule) to scan all of its ID then input to "Send Email"
...
0
votes
3
answers
90
views
Test Class for a invocable Apex class
I have seen other postings about creating a test class for invocable methods, but not one for a string variable. I am way green on this effort and can't get my head around building a test class to ...
0
votes
0
answers
22
views
Keep richtext codeblock identation and style to chatter feed item
Hi I'm trying to use a richtext in a lwc, in order to accept code snippets (String) denoted by triple single quotes like this:
The lwc takes the richtext value and create a chatter feed item through ...
1
vote
1
answer
81
views
Converting Epoch time to DateTime in Salesforce Apex
I have created a REST API in Salesforce to create cases.
I am getting POST request from user like this:
{
"Origin": "Call"
"LastSeenTime" : "1.713974587E9&...
0
votes
1
answer
38
views
I want to break down a string REST response and only store some parts of it in a Salesforce Object
I'm receiving a Json response from a REST callout and populating a custom object with that information. One of the required fields is Secondary Locations, for this field I'm receiving a list of ...
1
vote
1
answer
150
views
How to split a multiselect picklist into a String array and check if it contains a specific value within an iteration?
I have an iteration of DelegatedAccount (Standard SF object). When Im using obj.picklistValues.split(';').contains(value) its returning false. This is surprising as its a simple operation and should ...
1
vote
1
answer
152
views
Within Governor Limits: Split a Large Text File Apart In Apex
I am writing a class that splits text file apart. Chunking them into 5000 line groupings so I can upload the files contents to another limited system.
The text file contains a Json object on each line....
0
votes
1
answer
166
views
<lightning-formatted-rich-text> converting string to email formatting
I am currently writing a basic search users UI which can search email of users and return based on a search string and bolds the matching chars in the result. I achieve this by adding tags in JS and ...
0
votes
1
answer
264
views
Limit string character limit to 250
I want to check the size of a string. If the size is greater than 255 characters, then reduce it to 252 and add three dots towards the end.
For example.
String1 = 'Suppose this is 255 characters';
...
2
votes
1
answer
65
views
Inner class string passed to LWC being cut off
I have a custom lwc development that gets a configuration object from the backend via @wire decorator that is cutting off one of the response properties.
{
"cascadeMode": true,
"...
0
votes
1
answer
232
views
HTTP Response data being Truncated
I am making a http request and getting response in JSON . When I am converting it to String using request.toString() but getting the truncated response
response sample(This is the part of response ...
0
votes
2
answers
57
views
Unable to convert a particular string format to DateTime
I have the following dateTime values
2023-11-05 09:16:14
2023-11-07 09:16:14
Im getting them properly from a table using Apex code
DateTime startDt = informaticaAuditTableRecords[0].startDate;
...
0
votes
2
answers
215
views
String Manipulation
From a String of <Meaning>Equal</Meaning>, how can I extract only the word Equal to another string?I tried using methods subStringBefore() and subStringAfter(), but is there any other way? ...
0
votes
1
answer
278
views
Two strings that are seemingly equal, when compared with '==', return false, but why?
I have some pretty simple Apex code, something like this:
private static final String X = 'ABC';
// String y is read from a CSV file.
System.debug('<' + y + '>'); // Outputs: <ABC>
...
-2
votes
2
answers
58
views
Stuck with a regular expresion
I have the following in Javascript and are trying to do this in apex but having issues
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[...
0
votes
1
answer
163
views
How to insert predefined amount of blank spaces after a word
I have a situation where I need to export the data from salesforce object and generate the txt or csv file for our client to read and process.I can not use data loader beacuse file should be of a ...
2
votes
2
answers
747
views
Is a Flow formula comparing strings for capitalization changes possible?
I have a flow automation that is triggered based on text changes in a few different fields. In cases of an update, we have some scenarios where users will change values in capitalization alone, from &...
0
votes
2
answers
111
views
update fields in a records which is coming as a string
I am getting fields and its values in form of a string, for example:
field1*Value1,Field2*Value2,Field3*Value3
I need to update above 3 fields in a record with their given values.
Object ob=new object(...
-1
votes
1
answer
41
views
I'm trying to pull in multiple employees names based on who their manager is in an email in Marketing Cloud and can't figure it out
The manager is the recipient and they may have multiple employees that should be in the list below. I want to lookup manager email and then have the employee first and last name populate in ...
1
vote
1
answer
1k
views
I need to convert a String to Blob within a Flow for the VersionData field on a ContentNote/ContentVersion type
I'm trying to insert a File (ContentVersion) or ContentNote with Rich Text within a Flow.
But has anyone encountered the need to convert a string to a blob (base64 encoded type) in order to get a ...
0
votes
1
answer
142
views
parsing trough a JSON html string to obtain key-value pairs?
Im calling an API and after parsing trough the json this is the part I need:
"description": "<b>Precipitating Event</b> updated from: to: testing update\n<b>Age</b&...
0
votes
1
answer
138
views
converting DateTime to String returns the wrong Date as a String
I have the following code to get the DateTime for EST Time Zone
Timezone tz = Timezone.getTimeZone('America/New_York');
DateTime now = Datetime.now();
Datetime localTime = now.addSeconds((tz.getOffset(...
2
votes
4
answers
4k
views
REGEX in Salesforce Flow to retrieve a substring
I need to retrieve a substring from a text field in a flow. is it possible by using regex instead of apex ? If i try this regex i receive false as result ( boolean ), i should get true and then i ...
0
votes
1
answer
167
views
Write an invocable apex class to remove characters from a string
Fairly new to Apex so please bear with.
I am trying to write a simple Apex Class that makes use of the replaceAll function to remove unnecessary characters from a string.
I've got as far as the ...
0
votes
2
answers
430
views
String split on newline creates blank strings for every newline
I have a split on a newline which works fine, but it seems to create a blank value for every time it does a split, so 'MyText' contains the following values, separated by a newline:
Blue
Green
Yellow
...
0
votes
1
answer
48
views
Having issues with handling text field
I have one requirement where text field have information like below format:
String name = 'email,phone(Jason),mobile,address(Mason)';
Now what I want to do is create a Map<Key, List<String>&...
2
votes
1
answer
349
views
Transform a List<String> for use in Multi-Select Picklist where clause
I have a list of strings which I need to put together in every valid combination so that the result can be used in an includes WHERE clause of a multi-select picklist in a SOQL query. Basically, I ...
0
votes
2
answers
459
views
Replace '{}' in Apex
Hello everybody I am passing a Json from javascript to an Apex controller to validate some info. The problem is that the json comes with some values like this:
"Direction": {}
And I want to ...
1
vote
2
answers
194
views
String adjustment by identify position of last letter
I have these different versions of product IDs:
Example 01: CA58762A090604
Example 02: X96017A096602
Example 03: CA61126D149403
Example 04: L00124B1154728
Let me break it up, it consists of
Product - ...
0
votes
1
answer
163
views
ReplaceAll does not function Apex
Hello everybody I am managing data from a LWC form where the user inputs some data and I pass it to validate into an apex class. This validation manages the format of a date time value: I want the ...
0
votes
0
answers
114
views
How do I put a DATE type value in a String field in a Marketing Cloud data extension
I'm trying to do this sql query, but I'm getting an error when converting the type date to string.... I've tried using CAST/ CONVERT/ TRYCAST .. but I must be doing something around because Marketing ...
1
vote
0
answers
161
views
problems with adding Child node to existing XML elements
I am trying to parse html in apex class using XML Parser Document and XML Nodes classes.
At one point I need to add another xml which is present as string with me to one of the nodes as child node in ...
0
votes
0
answers
64
views
Html Parsing in Apex Class [duplicate]
I have a html template file available as attachment in one of my Salesforce object. It contains a proper html form with input tags and sub templates. Whenever I get a request from third party, which ...
-2
votes
1
answer
65
views
fill json with data
Hi everybody I am trying to do a LWC form where the user inputs some values and with them populates a json.
So for example I have the lightning-input:
<lightning-input type="text" label=&...
-1
votes
1
answer
163
views
How "String Split" method works?
How "String Split" method works for the below snippet?
String emailAddress = '[email protected],[email protected],';
There is no value after the second comma. Even it will not throw any errors but ...
-1
votes
2
answers
168
views
Extract data from string and reframe it into another
I have got a string in below format:
String test = '11, -22|32.45, 34|32, 41|32, 12.12';
I am trying to convert it into below format:
{"a":11,"b":-22|"a":32.45,"b&...
0
votes
1
answer
553
views
Its possible using elements in a Flow to edit a phone number? [closed]
Good day Salesforce Dev's!
I have a question for you, hope you have the solution for this.
Im implementing a Flow that fires when a record (account) is created. When the phone number is created, in ...
1
vote
1
answer
140
views
Modify then concatenate String
I have an Email Service that creates Leads from 3rd party vendors. We now want to accept a UTM parameter, but the vendor can’t concatenate. In my class, how can I turn this (which is in the body of ...
1
vote
0
answers
303
views
SOQL returns no results when it should (:tempVar1)
When I run this query in my trigger (and similar on Workbench)
Integer number_cdl = [SELECT count() FROM ContentDocumentLink WHERE ContentDocumentId = '0698c00000ArHhsAAF'];
I get two records as ...
-1
votes
2
answers
56
views
apex string processing [closed]
I have a requirement to replace specific text separated by a delimeter (delimeter can be , : ; etc). Example 1 : In string 'Sonu,krishna,Siva, pintoo' , need to replace specific token/text "...
0
votes
1
answer
1k
views
How to pass ID array from LWC to Apex for VF page parameter
I have an array of Ids in a LWC that I need to pass to Apex. Here is my LWC function:
import downloadPDF from '@salesforce/apex/PrintJobPDFController.getPdfFileAsBase64String';
import downloadjs from '...
-1
votes
1
answer
751
views
Get a value from a string with If condition
I am trying to obtain a value from a string if something is true in the string, example:
I have the following String
String str1 = "{\n\"test1\": \"132456789\",\n\"...
0
votes
1
answer
1k
views
How do I append something to a string until last character?
I'm asking how to append 3 types of strings (initial, middle and final) to each character of an input string
example: "hello" -> I want to have:
initialAppend+H+middleAppend+E+...
0
votes
1
answer
310
views
Marketing Cloud - SQL - Merge values from three columns into one [closed]
I'd need to bring together the values out of three existing columns (extract from a data warehouse) into a new column in order to create the required e-mail address. The e-email address as such is not ...
-5
votes
2
answers
6k
views
How to check if string is null or not?
Is my below condition to compare the string is correct? I have data in all the 6 strings but still all my records are not going inside if loop. Is there any other way to check string null,blank ...
-1
votes
1
answer
868
views
Count number of values under specific JSON key [closed]
I have one JSON output which is parsed from String using JSONParser. Is there a way to check if key "dates" exists and number of values under "dates" in Apex?
dates": [
{
...
0
votes
2
answers
4k
views
JSON Array String into List
Sorry for this noob question but I just want to ask:
String stringJSON = '[{"action":"ASSIGN","value":"Router"},{"action":"DISABLE","...
4
votes
3
answers
939
views
CPU Time consumed by Apex String comparison
I've found that certain string comparisons in Apex consume far more CPU time that would naturally be expected - specifically when at least one of the strings is very long ('long' here means over ...
0
votes
1
answer
56
views
Can't pull a string for apex:image
My client has a 'technical document' which shows you some data about their product, I created a button that gather these information and creates a page and it's all working fine. But depending on what ...
0
votes
2
answers
7k
views
Removing leading zeroes in Date String
I have checked a number of posts and regex examples but for some reason I can't get the leading 0's to be removed from the date string below. Can anyone see what I am doing wrong?
wanted result: 4/6/...