• astro
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 56
    Replies

I have overridden the New Task buttonto go to a visualforce page which acts as a url creator depending on where the new button was called from.  It builds a the standard new task url but adds a whoId, whatId and retUrl parameter.

 

My problem is that, i want the user to be redirected to the New Task they just created upon clicking on 'save', however instead the user is taken to the homepage upon saving.  And this is no matter what I put in the retUrl.  If I take out the override and manually add some retUrl values to the default new Task page everything works fine.

 

What am I doing wrong?

 

 

Let me know if you need to see any pieces of code and I will gladly provide. 

Message Edited by astro on 03-08-2010 03:35 AM
  • March 08, 2010
  • Like
  • 0

I am developing a Java application which will query tables which may hold over 1,000,000 records.  I have tried everything I could to be as efficient as possible but I am only able to achieve on avg. about 5,000 records a minute and a maximum of 10,000 at one point.  I have tried reverse engineering the data loader and my code seems to be very similar but still no luck.

 

Is threading a viable solution here? I have tried this but with very minimal results.  

 

I have been reading and have applied every thing possible it seems (compressing requests/responses, threads etc.) but I cannot achieve data loader like speeds.  

 

To note, it seems that the queryMore method seems to be the bottle neck.

 

Does anyone have any code samples or experiences they can share to steer me in the right direction?

 

Thanks 

  • February 10, 2010
  • Like
  • 0

I am facing a problem when querying for records where I am not returning all records.

 

More specificaly, I have a query which is returning approx. 11144 results.  I have set the batchSize to 250 and so ultimately only 11000 records are returned.  I would  assume this is because once 11000 is hit, there is less records left to query than the batchsize.  My question is, how do I dynamically set the batchSize to make sure I return all records?  I understand i could do this mathematically but was wondering if there was a more straightforward way, or if I am misunderstanding how to use this function.

 

Thanks 

  • January 22, 2010
  • Like
  • 0

I have a java app I have developed being used to generate export files for an integration I am working on however, I when querying the sfdc instance in question I am receiving an read timeout error.

 

I have even tried Limiting the query to return 1 record and still at times I get this error.  this also occurs when I am calling the .queryMore() method.

 

This error occurs infrequently and I am unsure why.

 

I have tried to catch this error and increase the bindings timeout using binding.setTimeout(currentPoll+100).. and I allow this for 5 iterations of the read timeout error but  nonetheless since I am making so many query calls within my application it is almost a guarantee at this point that several will fail.

 

I have set the initial timeout to the correct binding (I believe this is true because I was told to set the timeout after logging in which I am doing) .

 

Also, I am not sure how to catch the error as well.  I am currently catching an Exception e because using java.net.socketTimeoutException does not seem to work for me.

 

Any help on this issue would be greatly appreciated as I have no idea what to do at this point.

 

I am willing to post any code in order to help!

 

Thanks 

  • January 18, 2010
  • Like
  • 0

Hi Guys,

 

I am getting the following error when Upserting records through the API and I am not sure what I am doing wrong.  I have read that this had to be fixed via a patch but was not sure if that was the case for my particular situation.

 

here is the error in question: duplicate value found: External_ID__c duplicates value on record with id: a04T0000002Ye7D

 

here are the posts i found which pertained to this issue:

 

http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=12968&view=by_date_ascending&page=1

 

http://community.salesforce.com/sforce/board/message?board.id=JAVA_development&thread.id=6938 

 

Thanks in advance to all who view  

 

 

  • January 11, 2010
  • Like
  • 0

I have a requirement which asks me to retrieve only those records that have been modified after a given day.

 

The problem I have is that I know salesforce stores DateTime fields in UTC format and the Timezone the java code is running from is in PST.

 

how do I form my query?  Should it be in the following way (PST has a -8 difference from UTC time)?

 

select ID from Account where LastModifiedDate > 2009-12-09T00:00:00.000-08:00 

 

