-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
9Questions
-
10Replies
Apex Proper(String) function - code
the function works, can you suggest improvements?
public static String proper(String astring) {
if (astring != null) {
String result = '';
String[] regs = astring.trim().split('[ \t\n\r]',0); // any whitespace character, does not allow all Java reg exps unlike the doc says
//System.debug(' regs.length()='+regs.size());
for(String reg : regs) {
//System.debug(' reg:'+reg+' length:'+reg.length());
if (reg.length() >0) {
result += reg.substring(0,1).toUpperCase();
if (reg.length()>1) result += reg.substring(1).toLowerCase();
result+=' ';
}
}
return result.trim();
}
return null;
}
..feels like in computer science class all over again
Message Edited by pierre on 12-03-2008 04:07 PM
public static String proper(String astring) {
if (astring != null) {
String result = '';
String[] regs = astring.trim().split('[ \t\n\r]',0); // any whitespace character, does not allow all Java reg exps unlike the doc says
//System.debug(' regs.length()='+regs.size());
for(String reg : regs) {
//System.debug(' reg:'+reg+' length:'+reg.length());
if (reg.length() >0) {
result += reg.substring(0,1).toUpperCase();
if (reg.length()>1) result += reg.substring(1).toLowerCase();
result+=' ';
}
}
return result.trim();
}
return null;
}
..feels like in computer science class all over again
Message Edited by pierre on 12-03-2008 04:07 PM
-
- pierre
- December 04, 2008
- Like
- 0
- Continue reading or reply
outbound email features are USELESS (given the current limits)
"All mass email and single email messages sent with the sendEmail method count against the daily mass mail limit of the sending organization. When the daily mass mail limit for the organization is reached, all calls to the sendEmail method are rejected, and the user receives a MASS_MAIL_LIMIT_EXCEEDED error code" (in the doc)
This renders the Apex outbound email features USELESS !! What's the point of a sendEmail feature if I'm not sure if the email will be sent or not, depending on how much users would have already done some mass email or not?!!
Everyone: vote at http://ideas.salesforce.com/article/show/10087499?page=last#lastPost .
This renders the Apex outbound email features USELESS !! What's the point of a sendEmail feature if I'm not sure if the email will be sent or not, depending on how much users would have already done some mass email or not?!!
Everyone: vote at http://ideas.salesforce.com/article/show/10087499?page=last#lastPost .
-
- pierre
- November 25, 2008
- Like
- 0
- Continue reading or reply
Passing information to the user: popup, dhtml, dynamic visualforce ?
Problem: I'm designing a nice powerful apex code or s-control, but it's manipulating the record and I need to update the user on what the code is doing. For instance, I need to tell him/her that the code is updating the opportunity stage because of so and so..
Now how can I send information back to the user?
1) I can send an email (apex email api) to the user: not the best solution
2) I can dynamically display a portion of the page with visualforce, but it looks very long and painful to develop, see http://wiki.apexdevnet.com/index.php/Visualforce_DynamicEditPage
3) I can display a popup in javascript, but only if I'm writing an s-control (can apex dyamically run javascript? )
In an ideal world, I could code in one-line a dynamic information popup with minimal features: disappearing after one click, automatic snapshot of the page included in the popup, easy control of the text message font and color, maybe some Flash toolkit (Flash in SFDC pages = admiration from the users), something easy to code...
Now how can I send information back to the user?
1) I can send an email (apex email api) to the user: not the best solution
2) I can dynamically display a portion of the page with visualforce, but it looks very long and painful to develop, see http://wiki.apexdevnet.com/index.php/Visualforce_DynamicEditPage
3) I can display a popup in javascript, but only if I'm writing an s-control (can apex dyamically run javascript? )
In an ideal world, I could code in one-line a dynamic information popup with minimal features: disappearing after one click, automatic snapshot of the page included in the popup, easy control of the text message font and color, maybe some Flash toolkit (Flash in SFDC pages = admiration from the users), something easy to code...
-
- pierre
- September 04, 2008
- Like
- 0
- Continue reading or reply
AJAX async query calls success AND failure, error "invalid argument" number -2147024809
I'm doing a simple async query:
sforce.connection.query(str,{onSuccess : nearbysuccess, onFailure : nearbyfailure, timeout: 40000});
the query (str) works, I tested it with the sforce explorer.
AND results are returned, the success callback is called BUT 'nearbyfailure' is ALSO called !!!!
the error returned has the following Javascript attributes:
name: "Error"
number : -2147024809
description: "Invalid argument."
message: "Invalid argument."
What is going on?
sforce.connection.query(str,{onSuccess : nearbysuccess, onFailure : nearbyfailure, timeout: 40000});
the query (str) works, I tested it with the sforce explorer.
AND results are returned, the success callback is called BUT 'nearbyfailure' is ALSO called !!!!
the error returned has the following Javascript attributes:
name: "Error"
number : -2147024809
description: "Invalid argument."
message: "Invalid argument."
What is going on?
-
- pierre
- March 14, 2008
- Like
- 0
- Continue reading or reply
SFDC Labs: Campaign Timeline 1.1 bug: no campaign name in time bands
See snapshot below: the 2 middle bands are empty:

