• CRM Jedi
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 9
    Replies

Hi,

Has anyone have experience in extracting a time portion out of a date time object?

For example: 8/12/2009 2:20 PM

I just want to extract the time 2:20 PM from the date time object above. Please advice.

Your help is expreciated.

 

Paul

 

  • August 12, 2009
  • Like
  • 0

When we run test from Eclipse with Force.com IDE Plugin, we can only see triggers in the code coverage result. None of the Apex Classes are shown in the list, we have to run test from UI everytime.

 

Anyone know how can we fix this or anyone facing the same problem?

Example of the scenario:

 

The LIMIT - maximum number of query is 20.

 

We have a trigger with 10 queries. So each execution will take away 10 from the LIMIT.

 

After update, field update executes, and cause the trigger to run again. However, the LIMIT is not RESET. When the second execution starts, it starts from the limit of 10 (due to the first execution), which ended up 20 queries in one execution.

 

Our problem now is that we have more than 10 queries in our triggers, multiple execution will cause "Too many SOQL queries: 21" error. Multiple field update will also cause this issue. (this also applies to other limits like script statements)

 

The question here is: Can we reset the LIMIT when field update triggers the trigger again?

Is there a way to disable logging for Chatter? The amount of logs from Chatter is too much, it make it us for us to find the debug log we want:

 

1. Need to reset debug log frequently

2. System logs are full of chatter logs, sometimes our log doesn't even appear.

Assuming that a user has access to multiple partner portals, is there a way to allow them to choose which Portal they want to login to?

Hi,

 

Assuming that Contact has a relationship to Account, and Account has a relationship to Owner (User), how do I get the information of the Owner when I query from the Contact?

 

I've constructed the following query base on the example of the documentation, it doesn't throw any error but I couldn't get the values for the Owner:

 

SELECT Id, Name, Account.Owner.FirstName FROM Contact;

 

 

Is the SOQL correct?

Hi,

I notice this weird behaviour of SFDC when it displays number on a VisualForce page.

 

 

 When the value is "15,000,000", the value displayed is "1.5E+7"

 

 But when I modify the last digit of the value to "15,000,001", it displays correctly as "15000001"

 

 

Is this a SFDC defect?

We are updating a standard field CreatedDate in one of our testmethod.

 

This method works fine in our sandboxes, but it gave the "Field is not Writable" error when we tried to deploy it to the Production org.

 

This was previously deployed to the Production org without problem. But it started giving problem in this release.

 

Need help to indentify why is this happening.

 

Thanks.

Message Edited by CRM Jedi on 08-20-2009 11:04 PM

Hi,

My understanding is that an org can only send 1000 emails per day.

 

If we have a @future method that execute the sendEmail() method:

 

 

@future public void sendEmailInFuture(){ Messaging.sendEmail(); }

 

And we call this method from other classes. When it reaches the limit, would the remaining messages be sent the next day when the limit is reset?

 

Thanks.

 

 

Hi all,

Recently I have a requirement that requires me to generate table dynamically on a VisualForce page. Although it is not the best way, I've decided to generate HTML Table codes in the controller itself and pass it back to the VisualForce page.

 

The controller has a method similiar to this:

 

    public List<String> getHTMLCode() {

List<String> htmlList = new List<String>();

String tempStr = '';
for(Integer i=0; i<10; i++) {
tempStr = '<tr><td>' + i + '</td><td>THIS IS ROW NUMBER ' + i + '</td></tr>';

htmlList.add(tempStr);
}

return htmlList;

}

 

The VisualForce page is written as followed:

 

<apex:page controller="TestPageController" showheader="false" sidebar="false" >

<table>
<apex:repeat value="{!htmlCode}" var="html">
<apex:outputText value="{!html}"></apex:outputText>

</apex:repeat>
</table>
</apex:page>

 

 This would not work as the page is shown like this:

 

<tr><td>0</td><td>THIS IS ROW NUMBER 0</td></tr><tr><td>1</td><td>THIS IS ROW NUMBER 1</td></tr><tr><td>2</td><td>THIS IS ROW NUMBER 2</td></tr><tr><td>3</td><td>THIS IS ROW NUMBER 3</td></tr><tr><td>4</td><td>THIS IS ROW NUMBER 4</td></tr><tr><td>5</td><td>THIS IS ROW NUMBER 5</td></tr><tr><td>6</td><td>THIS IS ROW NUMBER 6</td></tr><tr><td>7</td><td>THIS IS ROW NUMBER 7</td></tr><tr><td>8</td><td>THIS IS ROW NUMBER 8</td></tr><tr><td>9</td><td>THIS IS ROW NUMBER 9</td></tr>

 

however, tweaking the code by adding a " <script></script> "bfore the <apex:outputtext>, to this:

 

 

 

 

<apex:page controller="TestPageController" showheader="false" sidebar="false" >

<table>
<apex:repeat value="{!htmlCode}" var="html">
<script></script>
<apex:outputText value="{!html}"></apex:outputText>

</apex:repeat>
</table>
</apex:page>

 

 

The page will display correctly:

 

0 THIS IS ROW NUMBER 0
1 THIS IS ROW NUMBER 1
2 THIS IS ROW NUMBER 2
3 THIS IS ROW NUMBER 3
4 THIS IS ROW NUMBER 4
5 THIS IS ROW NUMBER 5
6 THIS IS ROW NUMBER 6
7 THIS IS ROW NUMBER 7
8 THIS IS ROW NUMBER 8
9 THIS IS ROW NUMBER 9

 

So my questions are:

1. Can I rely on this "workaround"? 

2. When <apex:outputtext>is used to displathtml code like <tr><td>, does it suppose to convert it into ascii code like "&lt;" or treat them as normal html tag? This is important for me in the way that if this is a bug, I will need to know what is the expected behaviour so I can cope with it.

 