This doesn't seem to be retrieving the desired results.  I do understand that the time displayed in sfdc and if I were to query for an accounts LastModifiedDate field would display in the timezone according to my profile.  My profile I am using within Java has a Timezone of PST.  So do I even need to convert the timezone or should the query read as follows instead?

 

select ID from Account where LastModifiedDate > 2009-12-09T00:00:00.000Z

 

Thank you in advance for your responses.  

 

 

 

  • December 10, 2009
  • Like
  • 0

I am fairly new (1 day old :D) to the Java API but have been using Apex,VF for a year now.

 

I have a java method which takes a Date as an input and then uses that date to check for records that have been updated within that day or in the future.  

 

For example if the date I recieve is such: 2009-12-10  I would like my query to function as follows:

 

String myDate = "209-12-10T00:00:00";

qr = binding.query("select ID from account where LastModifiedDate > :myDate");

 

ofcourse 

 

however, I cannot create a DateTime object in java or use a String against a DateTime field.  I have seen the Calendar object but am not sure how this would apply.

 

If anyone could help me formulate this query  that would be greatly appreciated.

 

Also, I need understand there is an issue with time's being checked in UTC?  I would need to check times in PST so how would this affect my query?

 

Thank you in advance to all that help! 

  • December 03, 2009
  • Like
  • 0

