• Reppin__505
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 69
    Replies

 

Before I go reinventing the wheel has anyone ever built a Visualforce page that shows a list of Accounts with list of Opportunities with list of Opportunity Lines?
I'm thinking of nested datatables and realise I'll likely have to do some heavy lifting in code to achieve due to the 1 level limitation with SOQL queries.
Sample code would be appreciated.
thanks,
Manu

 

I have a batch apex class where i'm building collections of websites and emails, so that i can use those collections to filter other other queries which will be made into collections. With all collections set, i want to run through a final loop of the scope to perform business processes.

 

Mockup:

 

for(Object o : scope)

{

listEmails.add(o.Email);

listWebsites.add(o.Websites);

}

 

Map<String, Account> accounts = Gather all accounts where website not in :listWebsties; //Website is key

List<String, Contact> contacts = Gather all contacts where email not in :listEmails; //Email is key

 

for(Object o : scope)

{

   Account = accounts.get(o.website);

Contact = contacts.get(o.Email);

 

Perform business logic here

}

 

The problem is when i run this batch it stays processing for hours. When working with a rather small database this works fine. But in working in a larger environment perhaps this is not the best solution. 

 

Can anyone help me speed up the batch process with a more effective approach?

 

Thanks.

Hello,

 

I have developed an app with a test script. The test script creates test records and gives me 100% test coverage for the app in my developer environment.

 

However the creation of those records in the test script are creating problems when testing the install of my app in another org with validation rules against the record types.

 

For instance, my app is dealing with activities. An org has field validation rules for Events. I'm creating event records in the test script, but the records created in the script do not satisfy the validation rules in the client org, so the installation is failing upon install.

 

I'm surprised to learn that there is not much discussion on this topic, i've looked everywhere.

 

So i think i may be doing things wrong, or maybe i'm approaching this a little differently than what is common practice.

 

Should i be querying for existing records, should i be creating them in my test script, or both?

 

Please reply if you have any insight as to what the common practice is when developing test scripts for packages.

 

Thank you very much. :)

Hello All,

 

I have an issue with SOSL. On my visualforce page there is a form for submitting a search. When the search is initiated the following SOSL call is run using a string submitted from the visualforce page and placed into a variable called urlSearch.

 

Now according to the online documentation the search is not supposed to be case sensitive, however the search string submitted much match case-wise a string within the Event object, otherwise there will be not returned results. So if the search string is 'email' and within the set of Event records there is no 'email' yet there is 'Email', i will get no results returned.

 

 

List<List<sObject>> searchList = Search.query('FIND \''+ String.escapeSingleQuotes(urlSearch) + '*\' IN ALL FIELDS RETURNING Event (AccountId, WhatId, Id, ActivityDateTime, Type, Subject, WhoId, Who.Name WHERE WhatId = \''+String.escapeSingleQuotes(urlID)+'\' OR AccountId = \''+String.escapeSingleQuotes(urlID)+'\')');

 

From the online help:

 

Searches are evaluated from left to right and use Unicode (UTF-8) encoding. Text searches are case-insensitive. For example, searching for Customercustomer, or CUSTOMER

 all return the same results.

 

Has anyone else come accross this issue. Any advice is appreciated. Thanks.

Is it possible to access via apex the object icon url similar to the describeTabs() call for the Metatdata api? DescribeTabs is only for external application calls.

 

I can't seem to find anything out there that would allow a developer access to the icon via apex or visualforce.

 

Any help would be much appreciated.

 

Thank you.

I'm running apex queries against an account to retrieve its related activity history records. However that account has alot of history and as a result i'm running into the error "unexpected exception activity history cannot be queried" somewhere after it recieves over 200 records. When i limit this query to less than 200, 199 for instance, that error goes away.

 

Is this a bug? I cannot find any official documentation on this limit.

 

Here is the query:

 

for(Account account : [Select Id, (Select Id, Description From ActivityHistories limit 199) From Account Where Id = 'some id'])
{
  for(ActivityHistory histories : account.ActivityHistories)
  {
    System.debug(histories.Id); 
  }
}

 