However the data is loaded correctly:

However the data is loaded correctly:
-
- pierre
- February 14, 2008
- Like
- 0
- Continue reading or reply
Excel Connector:Refresh query improvement (X-posted on VB and Office Development)
I posted this in a different branch but I believe it would interest all SFDC admins: a customization to the Excel Connector refresh query so it doesn't stop at the first ID that was deleted, but on the contrary tells that the record was deleted and continue querying the rest of the IDs.
The post is at
http://community.salesforce.com/sforce/board/message?board.id=VB_development&message.id=1627
The post is at
http://community.salesforce.com/sforce/board/message?board.id=VB_development&message.id=1627
-
- pierre
- August 03, 2007
- Like
- 0
- Continue reading or reply
Excel Connector:Refresh query telling if record was deleted !
I modified the VB code of the Excel connector so that when doing Refresh query, it doesn't stop anymore with an annoying error at the first record it finds being deleted. Now, it populates the other cells of the row with the string "Deleted" and continues to query on the other IDs!!!
Extreeeemely useful in the real world of SFDC administration, where you have to add information to existing reports all the time.
I can't copy/paste the whole code, I'll try to be brief:
in s_force / query_row:
call the processqueryresults as sd = salesforce.ProcessQueryResults(idlist, qr)
delete the line so = sd.Item(objectid(rw.row))
and replace the beginning of the loop below with
If name <> "Id" Then ' don't overwrite the id on this row.. it may be a formula
If IsNull(sd.Item(objectid(rw.row))) Then
g_table.Cells(rw.row + 1 - g_table.row, j).value = "Deleted"
Else
Set so = sd.Item(objectid(rw.row))
Debug.Assert IsObject(so)
Then you need to modify the core module "CSession", in the function ProcessQueryResults as:
change the signature to ProcessQueryResults(idlist, ByVal qr As QueryResultSet3)
then you need to completely change the method to:
....
Dim max As Integer
If qr.Size = 0 Then 'was if x= 0
'did not get everything i hoped for
Set ProcessQueryResults = Nothing
Exit Function
End If
max = UBound(idlist)
For Each s In qr
check:
If StrComp(s.Item("Id").value, idlist(x)) = 0 Then
' MsgBox ("add in sd: " & s.Item("Id").value)
sd.Add s.Item("Id").value, s
x = x + 1
Else
' MsgBox ("add in sd 2 : " & idlist(x) & " Null")
sd.Add idlist(x), Null
If x = max Then
GoTo exitloop
Else
x = x + 1
GoTo check
End If
End If
Next s
exitloop:
Set ProcessQueryResults = sd
Extreeeemely useful in the real world of SFDC administration, where you have to add information to existing reports all the time.
I can't copy/paste the whole code, I'll try to be brief:
in s_force / query_row:
call the processqueryresults as sd = salesforce.ProcessQueryResults(idlist, qr)
delete the line so = sd.Item(objectid(rw.row))
and replace the beginning of the loop below with
If name <> "Id" Then ' don't overwrite the id on this row.. it may be a formula
If IsNull(sd.Item(objectid(rw.row))) Then
g_table.Cells(rw.row + 1 - g_table.row, j).value = "Deleted"
Else
Set so = sd.Item(objectid(rw.row))
Debug.Assert IsObject(so)
Then you need to modify the core module "CSession", in the function ProcessQueryResults as:
change the signature to ProcessQueryResults(idlist, ByVal qr As QueryResultSet3)
then you need to completely change the method to:
....
Dim max As Integer
If qr.Size = 0 Then 'was if x= 0
'did not get everything i hoped for
Set ProcessQueryResults = Nothing
Exit Function
End If
max = UBound(idlist)
For Each s In qr
check:
If StrComp(s.Item("Id").value, idlist(x)) = 0 Then
' MsgBox ("add in sd: " & s.Item("Id").value)
sd.Add s.Item("Id").value, s
x = x + 1
Else
' MsgBox ("add in sd 2 : " & idlist(x) & " Null")
sd.Add idlist(x), Null
If x = max Then
GoTo exitloop
Else
x = x + 1
GoTo check
End If
End If
Next s
exitloop:
Set ProcessQueryResults = sd
Message Edited by pierre on 08-03-2007 04:51 PM
-
- pierre
- August 03, 2007
- Like
- 0
- Continue reading or reply
Override always need 2 requests? speed up overrides?
When Overriding a button, any subsequent click to the button operates
no longer just one request to the sfdc servers (request to display the
new/edit/delete/... page) BUT 2 requests: one for the s-control that
overrides the button, then usually one for the original page.
Is there another way?
For instance, is there a way to place the s-control code within the sfdc servers (in a Apex-like manner) so that those are executed by the server instead of the user browser? It doesn't make much sense, you might say, because it's most often javascript (and not Apex code), but I think most of what most people want to do in overriding buttons is server-like code, not user-interfacing code.
Or is there another way to shorten the response time between the click and the page return, apart of asynchronous operations?
For instance is there a way that the page refresh (for instance to a "URLFOR(Action...." or to a hardcoded "../e/00..." type of URL) be the FIRST operation in the s-control?
Is there another way?
For instance, is there a way to place the s-control code within the sfdc servers (in a Apex-like manner) so that those are executed by the server instead of the user browser? It doesn't make much sense, you might say, because it's most often javascript (and not Apex code), but I think most of what most people want to do in overriding buttons is server-like code, not user-interfacing code.
Or is there another way to shorten the response time between the click and the page return, apart of asynchronous operations?
For instance is there a way that the page refresh (for instance to a "URLFOR(Action...." or to a hardcoded "../e/00..." type of URL) be the FIRST operation in the s-control?
-
- pierre
- June 22, 2007
- Like
- 0
- Continue reading or reply
Excel connector: how to remove blocking query errors?
The Excel connector stop with a dialog box whenever it hits an error, this is annoying when performing large queries.
For instance, I'm querying the account type of ~2000 records. The query stops each time it hits a deleted Id, which forces me to rearrange the file and rerun the query each time. The error I get is:
salesforce: update() <<<---- this is weird, since I'm doing a query, pobably just a UI error
invalid Range, missing data type, or other error, type is: Account Object required
Is there a possibility to remove those dialog boxes and unblock query processes?
Best would be to insert the error in the cell instead of displaying an error box.
-
- pierre
- December 12, 2006
- Like
- 0
- Continue reading or reply
Passing information to the user: popup, dhtml, dynamic visualforce ?
Problem: I'm designing a nice powerful apex code or s-control, but it's manipulating the record and I need to update the user on what the code is doing. For instance, I need to tell him/her that the code is updating the opportunity stage because of so and so..
Now how can I send information back to the user?
1) I can send an email (apex email api) to the user: not the best solution
2) I can dynamically display a portion of the page with visualforce, but it looks very long and painful to develop, see http://wiki.apexdevnet.com/index.php/Visualforce_DynamicEditPage
3) I can display a popup in javascript, but only if I'm writing an s-control (can apex dyamically run javascript? )
In an ideal world, I could code in one-line a dynamic information popup with minimal features: disappearing after one click, automatic snapshot of the page included in the popup, easy control of the text message font and color, maybe some Flash toolkit (Flash in SFDC pages = admiration from the users), something easy to code...
Now how can I send information back to the user?
1) I can send an email (apex email api) to the user: not the best solution
2) I can dynamically display a portion of the page with visualforce, but it looks very long and painful to develop, see http://wiki.apexdevnet.com/index.php/Visualforce_DynamicEditPage
3) I can display a popup in javascript, but only if I'm writing an s-control (can apex dyamically run javascript? )
In an ideal world, I could code in one-line a dynamic information popup with minimal features: disappearing after one click, automatic snapshot of the page included in the popup, easy control of the text message font and color, maybe some Flash toolkit (Flash in SFDC pages = admiration from the users), something easy to code...
- pierre
- September 04, 2008
- Like
- 0
- Continue reading or reply
AJAX async query calls success AND failure, error "invalid argument" number -2147024809
I'm doing a simple async query:
sforce.connection.query(str,{onSuccess : nearbysuccess, onFailure : nearbyfailure, timeout: 40000});
the query (str) works, I tested it with the sforce explorer.
AND results are returned, the success callback is called BUT 'nearbyfailure' is ALSO called !!!!
the error returned has the following Javascript attributes:
name: "Error"
number : -2147024809
description: "Invalid argument."
message: "Invalid argument."
What is going on?
sforce.connection.query(str,{onSuccess : nearbysuccess, onFailure : nearbyfailure, timeout: 40000});
the query (str) works, I tested it with the sforce explorer.
AND results are returned, the success callback is called BUT 'nearbyfailure' is ALSO called !!!!
the error returned has the following Javascript attributes:
name: "Error"
number : -2147024809
description: "Invalid argument."
message: "Invalid argument."
What is going on?
- pierre
- March 14, 2008
- Like
- 0
- Continue reading or reply
New user - HTML / CSS question
I am creating an inline s-control to display some additional values for a custom object from a related object, and I want it to look like part of the regular page. I'm using the example from here:
But the bPageBlock class puts a border on the section, that I don't want. I just want the background to be the same color as the rest of the page.
the beginning of the html I'm using looks like this:
var output = "<div class='bPageBlock secondaryPalette'>";
output += "<div class='pbBody'>";
output += "<DIV class=pbSubsection>";
output += "<table class='detailList' cellpadding='0' cellspacing='0' border='0'>";
output += "<DIV class=pbSubsection>";
output += "<table class='detailList' cellpadding='0' cellspacing='0' border='0'>";
Thanks in advance, I know this is a total beginner-question.
- valygrl
- August 06, 2007
- Like
- 0
- Continue reading or reply
Override always need 2 requests? speed up overrides?
When Overriding a button, any subsequent click to the button operates
no longer just one request to the sfdc servers (request to display the
new/edit/delete/... page) BUT 2 requests: one for the s-control that
overrides the button, then usually one for the original page.
Is there another way?
For instance, is there a way to place the s-control code within the sfdc servers (in a Apex-like manner) so that those are executed by the server instead of the user browser? It doesn't make much sense, you might say, because it's most often javascript (and not Apex code), but I think most of what most people want to do in overriding buttons is server-like code, not user-interfacing code.
Or is there another way to shorten the response time between the click and the page return, apart of asynchronous operations?
For instance is there a way that the page refresh (for instance to a "URLFOR(Action...." or to a hardcoded "../e/00..." type of URL) be the FIRST operation in the s-control?
Is there another way?
For instance, is there a way to place the s-control code within the sfdc servers (in a Apex-like manner) so that those are executed by the server instead of the user browser? It doesn't make much sense, you might say, because it's most often javascript (and not Apex code), but I think most of what most people want to do in overriding buttons is server-like code, not user-interfacing code.
Or is there another way to shorten the response time between the click and the page return, apart of asynchronous operations?
For instance is there a way that the page refresh (for instance to a "URLFOR(Action...." or to a hardcoded "../e/00..." type of URL) be the FIRST operation in the s-control?
- pierre
- June 22, 2007
- Like
- 0
- Continue reading or reply
Excel connector: how to remove blocking query errors?
The Excel connector stop with a dialog box whenever it hits an error, this is annoying when performing large queries.
For instance, I'm querying the account type of ~2000 records. The query stops each time it hits a deleted Id, which forces me to rearrange the file and rerun the query each time. The error I get is:
salesforce: update() <<<---- this is weird, since I'm doing a query, pobably just a UI error
invalid Range, missing data type, or other error, type is: Account Object required
Is there a possibility to remove those dialog boxes and unblock query processes?
Best would be to insert the error in the cell instead of displaying an error box.
- pierre
- December 12, 2006
- Like
- 0
- Continue reading or reply