I have a webservice class which invokes a visualforce page which calls the underlying controller and I am trying to write a test  class for all 3 (the webservice, visualforce page and it's controller).

 

I have a test method in my webservice class which calls another class in which I have a single method in which I setup all data and then call my webservice class to test it.  This class is called mass_emails_test_ff.cls

 

For some reason only the class mass_emails_test_ff.cls is covered and NONE of the actual class I want to test is being covered.  

 

in mass_emails_test_ff.cls I call my webservice as follows: myWebservice.method(argument);

 

I'm not exactly sure why only my 1 class which is used to setup data is covered and nothing else.  Even though I do call the class I intend to test, it still does not get covered.

 

Any help would be appreciated. 

  • October 28, 2009
  • Like
  • 0

Not sure where I am missing this arugment or where an escape character should be used?  Any help would be greatly appreciated.

 

Thank's

 

Here is the line in question:

 

<apex:commandButton value="New Objective" onclick="window.parent.location.replace('/a0y/e?retURL={!Account_Plan_vod__c}&CF00N70000001xEWq={!Account_Plan_vod__c.Name}&CF00N70000001xEWq_lkid={!Account_Plan_vod__c.ID}');" /> 

  • September 11, 2009
  • Like
  • 0

Hey Guys,

 

The scenario I have is this:

 

I need a visualforce page which will allow a user to select an account.  The standardObject for this page is for a custom object which does not have an existing lookup to an account therefore I cannot use the <apex:inputField />.

 

I am wondering how to approach this problem, how do I go about creating a lookup to the account object without going over governor limits?  I can only bring back 1000 records and the environment I am in has well over that.

 

Any thoughts would be greatly appreciated.  Thank you to all that post.

 

  • August 03, 2009
  • Like
  • 0

Hey guys,  Here is my scenario:

 

I have 3 page sections - top, bottom and middle

 

The top is a dropdown list

the middle is a pageblocktable with each row having 2 dropdowns in it

the bottom is just a list which requires no interaction

 

The dropdown in the top section is the same dropdown which is displayed with each row in the middle section.

 

I want it so that when the top dropdown has been changed the corresponding dropdown in the middle section's all get selected with the same values.

 

in my top dropdown controller code, I have the VALUE={} portion referencing a setter method which sets all the corresponding row elements in the middle sections rows to the same value.  But this method seems to NEVER get called.

 

Please tell me what I am doing wrong.

 

Thank's to all who contribute

 

Here is the vf code conercining the TOP dropdown list section

 

and the corresponding code that should be triggers when the value is changed

 

<apex:pageBlockSection title="Bureau Selection" collapsible="false" columns="1" id="bureau"> <apex:form > <apex:selectList size="1" onchange="genericPostbackFunction()" value="{!the_bureau}" style="position: relative; top: 50%; left: 50%;"> <apex:actionSupport event="onchange" reRender="nomination" /> <apex:selectOptions value="{!Speaker_Bureau_Options}"/> </apex:selectList> </apex:form> </apex:pageBlockSection>

 

public Speaker_Bureau_gne__c the_bureau {get; set{ system.debug('setter:'+the_bureau); for(memberContainer mC : membersMap.values()){ mC.Speaker_Bureau_ID_gne = the_bureau.id; system.debug('MC:'+mc); } } }

 


 

  • July 27, 2009
  • Like
  • 0

Hey Guys here's my question:

 

I have a pageBlock in which I have a repeat tag which dynamically creates pageBlockSections for each record I retrieve in the function call I make in the repeat tag.

 

What I would like to be able to do, is be able to click on a checkbox, or button at the end of pageblocksection and when clicked, remove that pageblocksection and rerender the pageBlock (hence calling the repeat tag and redrawing the pageBlockSections minus the one just removed).

 

I'm not sure how to make the checkBoxes bind to the specific record the pageBlockSection it is attached to, I was thinking of making the ID of each pageBlockSection the recordID but you can't seem to set ID values from a getterMethod in your controller.

 

Any help or guidance is greatly appreciated.

 

Thank's! 

  • May 10, 2009
  • Like
  • 0

Hey Guys new to VF and having some problems,

 

here' what I want to do, and I currently cannot find any way of doing this:

 

I have a repeat tag that populates a few fields from a list.

each iteration displays the record's name and 2 2 pickList values (which I want to the user to be able to change via a selectList)

 

 

For each iteration I would like the selectList to display the current pickList value the record holds, instead of being in alphabetical order.

 

Ultimately I want the user to be able to update each of these records pickList fields based on the current value of the selectLists. 

 

Currently the selectLists simply hold all values in the pickList field and when the 'save' button is pushed, the selectList values aren't referenced and the pickList fields remain the same.

 

How can I make it so the selectList displays the records original pickList values first and then the rest of the pickList var's so that on save I can reference each records selectList value and update that record.

 

Also would I be able to make the ID for a pageBlocksection (which resides within thet repeat tag) based on a value retrieved in the repeat process?  this way I can grab the selectList values from each record dynamically no matter how many records I display.

 

I apologize for the length of my question and hope someone can help!

 

Page:

 

<apex:page standardController="Speaker_Bureau_Membership_gne__c" showheader="false" sidebar="false" extensions="em3_bureau_nomination_ctrlr"> <!-- <div class="ptBody secondaryPalette"><div class="content"><img src="/s.gif" alt="Speaker Bureau Membership" class="pageTitleIcon" title="Speaker Bureau Membership"><h1 class="pageType noSecondHeader">Bureau Nomination</h1><div class="blank">&nbsp;</div></div><div class="links"><a href="javascript:printWin('/a2x/x?fcf=00BQ0000000TXDw&amp;rpp_sticky=false')" class="configLinks" title="Printable View (New Window)">Printable View</a> | <a href="javascript:openPopupFocusEscapePounds('/help/doc/user_ed.jsp?loc=help&amp;target=co_view.htm&amp;section=CustomObjects', 'Help', 700, 600, 'width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no', false, false);" title="Help for this Page (New Window)"><span class="helpLink">Help for this Page</span><img src="/s.gif" alt="Help" class="helpIcon" title="Help"></a></div></div><div class="ptBreadcrumb"></div> --> <apex:pageBlock id="theIDs" > <apex:pageBlockButtons > <apex:form > <!-- <apex:commandButton action="{!nominate}" value="Nominate Speakers"/> <apex:commandButton action="{!cancel}" value="Cancel" onClick="window.top.close();"/> <apex:actionFunction name="Nominate" action="{!nominate}" id="out" status="myStatus" onComplete="window.close();"/> --> <apex:commandButton id="nominate" value="Nominate Speakers" action="{!nominate}" onComplete="parent.window.opener.location.reload(); window.close();" /> <apex:commandButton value="Cancel" onClick="window.close();"/> <apex:commandButton value="View IDs" action="{!setID}" reRender="status" /> </apex:form> </apex:pageBlockButtons> <apex:Repeat value="{!members}" var="m"> <apex:param name="mName" value="test" /> <apex:pageBlock > <apex:form > <apex:facet name="header"><b>{!m.name}</b></apex:facet> <apex:pageBlockSection title="{!m.name}" collapsible="false" columns="3"> <apex:outputField value="{!m.Bureau_Member_gne__c}" /> <apex:pageBlockSectionItem > <apex:outputLabel value="Spaker Bureau" for="speaker_bureau"/> <apex:selectList value="{!selected_option}" multiselect="false" size="1" id="speaker_bureau"> <apex:selectOptions value="{!Bureaus}"/> </apex:selectList> </apex:pageBlockSectionItem> <apex:inputField value="{!m.Speaker_Scope_gne__c}" /> </apex:pageBlockSection> </apex:form> </apex:pageBlock> </apex:Repeat> </apex:pageBlock> <apex:pageBlock id="status"> <apex:outputText value="{!ID}" /> </apex:pageBlock> </apex:page>

 

 Controller:

 

public class em3_bureau_nomination_ctrlr { private List<String> myList = new List<String>(); private List<SelectOption> options = new List<SelectOption>(); private List<Speaker_Bureau_Membership_gne__c> myMembers = new List<Speaker_Bureau_Membership_gne__c>(); private String selected_option; private List<Speaker_Bureau_gne__c> myBureaus = new List<SPeaker_Bureau_gne__c>(); private static List<Speaker_Bureau_Membership_gne__c> members = new List<Speaker_Bureau_Membership_gne__c>(); private Map<ID,Speaker_Bureau_Membership_gne__c> ID_to_members_map = new Map<ID,Speaker_Bureau_Membership_gne__c>(); private String IDs; public em3_bureau_nomination_ctrlr(ApexPages.StandardController controller){ reset(); myList = new Map<String,String>(ApexPages.currentPage().getParameters()).values(); setMembers(); setBureaus(); } public void reset(){ myList.clear(); options.clear(); myMembers.clear(); selected_option = null; myBureaus.clear(); members.clear(); ID_to_members_map.clear(); IDs = null; } public void setID(){ IDs +=System.CurrentPageReference().getParameters().get('mName')+','; } public string getID(){ return IDs; } public List<SelectOption> getBureaus(){ options = new List<SelectOption>(); for(Speaker_Bureau_gne__c sb : myBureaus ){ options.add(new SelectOption(sb.Name,sb.Name)); } return options; } public void setBureaus(){ myBureaus = [select ID, Name from Speaker_Bureau_gne__c]; } //For some reason the members variable in this method has a double of every member when it gets to this function. //so if members originally had 2 membership records in the list, it would have 4 in this method. No idea why. Fixed this by making //the members variable static - unclear as to why that helped but logic behind making it static was to have it keeps it's value and not //be refreshed upon instantiation of the controller public void nominate(){ List<Speaker_Bureau_Membership_gne__c> nominations = new List<Speaker_Bureau_Membership_gne__c>(); for(Speaker_Bureau_Membership_gne__c membership : members){ nominations.add(new Speaker_bureau_membership_gne__c( User__c = Membership.User__c, Speaker_Status_gne__c = 'Nominated', Speaker_Scope_gne__c = membership.Speaker_Scope_gne__c, Speaker_Bureau_ID_gne__c = membership.Speaker_Bureau_ID_gne__c, Nomination_Date_gne__c = System.now(), Nominated_By_gne__c = UserInfo.getUserID(), Bureau_Member_gne__c = membership.Bureau_Member_gne__c )); } try{ insert(nominations); }catch(DmlException e){ System.debug(e.getMessage()); } } public void setselected_option(String t){ } public String getselected_option(){ return null; } /*public pageReference cancel(){ //https://cs3.salesforce.com/a2x/o //PageReference pageRef = new PageReference('/a2x/o'); //pageRef.setRedirect(true); //return pageRef; }*/ public void setMembers(){ myMembers = [select ID,User__c, Name,Speaker_bureau_id_gne__c,Bureau_Member_gne__c,Speaker_scope_gne__c from Speaker_Bureau_Membership_gne__c]; createMap(myMembers); } public void createMap(List<Speaker_Bureau_Membership_gne__c> theMembers){ for(Speaker_Bureau_membership_gne__c current_member : theMembers){ if(!ID_to_members_map.keySet().contains(current_member.id)){ ID_to_members_map.put(current_member.id,current_member); } } } public List<Speaker_Bureau_Membership_gne__c> getMembers(){ for(String memberID : myList){ ID temp = memberID; members.add(ID_to_members_map.get(temp)); } return members; } public void setList(ID text){ if(text != null){ myList.add(text); } } public List<String> getList(){ return myList; } }

 

 

 

 

  • May 08, 2009
  • Like
  • 0

I have an command button whose action method calls a method in my controller, the method is invoked and returns back to the commandbutton in which I have a 'onComplete=window.close();' which closes the window but the method invoked in my controller does absolutely nothing.  

 

I tried putting in broken code in that method and also tried everything I could to recieve an error message or atleast SOMETHING back from that method but I get nothing.

 

Any help would be greatly appreciated.

 

Thank's

 

 

<apex:page standardController="Speaker_Bureau_Membership_gne__c" showheader="false" sidebar="false"
extensions="em3_bureau_nomination_ctrlr">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:form >
<!-- <apex:commandButton action="{!nominate}" value="Nominate Speakers"/>
<apex:commandButton action="{!cancel}" value="Cancel" onClick="window.top.close();"/>
<apex:actionFunction name="Nominate" action="{!nominate}" id="out"
status="myStatus" onComplete="window.close();"/>
-->
<apex:commandButton id="nominate" value="Nominate Speakers" action="{!nominate}" onComplete="alert('complete'); window.close();" />

<apex:commandButton value="Cancel" onClick="window.close();"/>
</apex:form>
</apex:pageBlockButtons>

<apex:Repeat value="{!members}" var="m">
<apex:pageBlock >
<apex:form >
<apex:facet name="header"><b>{!m.name}</b></apex:facet>
<apex:pageBlockSection title="{!m.name}" collapsible="false" columns="3">
<apex:outputField value="{!m.Bureau_Member_gne__c}" />

<apex:pageBlockSectionItem >
<apex:outputLabel value="Spaker Bureau" for="speaker_bureau"/>
<apex:selectList value="{!selected_option}" multiselect="false" size="1" id="speaker_bureau">
<apex:selectOptions value="{!Bureaus}"/>
</apex:selectList>
</apex:pageBlockSectionItem>

<apex:inputField value="{!m.Speaker_Scope_gne__c}" />
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
</apex:Repeat>
</apex:pageBlock>
</apex:page>


apex controller method:

somes lines have been depricated that i just threw in while testing so there ignore them.

 

public void nominate(){ List<Speaker_Bureau_Membership_gne__c> nominations = new List<Speaker_Bureau_Membership_gne__c>(); for(Speaker_Bureau_Membership_gne__c membership : this.members){ nominations.add(new Speaker_bureau_membership_gne__c( User__c = Membership.User__c, Speaker_Status_gne__c = 'Nominated', Speaker_Scope_gne__c = membership.Speaker_Scope_gne__c, Speaker_Bureau_ID_gne__c = membership.Speaker_Bureau_ID_gne__c, Nomination_Date_gne__c = System.now(), Nominated_By_gne__c = UserInfo.getUserID(), Bureau_Member_gne__c = membership.Bureau_Member_gne__c )); } //try{ insert(nominations); //}catch(DmlException e){ //System.debug(e.getMessage()); //} //return (new ApexPages.StandardController(Speaker_Bureau_Membership_gne__c)).view(); }

 

 

 

 

Message Edited by astro on 05-07-2009 01:06 PM
  • May 07, 2009
  • Like
  • 0

I have a class which cannot pass because it has alot of try catch blocks.  This class smiply makes calls to another class so it really just contains alot of method calls and each method call is surrounded by a try catch to display a unique message per method called.

 

Is there any way to pass coverage in this way?  I have to have those catches there obviously, even if I put them in the calling class and just return the error message  then my other class will have more code in it and therefore have a lower code coverage result.

 

Any ideas? 

  • May 03, 2009
  • Like
  • 0

Hey guys,

 

needed a way to convert from a 15 digit ID to an 18 digit one.

Found the javascript version for just such an action here: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=13148

 

tried to make my own apex version but the last digit keeps coming out wrong.  Any Ideas?

 

Thank's

 

 

 

String id = '001Q0000002NXad'; //a sample id

 

String suffix = '';

for(integer i=0;i<3;i++){

Integer flags = 0;

for(integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);

if(c >= 'A' && c <='Z'){

flags += 1 << j;
}
}

if (flags <= 25) {

suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);

}else suffix += '012345'.substring(flags-26,flags-26+1);
}

System.debug('15-DIGIT:'+Id);
System.debug('18-DIGIT:'+Id + suffix);

 

 

 

Message Edited by astro on 05-01-2009 10:04 PM
Message Edited by astro on 05-01-2009 10:10 PM
  • May 01, 2009
  • Like
  • 0

Hi sfdc community,

 

I am new to web services and have been working with salesforce for about 4 months now so I hope you take that into consideration while you read my question :)

 