This is not ok as i need all of the activity histories returned. I cannot run additional queries based off of the exception either as it is not possible to catch an 'unexcepted exception'. Anyone have any ideas on how to retrieve all of the activity histories for accounts that would have over 200?


Hello, 

 

I need to report a bug that i noticed for the latest Winter 12 release of the Force.com IDE. But i don't know how, or rather i don't know who to report the bug to.

 

Bug:

 

I noticed that for my new projects created with the Winter 12 release of the Force.com IDE, i am not able to add metadata components such as Email and specific fields for objects, to my force.com project. I need to add these metadata components so that i can deploy them from the Sandbox to Production.

 

In my other projects created prior to the Winter 12 update, i am able to add/remove those metadata components just fine.

 

Please direct if you will to where i can report this bug.

 

Thank you.

So i have no idea why this is, and i don't understand it.

 

I have a bulkified trigger that uses maps in order to avoid running into SOQL governor limits. This trigger also uses static class variables for recursion and for limiting queries.

 

What i'm doing is when a bulk operation such as an insert or update is started on the object, Contact object in this case, then the trigger will build the maps of related Accounts on the first trigger, and will use those maps for the rest of the trigger firings.

 

Here is an example of the operation that is working great, but only for After Update & After Insert trigger operations:

 

1.) Check that a static class variable is not true.

2.) If variable is not true build maps.

3.) Set the static class variable to true.

4.) Perform the trigger operations.

 

For the insert/update triggers, the session state is maintained and the static class variable is not reset until after the end of the bulk operation.

 

However for the before delete trigger, it seems there is no session state, and that the session is reset each time a record is deleted. The session is reset, but the governor limits are cumulitive for a bulk delete of records. So with a before delete triggger, even if using maps, the soql query count keeps counting running into the infamous 'Too Many Soql Queries' limit for the deletion of more than 100 records.

 

Any thoughts on how to prevent running into the SOQL limit would be much much appreciated. I wasn't able to find anything on this anywhere.

 

Thank you.

I am having a hard time today deploying code to production orgs. I continue to get the same error throughout the day: "Unable to generate deployment plan against destination organization."

 

This happens almost every time. Sometimes i am able to deploy, but today this error is seriously hampering my progress. 

 

Is anyone else having a hard time with this?

Hello,

 

I'm curious if it is possible to use a jQuery modal dialog box inside of a section of a Standard object, like the Account object.

 

So i have created a visualforce page and in this page there is a modal window that pops up based on user events. This visual force page will primarily rest inside of a section on the Account standard object.

 

However since these sections are iframes within the standard object page, i have no idea how to get the modal dialog from within the iframe/section to position on top of the parent page, the Account standard object page.

 

Has anyone successfully got this to work before?

Hi there,

 

From what i am reading, it is possible to send a pdf attachment in a visual force email template. But only if that attachment is created on the fly using merge fields. 

 

Is it possible to attach a pdf file that is stored in the Notes & Attachments object, and have that attachment sent with the visual force email template?

 

 

Is it not possible to use Logical Functions in force.com sites?

 

I have a visual force page that is displayed as a public site. The page has an If Statement that shows a list of record names if they are of a certain type. This works great when viewing the page as a visualforce page logged into the org.

 

However when viewing as a public site, i don't get an error, i simply do not get the list returned as if the 'If Statement' is conflicting with the public page.

 

I tried adding the apex java script pages to the visual force page. But still no go.

 

<apex:page standardController="Course__c" recordSetVar="course" showHeader="false" standardStylesheets="false" >
<apex:includeScript value="http://cs1.salesforce.com/soap/ajax/17.0/connection.js"/>
<apex:includeScript value="http://cs1.salesforce.com/soap/ajax/17.0/apex.js"/>
<apex:includeScript value="http://cs1.salesforce.com/static/121310/js/functions.js"/>
<apex:includeScript value="http://cs1.salesforce.com/jslibrary/1309972098000/JiffyStubs.js"/>

<h2>Classroom Courses</h2>

