• JSpence
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 17
    Replies

Hello fellow SFdevs,

 

Is there a way to call the onclick event code in a custom button via apex from the system log?

 

Example:

 

MyObject.MyCustomSubmitButton()

 

 

Is it possible to define a range to match in SOQL (like t-sql)?

 

For example Where not(name like 'P[0-9]%') ?

I'm trying to construct a csv file from datafields and email it to a person. This isn't a problem and works perfectly.

 

The problem I'm having is when excel reads the csv file and trys to interpret the new lines or carriage returns, it spits out boxes where a carriage return appears: ▖

 

I have tried stripping/trimming out all extra whitespace whilst maintaining the newlines with no luck. 

 

Here are some code samples:

cleanString = '\"'+dirtyString.replaceAll('[\n\r]', '').trim()+'\"'; //works but doesn't maintain one newline

 

cleanString = '\"'+dirtyString.replaceAll('\\r', '')+'\"'; //doesn't work

 

String [] array = dirtyString.split('[\n\r]');
for (Integer i = 0; i < address.size(); i++) {
	cleanString = cleanString+address[i].trim()+'\n';
}//doesn't work, still has boxes after every new line

 

 

The Email attachment object is:

Blob b = blob.valueOf(csv);
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('Details.csv');
efa.setContentType('text/csv');
efa.setBody(b);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});

 where 'csv' is the comma separated string.

 

Any ideas anyone? 

I'm struggling to get my head properly into soql queries.. I have two objects(Appointment and Quote) which lookup on Opportunity. I want some of the information in these objects which relate to an opportunity.

 

From what exampIes I have seen, this might be possible?:

SELECT something,
(SELECT somethingelse FROM child)
FROM
Parent

 

But I'm getting errors that it doesn't understand the relationship.

 

Here's a non working example of the sort of thing I'm looking for

 

SELECT
id, Scheme__c, Entity__c, Account.Fuel__c,
(SELECT id FROM Quote__c WHERE Is_Primary__c = true AND isdeleted = false),
(SELECT id FROM Appointment__c WHERE Type__c = 'Survey' AND isdeleted = false ORDER BY CreatedDate DESC limit 1),
(SELECT id FROM Appointment__c WHERE RecordType.name = 'Inspection' AND isdeleted = false ORDER BY CreatedDate DESC limit 1)
FROM Opportunity
WHERE isdeleted = false

 

any pointers would be appreciated! 

Hi there,

 

I'm trying to compare a field in an object which relates to another object which has the same API name.

This results in a FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object.

 

I can print the information successfully, the probelm arrises when I do string1.equals(string2); (where String 2 is the field name in an object AND an object API name.) For some reason Apex decides I want the object name instead of the field name, which is weird since I'm defining "object.field" in my .equals()

 

Is there a way to select by alias in SOQL or set up a new instance of String (String myString = new String();) ?

Hello fellow SFdevs,

 

Is there a way to call the onclick event code in a custom button via apex from the system log?

 

Example:

 

MyObject.MyCustomSubmitButton()

 

 

Is it possible to define a range to match in SOQL (like t-sql)?

 

For example Where not(name like 'P[0-9]%') ?

I'm trying to construct a csv file from datafields and email it to a person. This isn't a problem and works perfectly.

 

The problem I'm having is when excel reads the csv file and trys to interpret the new lines or carriage returns, it spits out boxes where a carriage return appears: ▖

 

I have tried stripping/trimming out all extra whitespace whilst maintaining the newlines with no luck. 

 

Here are some code samples:

cleanString = '\"'+dirtyString.replaceAll('[\n\r]', '').trim()+'\"'; //works but doesn't maintain one newline

 

cleanString = '\"'+dirtyString.replaceAll('\\r', '')+'\"'; //doesn't work

 

String [] array = dirtyString.split('[\n\r]');
for (Integer i = 0; i < address.size(); i++) {
	cleanString = cleanString+address[i].trim()+'\n';
}//doesn't work, still has boxes after every new line

 

 

The Email attachment object is:

Blob b = blob.valueOf(csv);
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('Details.csv');
efa.setContentType('text/csv');
efa.setBody(b);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});

 where 'csv' is the comma separated string.

 

Any ideas anyone? 

I'm struggling to get my head properly into soql queries.. I have two objects(Appointment and Quote) which lookup on Opportunity. I want some of the information in these objects which relate to an opportunity.

 

From what exampIes I have seen, this might be possible?:

SELECT something,
(SELECT somethingelse FROM child)
FROM
Parent

 

But I'm getting errors that it doesn't understand the relationship.

 

Here's a non working example of the sort of thing I'm looking for

 

SELECT
id, Scheme__c, Entity__c, Account.Fuel__c,
(SELECT id FROM Quote__c WHERE Is_Primary__c = true AND isdeleted = false),
(SELECT id FROM Appointment__c WHERE Type__c = 'Survey' AND isdeleted = false ORDER BY CreatedDate DESC limit 1),
(SELECT id FROM Appointment__c WHERE RecordType.name = 'Inspection' AND isdeleted = false ORDER BY CreatedDate DESC limit 1)
FROM Opportunity
WHERE isdeleted = false

 

any pointers would be appreciated! 

Hi there,

 

I'm trying to compare a field in an object which relates to another object which has the same API name.

This results in a FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object.

 

I can print the information successfully, the probelm arrises when I do string1.equals(string2); (where String 2 is the field name in an object AND an object API name.) For some reason Apex decides I want the object name instead of the field name, which is weird since I'm defining "object.field" in my .equals()

 

Is there a way to select by alias in SOQL or set up a new instance of String (String myString = new String();) ?