I have several web-services to create for an integration piece on a project I am working on.  As I have been reading, I found apex can easily create web-services from an apex-class by generating a wsdl for that class.

 

My question is, in my web-service I have defined an Object made up of arguments I expect to recieve from the other side of the integration.  So they will be calling my web-service and instantiating the object i defined in my web-service and then calling a method I made which takes that object as an input.  So do I create the logic for that newly recieved object in this web-service class? for some reason that does not seem right because then it would be captured in the 'generated' wsdl.

 

All they would need is object definition and method to call and that is that, they do not need the logic correct?

 

I can post the apex-class here if needed but it's fairly straight-forward, I just need to undersatnd how the procedure works, do i just give them the wsdl before I create the logic for the class so they have the method name and object definition or do they need the entire class itself?

 

thank you in advance for any help 

  • April 08, 2009
  • Like
  • 0

I have a map object being created as follows:

 

Map<Id,Customer_Lookup_Nov__c>([select id, id_Nov__c, Phone_Nov__c, Parent_ID_Nov__c, NOV_ID_Nov__c, MII_Name_Nov__c, Customer_Type_Nov__c, Customer_Record_Type_Nov__c from Customer_Lookup_Nov__c where id_Nov__c IN :accIds]);

 

This makes the Key of the Map the Customer_Lookup_Nov__c id.  I need the Key to be the Customer_Lookup_Nov__c.id_Nov__c value which I am returning in that soql query.

 