<apex:repeat value="{!course}" var="c">
  <apex:outputText rendered="{!IF(contains(c.Classroom_Type__c, 'Classroom'),'true','false')}"><p class="style1"><a href="http://cs1.force.com/coursedescription?Id={!c.Id}"><apex:outputField value="{!c.Name}"/></a></p></apex:outputText>
  
</apex:repeat>

<dl class="st_text_1 indent_box"><dd>&nbsp;</dd><dd><h3 class="style2">Online Courses</h3></dd></dl>
<apex:repeat value="{!course}" var="c">
  <apex:outputText rendered="{!IF(contains(c.Classroom_Type__c, 'Web'),'true','false')}"><p class="style1"><a href="http://cs1.force.com/coursedescription?Id={!c.Id}"><apex:outputField value="{!c.Name}"/></a></p></apex:outputText>
</apex:repeat>

</apex:page>

 Any ideas?

 

Thanks for your help.

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://my_public_visualforce_page.com");
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);

curl_close($ch);
?>

 

Hello, I have used this for including a visual force page into an existing external web page. However the controller functions relating to the visual force page are not working.  

 

If i include the same visual force page through an iframe, the controller functions work fine. However when including it using php i cannot use the controller at all. 

 

Pulling a visual force page with a server side script into an existing html page and feeding that vf page into a div with ajax is what i'm doing and i do this for the purpose of styling. 

 

Is there something that i'm missing? Some reason why the controller is not getting fed in with the vf page into the html page? Any advice would be greatly appreciated.

 

Hi all,

 

I'm curious what the industry standard IDE is for coding the javascript included in your visual force page?

 

What are you using which you feel speeds up your development time?

Hello,

 

Currently i'm working on a web service which incorporates java to conduct a nightly cron job of transferring records from another database into salesforce. I've installed a local instance of apache tomcat on my windows machine. I've been creating cron jobs using the Cron4J library and they're running great on my practice machine, even start back up when the server gets shut down. Im kind of a newb to java and i'm doing my best to do all my homework on my own and get up to speed the best i can.

 

My question is this: How does one find out all of the outstanding cron jobs that are scheduled to run, and when they're scheduled to run? I'm trying to build a web interface similar to the one in Salesforce Apex Scheduled Jobs, where it shows which jobs have run, and when they're scheduled to run next. 

 

Now there may be cron jobs scheduled through the native java.util.timer library and some scheduled through the cron4J. This brings up a couple more questions:

 

A.) Are these using different methods to schedule jobs.

B.) Is there a way to find out what's scheduled regardless of what library they used for getting scheduled?

 

Thank you so much for you help.

Hello,

 

I have a custom object and i am trying to search that custom object using SOSL.

 

Now when i debug i can see that there are results for that custom object, but i am unable to pull those results, i simply don't know the correct syntax. Can you help?

 

 

List<List<sObject>> searchClassHistory = [FIND 'Note' IN ALL FIELDS RETURNING Classes__c(Parent_Id__c, Originating_Id__c, Type__c, Title__c, Body__c, Original_Created_Date__c Where Parent_Id__c = :a.Id)];
		}		

 

    	for(List<sObject> records: searchClassHistory)
    	{
			for(sObject record : records)
				{
					tempList.add(record);
					System.debug('SEARCHING THE HISTORY ' + record);
					
				}	
    	}

 

The loop to extract the results is not working. Any ideas?

 

 

Hello,

I have a problem using the sObject return type in my visual force controller. I would like to be able to make a return statement which could return seperate objects.

For instance the following statement would return a Notes field.
	public sObject getBody()
	{
		if(titleID != null)
		{
		return [Select Body from Note Where Id = :titleID limit 1];
		}
		else
		{
		return null;
		}
	}
However i get an error when attempting to pull this field on my visual force page.
Error: Read access denied for {0}
          <apex:outputField id="theBodyMessage" value="{!Body.Body}"/>
I'm using sObject because i may want to pull fields from the Activity Object instead of the Notes object, but the decision would be made dynamically.
Any information on why i'm getting this error would be greatly appreciated.

 