Thanks in advance :)

 

 

 

Hi all,
I am new to SalesForce.com and would like to know how can I change the label of a related list?

For example,
I was creating a master-detail field for the object Job Posting, when it reached the step where I need to specify the label, I saved it as "Job Posting". But later on I find that I was wrong and would like to change it to something else.

Thank you in advance.

Example of the scenario:

 

The LIMIT - maximum number of query is 20.

 

We have a trigger with 10 queries. So each execution will take away 10 from the LIMIT.

 

After update, field update executes, and cause the trigger to run again. However, the LIMIT is not RESET. When the second execution starts, it starts from the limit of 10 (due to the first execution), which ended up 20 queries in one execution.

 

Our problem now is that we have more than 10 queries in our triggers, multiple execution will cause "Too many SOQL queries: 21" error. Multiple field update will also cause this issue. (this also applies to other limits like script statements)

 

The question here is: Can we reset the LIMIT when field update triggers the trigger again?

Hi,

 

Assuming that Contact has a relationship to Account, and Account has a relationship to Owner (User), how do I get the information of the Owner when I query from the Contact?

 

I've constructed the following query base on the example of the documentation, it doesn't throw any error but I couldn't get the values for the Owner:

 

SELECT Id, Name, Account.Owner.FirstName FROM Contact;

 

 

Is the SOQL correct?

Hi,

I notice this weird behaviour of SFDC when it displays number on a VisualForce page.

 

 

 When the value is "15,000,000", the value displayed is "1.5E+7"

 

 But when I modify the last digit of the value to "15,000,001", it displays correctly as "15000001"

 

 

Is this a SFDC defect?

Hi,

Has anyone have experience in extracting a time portion out of a date time object?

For example: 8/12/2009 2:20 PM

I just want to extract the time 2:20 PM from the date time object above. Please advice.

Your help is expreciated.

 

Paul

 

  • August 12, 2009
  • Like
  • 0
If I have a try/catch block which does an update to the Database, how do I write a test method to execute the catch? It seems I would have to force the update to fail? 
 

//Save the information entered in by the student

try {

//save the changes that the student made on the form

update enrollment;

}

 

catch(System.DMLException e) {

ApexPages.addMessages(e);

System.debug(e);

return null;

}

 

 
Message Edited by Chris987654321 on 08-09-2009 07:21 PM
Message Edited by Chris987654321 on 08-09-2009 07:23 PM

We're also getting the "Too many script statements" error in another one of our triggers.

 

Any ideas?

 

Thanks,
Brad

 

Here is our code:

 

 

trigger OrderLineTrigger on Order_Line_Item__c (after insert, after update) { List<Case> casesToUpdate = new List<Case>(); Set<String> itemIds = new Set<String>(); Set<Id> contactIds = new Set<Id>(); for(Order_Line_Item__c o : trigger.new) { itemIds.add(o.Marketplace_Item_ID__c); contactIds.add(o.Contact__c); } List<Case> caseList = new List<Case>([Select Id, Item_Id__c, Related_To_Order__c, Related_To_Order_Line__c, SKU__c, ContactId, Contact.Id, eBay_User_Id__c From Case Where Item_Id__c IN : itemIds LIMIT 1000]); Map<ID,Contact> contactMap = new Map<ID,Contact>([Select Id, eBay_User_Id__c From Contact Where Id IN :contactIds LIMIT 1000]); for(Order_Line_Item__c o : trigger.new) { for(Case a : caseList) { String eBayUserId; Contact con; if(contactMap!=null) con = contactMap.get(o.Contact__c); if(con!=null) eBayUserId = con.eBay_User_Id__c; if(a.Item_Id__c == o.Marketplace_Item_ID__c && a.eBay_User_Id__c == eBayUserId) { a.Related_To_Order__c = o.Order__c; a.Related_To_Order_Line__c = o.Id; a.SKU__c = o.Product_Code__c; a.ContactId = o.Contact__c; casesToUpdate.add(a); } } } update casesToUpdate; }

 

 

 

Hi, I'm not sure if Validation rules can do this, perhaps there's a nother way :

 

 

The combination of 3 fields on an Account record must be unique (so no other account record can have the same combination of values in the 3 fields). 2 of these fields are Text fields while one is a picklist.

 

Has anyone been able to do something such as this.

 

Any help will be great!

 

 

 

 

 

  • August 09, 2009
  • Like
  • 0

 The highlighted statement below never executes when the event.whatid is associated with an account record where account.dlc_territory = San Francisco.

 

Everything else works.  Any help will be greatly appreciated

 

     public static void EventAssign (Event[] EventRec)
{
Set<Id> acctIds = new Set<Id>();
for (Event ev : EventRec)
{
acctIds.add(ev.whatId);
}
Map<Id,String> EventAssignMap = new Map<Id, String>();


for(Account acct: [select id, ownerid from Account where dlc_territory__c != 'San Francisco' and id IN :acctIds])
{

EventAssignMap .put(acct.id, acct.ownerid);


for (Event a:EventRec)
{
if( a.whatid != EventAssignMap.get(acct.id))
{
if (a.meeting_status__c== 'Pending' || a.meeting_status__c== 'Executed')
{
a.ownerid = EventAssignMap .get(a.whatId);
}
}
else if (a.ownerid !='00530000000eQr3AAE' || a.ownerid != '00530000000cvXwAAI')
{
a.ownerid.adderror ('Test');
}




}
}

}

 

Hi all,
I am new to SalesForce.com and would like to know how can I change the label of a related list?

For example,
I was creating a master-detail field for the object Job Posting, when it reached the step where I need to specify the label, I saved it as "Job Posting". But later on I find that I was wrong and would like to change it to something else.

Thank you in advance.