Is there any way to do this?

 

I've been trying to iterate over a SET of key's taken from the Map's keyset but then I can't 'get' a particular value from the set.  example: keySetVariable.get(i);  

 

set's do not have getter methods from what I've read in the apex reference guide.

 

Thank's again for the help. 


 

  • March 12, 2009
  • Like
  • 0

I'm writing a trigger in which I need to test if a record already exists in sf before I can proceed.

 

currently I am using this method:

 

if([select count() from account where id = :trigger.new[i].ParentId] > 0) {}

 

however this is not very governer limit friendly.  In the past I've tried using the isNull method wrapped around a try{ } catch  but that returned a null pointer exception (or whatever the equiv. is called in sf, I forget at the moment.

 

i have tried to use

if([select count() from account where id in :accIds] > 0){}

 

but as I understand, this statement works like this:  it will return as many  account records as there are  matching acound id's in thet set.  I just want to know if ONE particular account is in the set.

 

I hope that was clear.  If you  need any further explanation from me just let me know and I'll do my best to provide!

 

  • March 11, 2009
  • Like
  • 0

I have a trigger which occurs on update or insert on the account object. Upon deploying the trigger i kept hitting governer limits so I tried to utilize IN clauses for my soql queries instead of the = statements which I used to write.

 

In changing my code to be more efficient I am now getting an unexpected error from a Sets list.  I thought that Sets were to hvae only unique values in them? so when I query the Set in my soql statement how is it that I'm getting the error that it is returning more than one result?  Here are the pertenant pieces of my code if you need more let me know:

 

 