Hi, 

 

I have something of a minor issue using the send mail feature in Apex. I am trying to avoid having to hard code the email by using an email template instead. 

 

I would like this template to be sent to a Contacts email, and the template will use merge fields from a Lead record.

 

Now i'm using 'setTargetObject' as the lead record in which merge fields will be applied. And im using 'setToAddresses' as the email address of the contact in which to send the email to. 

 

What happens is that when the email template is sent to the Contact, it is also sent to the email address in the Lead record. I absolutely do not want the message going to the Lead.

 

So i've had to manually script the email in Apex to keep this from happening. 

 

Does anyone know a better way of handling this. Where i can use merge fields from the lead record to send an email template to an email address outside of the lead object?

I have a problem with usings maps on a visual force page. 

 

I have a static visual force page with a fixed number of fields. This visual force page is like a spreadsheet with many rows. On each row there is a specific 'Type' string value, then it is followed by many more fields on the same row.

 

What i would like to do, rather than use a ton of variables for this page is use a map collection. I would like to use the Type field as the key, and then the values to fill in the rest of the fields for that row. This works great, but only if the Type exists for a specific Account record. Every Type will not and cannot exist for every account record.

 

The only thing i need to do now is be able to handle the error: "Map key not found in map" which is showing up on the visual force page. 

 

Is there any way i can handle this exception? Can i do it inside of the method? How do i know what is entering the method?

 

 

 

for(Table__c p : [Select Type__c, value, value, value, value From Table__c])
{
mapOfValues.put(p.Type__c, p);
}


public Map<String, Table__c> getMapOfValues()
{
//WHEN THIS METHOD IS ENTERED, I WANT TO KNOW WHAT IS ENTERING IT SO I CAN HANDLE EXCEPTIONS
return mapOfValues;
}

 

Can i somehow handle the error here on the component?

 

 

<apex:outputText value="{!mapOfValues['Type'].Value}"/>

 

Please help if you can. Thanks for looking it over.

 

 

Hello,

 

I have a visual force page which is simply used as a user interface for a custom object. 

 

I have a button which when clicked should be creating records in another custom object. 

 

The records are successfully created in IE, Chrome, and Firefox. However i cannot get the same functionality while using Safari.

 

Now i'm using Safari 5.0.2 on the PC. And i'm also trying it out on Safari on the iPad.

 

I understand that Safari is only officially supported on the Mac, however shouldn't that apply to the iPad as well?

 

It is critical for me to be able to get this to work on the iPad as that is where the visual force page will be used. 

 

Has anyone experienced this same kind of probjem. Anyone have any suggestions?

 

Thanks so much for your input.

Hello all,

 

I have a requirement for a visualforce page which would repeat tables of account related information. Now i can do this easily if its just an object with one single related object. However if i have for example an Account, then a related object, then an object related to that related object i find that it becomes a little more challenging because soql can only return 1 inner object. 

 

So, i know a wrapper class is the suggested resolution to this problem. However they are very poorly documented and i cannot 'wrapper' my head around them. lol terrible i know. For instance i don't know how i can build a list with all of these related objects to use in the visual force page.

 

