• prettynerd
  • NEWBIE
  • 5 Points
  • Member since 2010

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

I built a Visual Flow process that assigns a value to a variable then uses this variable to lookup a Contact from the database. When I try to change the value after a match has been found by clicking the 'Previous' button, change the search input, click the 'Next' button, it still gives me the result of my first match. It seems that clicking the 'Next' button doesn't resubmit the form or there is a cache of some kind.

 

Does anybody have the same issue?

Need help badly.. T_T

The Map Collection below doesn't store the value that a User enters.. if I try to display the values of the Map, everything is NULL.. anybody, please help..


//In My Controller:

public Map<Integer,Field_Type__c> varFieldTypes {get;set;}
public PageReference MyMethod(){
varFieldTypes = new Map<Integer,Field_Type__c>();
for(Integer i=0; i<10; i++){
varFieldTypes.put(i,new Field_Type__c());
}
return Page.NewPage();
}

 


//In My VF Page:

<apex:variable var="c" value="{!0}"/>
<apex:repeat value="{!someCollection}" var="myVar">
<apex:inputField value="{!varFieldTypes[c].Text__c}"/>
<apex:variable var="c" value="{!c+1}"/>
</apex:repeat>

 

 

hi,

 

please help me identify what's wrong with this code:

 

    <apex:includeScript value="{!$Resource.jquery}"/>

 

    <apex:form onsubmit="shout(event);">

        <apex:inputTextarea id="myTxtArea" value="{!myControllerVariable}"/>

    </apex:form>

 

    <script>

        jQuery.noConflict();


        function shout(event) {
        alert(jQuery("#myTxtArea").val()); ---> this alerts an 'undefined' value!
            if(jQuery("#myTxtArea").val("")) { ---> but would still execute the codes in this condition.. T_T
                jQuery("#errorMsg").text("Please enter a shoutout");
                jQuery("#errorMsg").show();
                event.returnValue = false;
                event.preventDefault();
            }
        }
    </script>

 

jQuery seemed can't reference the <apex:inputTextarea> id in this case.. is this really the case in the salesforce platform?

 

any help would be much appreciated..

Need help badly.. T_T

The Map Collection below doesn't store the value that a User enters.. if I try to display the values of the Map, everything is NULL.. anybody, please help..


//In My Controller:

public Map<Integer,Field_Type__c> varFieldTypes {get;set;}
public PageReference MyMethod(){
varFieldTypes = new Map<Integer,Field_Type__c>();
for(Integer i=0; i<10; i++){
varFieldTypes.put(i,new Field_Type__c());
}
return Page.NewPage();
}

 


//In My VF Page:

<apex:variable var="c" value="{!0}"/>
<apex:repeat value="{!someCollection}" var="myVar">
<apex:inputField value="{!varFieldTypes[c].Text__c}"/>
<apex:variable var="c" value="{!c+1}"/>
</apex:repeat>

 

 

I think the Spring '11 release changed the behavior of some batch apex classes depending on how queries are used. I am now getting the following exception in a batch apex class that I haven't touched in over a year:

 

System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop

 

From what I can tell this started happening after the Spring 11 update.

 

Here is the simple code to reproduce the issue:

 

global class BatchJob implements Database.Batchable<sObject>{

	public string query = 'select Id, Name, (Select Id from Contacts) from Account';

	global Database.QueryLocator start(Database.BatchableContext bc){
		return Database.getQueryLocator(query); 
	}
	
	global void execute(Database.BatchableContext bc, List<sObject> objects){
	 	List<Account> accts = new List<Account>();
	 	for(sObject s : objects){
	 		Account a = (Account)s;
	 		system.debug('Throw error...');
	 		system.debug(a.Contacts); //This will throw a 'silent' System.QueryException
	 	}
	}
	 
	global void finish(Database.BatchableContext bc){
		system.debug('All done.');	 
	}
}

And here is the test class:

 

@isTest
private class BatchBugTEST {