//Created SETS to hold unique values for recordTypeId's, AccountId's and parentId's

Set<Id> recTypeIds = new Set<Id>();

Set<Id> accIds = new Set<Id>();

Set<id> prntIds = new Set<id>();

 

//Iterate through trigger.new and assign accountId, parentId and

//recordType id to their respective SETS

for(Account acc : Trigger.new){

 

accIds.add(acc.id);

 

prntIds.add(acc.ParentId);

 

recTypeIds.add(acc.RecordTypeId);

}

 

then later on in the code I make an assignment from a SOQL query, this following line is where I get the error:

 

 

//New instance of RecordType to be used to populate the record type field

//on the customer lookup object

RecordType rType;

rType = [select name from RecordType where id IN :recTypeIds];

 

 The way I interprate the error is that there are duplicate RecordTypeId's in the recTypeId's data Set.  I'm not sure how this can be the case however?  In my first snippet of code, are dupes pushed into my recTypeIds set?  I thought it would be rejected or atleast throw me an error.

 

Thanks to all who view and respond. 

 

 

Message Edited by astro on 03-10-2009 05:05 PM
Message Edited by astro on 03-10-2009 05:21 PM
  • March 11, 2009
  • Like
  • 0

I have overridden the New Task buttonto go to a visualforce page which acts as a url creator depending on where the new button was called from.  It builds a the standard new task url but adds a whoId, whatId and retUrl parameter.

 