So if someone could please walk me (and i'm sure countless others) through this process that would be greatly greatly appreciated. 

 

Here is what i'm trying to do:

 

Relating multiple=

 



I have a batch apex class where i'm building collections of websites and emails, so that i can use those collections to filter other other queries which will be made into collections. With all collections set, i want to run through a final loop of the scope to perform business processes.

 

Mockup:

 

for(Object o : scope)

{

listEmails.add(o.Email);

listWebsites.add(o.Websites);

}

 

Map<String, Account> accounts = Gather all accounts where website not in :listWebsties; //Website is key

List<String, Contact> contacts = Gather all contacts where email not in :listEmails; //Email is key

 

for(Object o : scope)

{

   Account = accounts.get(o.website);

Contact = contacts.get(o.Email);

 

Perform business logic here

}

 

The problem is when i run this batch it stays processing for hours. When working with a rather small database this works fine. But in working in a larger environment perhaps this is not the best solution. 

 

Can anyone help me speed up the batch process with a more effective approach?

 

Thanks.

Hello All,

 

I have an issue with SOSL. On my visualforce page there is a form for submitting a search. When the search is initiated the following SOSL call is run using a string submitted from the visualforce page and placed into a variable called urlSearch.

 

Now according to the online documentation the search is not supposed to be case sensitive, however the search string submitted much match case-wise a string within the Event object, otherwise there will be not returned results. So if the search string is 'email' and within the set of Event records there is no 'email' yet there is 'Email', i will get no results returned.

 

 

List<List<sObject>> searchList = Search.query('FIND \''+ String.escapeSingleQuotes(urlSearch) + '*\' IN ALL FIELDS RETURNING Event (AccountId, WhatId, Id, ActivityDateTime, Type, Subject, WhoId, Who.Name WHERE WhatId = \''+String.escapeSingleQuotes(urlID)+'\' OR AccountId = \''+String.escapeSingleQuotes(urlID)+'\')');

 

From the online help:

 

Searches are evaluated from left to right and use Unicode (UTF-8) encoding. Text searches are case-insensitive. For example, searching for Customercustomer, or CUSTOMER

 all return the same results.

 

Has anyone else come accross this issue. Any advice is appreciated. Thanks.

Hello I am currently having issues running the install.vbs script for the android sdk. I recieve an error at line 25 at character 1, I have ran it through the command line and through windows. I have tried to skip this step due to the errors but i get tons of errors with the sample projects. I am using windows 7 64 bit and the latest sdk 1.02.

 

Thank you in advance for any help you can provide.

 

 

So i have no idea why this is, and i don't understand it.

 

I have a bulkified trigger that uses maps in order to avoid running into SOQL governor limits. This trigger also uses static class variables for recursion and for limiting queries.

 

What i'm doing is when a bulk operation such as an insert or update is started on the object, Contact object in this case, then the trigger will build the maps of related Accounts on the first trigger, and will use those maps for the rest of the trigger firings.

 

Here is an example of the operation that is working great, but only for After Update & After Insert trigger operations:

 

1.) Check that a static class variable is not true.

2.) If variable is not true build maps.

3.) Set the static class variable to true.

4.) Perform the trigger operations.

 

For the insert/update triggers, the session state is maintained and the static class variable is not reset until after the end of the bulk operation.

 

However for the before delete trigger, it seems there is no session state, and that the session is reset each time a record is deleted. The session is reset, but the governor limits are cumulitive for a bulk delete of records. So with a before delete triggger, even if using maps, the soql query count keeps counting running into the infamous 'Too Many Soql Queries' limit for the deletion of more than 100 records.

 

Any thoughts on how to prevent running into the SOQL limit would be much much appreciated. I wasn't able to find anything on this anywhere.

 

Thank you.

I think the issue is the SOQL in the for statement, but I'm having issues trying to put this kind of SOQL Count in a map. I'm assuming some sort of mapping is required to get around my too many queries issue.

 

Can someone please point me in the right direction?

 

 

trigger StarRatingCampaign on CampaignMember (after insert)
{
Set<Id> leadId = new Set<Id>();

for (CampaignMember cm : trigger.new){leadId.add(cm.CampaignId);

Integer i = [SELECT count() FROM CampaignMember where CampaignId != '701C0000000ZFdA' and CampaignId=:Leadid and (Star_RatingF__c = '5' OR Star_RatingF__c = '4')];

Campaign newCampaign = new Campaign(id=cm.campaignid, Total_5_4_Star_Leads__c = i );
update newCampaign;}
}

Hi everyone,

 

Today I faced with one issue related to displaying test coverage in Apex Test Runner tab in IDE. It worked today but after PC reboot it stoped.

Actually it is working in interesting maner. It shows TRIGGERs coverage but not CLASSes. It was showing today class coverage but now it isn't. I just downloaded Windowse's updates and reboot my PC. No changes in Salesforce environment or IDE.