    static testMethod void myUnitTest() {
        Account acct = new Account(Name = 'test');
        insert acct;
        
	//create some contacts
	List<Contact> cons = new List<Contact>();
		
	Integer count = 0;
	for(Integer i = 0; i < 200; i++){
		cons.add(new Contact(AccountId = acct.Id, LastName = 'test' + i));
	}
	insert cons;
	system.debug(cons.size());
		
	//Setup batch job       
        BatchJob job = new BatchJob();
	job.query += ' where Id = \'' + acct.Id + '\'';
		 
	Test.startTest();
	Database.executeBatch(job);
	Test.stopTest();
    }
}

What is most concerning about this is the System.QueryException is "silent". What I mean by this is that the code keeps running as if no exception occurred. Usually when a system exception occurs everything comes to a screeching halt and errors are displayed as test failures on the results page. In the case the code continues and the only way to see the error is to locate it in the debug logs.

 

The only reason I caught this error was good unit tests with assertions. If I didn't have these I would have had no idea this class stopped working correctly. I will be submitting a support ticket but if anyone from salesforce can run the code above on a Winter 11 instance I would be interested what the results are.

 

-Jason

 

 

 

 

  • February 14, 2011
  • Like
  • 0
Hi , I have created Business hours and holidays also associated the Holiday to Business Hours. Now I need to get no of holidays for a business hours in Apex class . But there is no reference of Business Hours in Holidays Object. Could you please suggest any work around . Thanks, Ram

hi,

 

please help me identify what's wrong with this code:

 

    <apex:includeScript value="{!$Resource.jquery}"/>

 

    <apex:form onsubmit="shout(event);">

        <apex:inputTextarea id="myTxtArea" value="{!myControllerVariable}"/>

    </apex:form>

 

    <script>

        jQuery.noConflict();


        function shout(event) {
        alert(jQuery("#myTxtArea").val()); ---> this alerts an 'undefined' value!
            if(jQuery("#myTxtArea").val("")) { ---> but would still execute the codes in this condition.. T_T
                jQuery("#errorMsg").text("Please enter a shoutout");
                jQuery("#errorMsg").show();
                event.returnValue = false;
                event.preventDefault();
            }
        }
    </script>

 

jQuery seemed can't reference the <apex:inputTextarea> id in this case.. is this really the case in the salesforce platform?

 

any help would be much appreciated..

Hi - Thanks for the providing neat and clear solution on the validation. I am trying this and having some road blocks. Can some one please address where the issue is?

 

This is the one i am trying.

I am receiving error: Static Resource named jquery does not exist. Check spelling

and sometimes

unexpected token: '' unexpected token: '<EOF>'at line 0 column -1.

 

 

here is my id value for vendor_meet  j_id0:j_id1:j_id2:j_id63: Validation Error: Value is required.

Please advise.Thanks

 

<apex:page controller="My_Controller" showHeader="false" standardStylesheets="false"> <apex:includeScript value="{!$Resource.jquery}"/> <apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js"/> <script type="text/javascript"> $(document).ready(function() { $(jq(f)).validate(); $(jq(vendor_meet)).rules("add",{ required: true }); jQuery.validator.messages.required = "Please enter a value"; jQuery.validator.messages.equalTo = "You have to enter a value. Please!!!"; }); </script> <apex:form id="commentForm" > <script> var vendor_meet = "{!$Component.vendor_meet}"; </script> <apex:outputlabel for="vendor_meet">Vendor (required)</apex:outputlabel> <apex:inputText id="vendor_meet" value="{!Vendor_Meetings}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:form> <script> function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\\\$1'); } var f = "{!$Component.commentForm}"; </script> </apex:page>

 

 

 

Message Edited by mavs on 03-17-2010 08:51 AM
Message Edited by mavs on 03-17-2010 08:52 AM
Message Edited by mavs on 03-17-2010 02:39 PM
Message Edited by mavs on 03-17-2010 06:38 PM
  • March 17, 2010
  • Like
  • 0

Hi,

 

I got the next message:

 

"Your login attempt has failed. The username or password may be incorrect, or your location or login time may be restricted. Please contact the administrator at your company for help."

 

I have a developer account. how is the admin that I to refer to?

Is it possible to replace the ui/opportunity/SelectSearch with a visualforce page ?
 
any idea ?
 
 
  • July 23, 2008
  • Like
  • 0