My problem is that, i want the user to be redirected to the New Task they just created upon clicking on 'save', however instead the user is taken to the homepage upon saving.  And this is no matter what I put in the retUrl.  If I take out the override and manually add some retUrl values to the default new Task page everything works fine.

 

What am I doing wrong?

 

 

Let me know if you need to see any pieces of code and I will gladly provide. 

Message Edited by astro on 03-08-2010 03:35 AM
  • March 08, 2010
  • Like
  • 0

I am developing a Java application which will query tables which may hold over 1,000,000 records.  I have tried everything I could to be as efficient as possible but I am only able to achieve on avg. about 5,000 records a minute and a maximum of 10,000 at one point.  I have tried reverse engineering the data loader and my code seems to be very similar but still no luck.

 

Is threading a viable solution here? I have tried this but with very minimal results.  

 

I have been reading and have applied every thing possible it seems (compressing requests/responses, threads etc.) but I cannot achieve data loader like speeds.  

 

To note, it seems that the queryMore method seems to be the bottle neck.

 

Does anyone have any code samples or experiences they can share to steer me in the right direction?

 

Thanks 

  • February 10, 2010
  • Like
  • 0

I am facing a problem when querying for records where I am not returning all records.

 

More specificaly, I have a query which is returning approx. 11144 results.  I have set the batchSize to 250 and so ultimately only 11000 records are returned.  I would  assume this is because once 11000 is hit, there is less records left to query than the batchsize.  My question is, how do I dynamically set the batchSize to make sure I return all records?  I understand i could do this mathematically but was wondering if there was a more straightforward way, or if I am misunderstanding how to use this function.

 

Thanks 

  • January 22, 2010
  • Like
  • 0