If I run the same test class from browser it shows classes coverage as ussual.

What can be the problem?

 

Update: I just tested run test on other's developer PC and there is the same situation - no class coverage.

 

Update 2: if I click Run Tests on classes folder it shows me apex classes code coverage. If I click Run Tests on ONE particular class then no. But yesterday it showed my code coverage for classes if I click Run Tests on one particular class. What is going on?

  • October 27, 2011
  • Like
  • 0

I am having a hard time today deploying code to production orgs. I continue to get the same error throughout the day: "Unable to generate deployment plan against destination organization."

 

This happens almost every time. Sometimes i am able to deploy, but today this error is seriously hampering my progress. 

 

Is anyone else having a hard time with this?

Getting the following error when trying to add project into IDE

 

Unable to fetch organisation details for 'mike.db@cloudava.com'

 

INVALID_TYPE: Cannot use ApexComponent in this organisation!

 

Any ideas?

When I start typing the name of a class, and then hit "ctr-space" to bring up content assist, I am getting an error "Content Assist" did not complete normally.  Please see the log for more information.

 

The stacktrace is :

 

java.lang.StringIndexOutOfBoundsException: String index out of range: -1at java.lang.String.substring(Unknown Source)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ClassIntfEnumProposal.construct(ClassIntfEnumProposal.java:83)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ProposalAggregator.construct(ProposalAggregator.java:171)at com.salesforce.ide.ui.editors.apex.assistance.proposals.ApexCompletionProposalDelegate.construct(ApexCompletionProposalDelegate.java:88)at com.salesforce.ide.ui.editors.apex.assistance.ApexCompletionProcessor.computeCompletionProposals(ApexCompletionProcessor.java:93)at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1832)at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

Is there a Summer 11 Force.com IDE for Eclipse release coming?  Sure would be nice to not have to manually change the API version on every new component...

 

 I have a program feature that generates PDF documents via the standard Visual Force 'renderAs="PDF"' mechanism. This feature does not work reliably for 'larger' documents (i.e. 50 pages). By 'reliably' I mean that I can run PDF generation 10 times, and it will work successfully 3-5 times out of these 10. The rest of the time, after a 3+ min delay, I get the following error message:

"PDF generation couldn't complete because the request took too long. You are using components that are not fully supported by PDF generation, please consult the documentation for a list of unsupported components."

I've reviewed the page (it's a long and ugly beast, so am not posting it here), but am not seeing anything unsupported or suspicious.  This test can be run on the exact same object, with the exact same data, 10 times in a row, and the results are non-deterministic.   The fact that it works for some runs, but not others makes me suspect that this doesn't have to do with any specific page markup, but I could be wrong.

When I look at the system log output, I see that the controller code for this page is done after 12-15 sec. After that, there's a long delay--when the PDF is rendered successfully, the delay is about 30-40 sec. When it fails, as above, it is 3+ min.

It appears that something is making the PDF rendering engine go haywire, but I have not been able to figure out what it may be, and therefore, how to work around it.

If you have the system log open, you can see that the last statement from the controller (CODE_UNIT_FINISHED|StaticResourcePick <init>) is usually executed a long time before the CUMULATIVE_LIMIT_USAGE line. 

 

 

Does anyone have any ideas/suggestions?

Hi,

 

I am getting the below error when i try to save my Apex Controller.

 

line -1, column -1: Dependent class is invalid and needs recompilation: <Namespace.ApexClassName>: <line No> Didn't understand relationship '<Custom Object Name>' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

 

I checked my WSDL file and could see the field in that Object.

 

Can anyone help me why is this issue being faced.

 

Regards,

OnDem

I have a visualforce page sitting on the home page within an iframe.  I want the user to be able to click a link on that visualforce page and display the details page for the specific object (e.g. a Task).

 

When the user clicks the link the page refreshes but only within that iframe. How do I get the parent window (i.e. my main salesforce window) to refresh as if the page was being accessed normally?

 

Thanks in advance...

  • April 29, 2009
  • Like
  • 0