I have a java app I have developed being used to generate export files for an integration I am working on however, I when querying the sfdc instance in question I am receiving an read timeout error.

 

I have even tried Limiting the query to return 1 record and still at times I get this error.  this also occurs when I am calling the .queryMore() method.

 

This error occurs infrequently and I am unsure why.

 

I have tried to catch this error and increase the bindings timeout using binding.setTimeout(currentPoll+100).. and I allow this for 5 iterations of the read timeout error but  nonetheless since I am making so many query calls within my application it is almost a guarantee at this point that several will fail.

 

I have set the initial timeout to the correct binding (I believe this is true because I was told to set the timeout after logging in which I am doing) .

 

Also, I am not sure how to catch the error as well.  I am currently catching an Exception e because using java.net.socketTimeoutException does not seem to work for me.

 

Any help on this issue would be greatly appreciated as I have no idea what to do at this point.

 

I am willing to post any code in order to help!

 

Thanks 

  • January 18, 2010
  • Like
  • 0

I have a requirement which asks me to retrieve only those records that have been modified after a given day.

 

The problem I have is that I know salesforce stores DateTime fields in UTC format and the Timezone the java code is running from is in PST.

 

how do I form my query?  Should it be in the following way (PST has a -8 difference from UTC time)?

 

select ID from Account where LastModifiedDate > 2009-12-09T00:00:00.000-08:00 

 

This doesn't seem to be retrieving the desired results.  I do understand that the time displayed in sfdc and if I were to query for an accounts LastModifiedDate field would display in the timezone according to my profile.  My profile I am using within Java has a Timezone of PST.  So do I even need to convert the timezone or should the query read as follows instead?

 

select ID from Account where LastModifiedDate > 2009-12-09T00:00:00.000Z

 

Thank you in advance for your responses.  

 

 

 

  • December 10, 2009
  • Like
  • 0

I am fairly new (1 day old :D) to the Java API but have been using Apex,VF for a year now.

 

I have a java method which takes a Date as an input and then uses that date to check for records that have been updated within that day or in the future.  

 

For example if the date I recieve is such: 2009-12-10  I would like my query to function as follows:

 

String myDate = "209-12-10T00:00:00";

qr = binding.query("select ID from account where LastModifiedDate > :myDate");

 

ofcourse 

 

however, I cannot create a DateTime object in java or use a String against a DateTime field.  I have seen the Calendar object but am not sure how this would apply.

 

If anyone could help me formulate this query  that would be greatly appreciated.

 

Also, I need understand there is an issue with time's being checked in UTC?  I would need to check times in PST so how would this affect my query?

 

Thank you in advance to all that help! 

  • December 03, 2009
  • Like
  • 0

I have a webservice class which invokes a visualforce page which calls the underlying controller and I am trying to write a test  class for all 3 (the webservice, visualforce page and it's controller).

 

I have a test method in my webservice class which calls another class in which I have a single method in which I setup all data and then call my webservice class to test it.  This class is called mass_emails_test_ff.cls

 

For some reason only the class mass_emails_test_ff.cls is covered and NONE of the actual class I want to test is being covered.  

 

in mass_emails_test_ff.cls I call my webservice as follows: myWebservice.method(argument);

 

I'm not exactly sure why only my 1 class which is used to setup data is covered and nothing else.  Even though I do call the class I intend to test, it still does not get covered.

 

Any help would be appreciated. 

  • October 28, 2009
  • Like
  • 0

Not sure where I am missing this arugment or where an escape character should be used?  Any help would be greatly appreciated.

 

Thank's

 

Here is the line in question:

 

<apex:commandButton value="New Objective" onclick="window.parent.location.replace('/a0y/e?retURL={!Account_Plan_vod__c}&CF00N70000001xEWq={!Account_Plan_vod__c.Name}&CF00N70000001xEWq_lkid={!Account_Plan_vod__c.ID}');" /> 

  • September 11, 2009
  • Like
  • 0