• irlrobins
  • NEWBIE
  • 30 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 62
    Replies

Hey all,

 

I have the following chunk of code in a complex VF page:

<apex:dataTable value="{!oi1PricePlans}" width="100%" var="oi1pp" id="oi1pp" rendered="{!renderOi1}">
	<apex:column width="25" styleClass="optionHeight">
		<apex:inputCheckbox id="selectPP1" onclick="deselectOtherOi1(this);calculatePhoneCostOi1({!oi1pp.price}, '{!myOrderItem1.Hardware_Product__r.Name}', '{!oi1pp.smeProductPrice.Price_Plan__r.Name}');calculateMonthlyCostOi1(this,'',{!oi1pp.monthlyCharge},'P');" value="{!oi1pp.selected}">
			<apex:actionSupport event="onchange" action="{!setExtrasAddOnsByPPOI1}" rerender="add_ons_1,extras_1,insurance_1"/>
		</apex:inputCheckbox>
	</apex:column>
	<apex:column styleClass="btext_2">
		{!oi1pp.smeProductPrice.Price_Plan__r.Name}&nbsp;
			<apex:commandLink action="{!setPricePlanDetailsTable}" value="(?)" id="theCommandLink" rel="tooltip" rerender="details" oncomplete="showDetailsDialogPP();" styleClass="see_m_link2" style="font-weight:700;">
				<apex:param assignTo="{!pricePlanId}" value="{!oi1pp.smeProductPrice.Price_Plan__r.id}" name="price_plan_id" />
			</apex:commandLink>
	</apex:column>
	<apex:column width="76" styleClass="b_normal"><strong>€{!oi1pp.monthlyCharge}</strong></apex:column>
</apex:dataTable>

 The object for the data table is a wrapper class, basically consisting of a checkbox, name, price.

 

The desired functionality (which correctly works in IE9 and FF10) is that on selecting one of the checkboxes, the javascript functions should be called using the onclick and then the onchange in the actionsupport rerenders outputpanels that follow the datatable.

 

What happens in IE 8 is that the javascript functions are called on the onclick, but the onchange in the actionsupport doesn't fire until the user has clicked somewhere else on the screen (say a blank area).

 

How can we fix this so it works in IE8? I've tried changing the onchange to onclick and onblur but that doesn't work (the javascript functions failto run properly).

 

Any ideas?

Hey all,

 

Looking for some ideas on the best approach to meet a customer requirement. The requirement is to have a table of available products s and an overlay (or lightbox) that shows more details on a product when a button/link is clicked.

 

The scenario is that there is a VF page that displays all available products (i.e. product image, product name, product price). The data is queried from a custom object that represents the product. The custom object also holds product details/specs. These details will be displayed in the overlay/lghtbox when a link is clicked. By overlay I mean something similiar to this demo: http://flowplayer.org/tools/demos/overlay/index.htm

 

If I was to follow this example, essientially I'd have to create a table to display all the products (this is straight forward, using apex:repeat, and then for each product create a div that holds the product details that is hidden and only shown in the overlay when the appropriate link is clicked. The table and div contents have to generated on page load of course, to allow for an ever changing product set.

 

My concern is that having to generate the table and all the associate divs is quite an overhead and will cause the page to load/refresh slowly.

 

So is there anyway of creating the detail overlay on the fly, using JScript,JQuery, CSS or other method? Or has anyone got a better approach to developing a solution to the requirement?

 

Thanks

R

 

Hey all,

 

We have two force.com sites that have login enabled against two different customer portals. i.e.:

Site 1 -> Customer Portal 1

Site 2 -> Customer Portal 2

 

We had previously modified the SiteLogin page with a custom look and feel associated with Site 1. What I'd like to do is create a second login page (SiteLogin2) that has a look and feel associated with Site 2. So if you're logging in for Site 1 you see SiteLogin page and if you're logging in for Site 2 see SiteLogin2. Is this possible?

 

 

 

Hey all,

 

Taking my first plunge into VisualFlow. I've bashed together a lil proof of concept and it's all working fine bar one thing.

 

What I'd like is that when the flow finishes, the user is taken to another VisualForce page. This Visualforce page is passed a parameter that has the value of a variable in the flow. This is how I'm currently trying to do it:

 

In the VF page:

<flow:interview name="Test_1" interview="{!myflow}" finishLocation="{!EndPage}"/>

 

In the controller for this page:

    public PageReference getEndPage() {
        PageReference pageRef = Page.EndOrder;
         String oid =myflow.vOrder;
         pageRef.getParameters().put('order', oid);   
            return pageRef;
    }

 

where vOrder is a variable set in the flow.

 

But when I try and load the VF page I get the following error:

System.FlowException: Interview not started

 

How can I get the variable value that I can pass as a parameter to the follow page?

 

Thanks

 

 

Hey all,

 

I'm trying to find out a way to determine which accounts records out of my 120K+ accounts have no child objects (contacts, cases, opps, etc).

 

I've tried using apex to determine this but I keep hitting governor limits.

 

Anyone got any suggestions?

Hey all,

 

I have a custom object that is the detail in a master-detail relationship with the Account object. When I create a new instance of the custom object I can select the account (via lookup) that the custom object is related to. But when I go to edit this custom object I am unable to change the master account to different one. I'm logging in as a system admin with view all and modify all permissions for both objects. The OWD for Account is private.

 

Am I missing something obvious here???

Hey all,

 

JQuery novice here so apologies if this is a bit of a palm meet forehead question.

 

I'm trying to create a list of records (for a custom object) and use a JQuery dialog ot confirm which records the user has checked. I've got the Jquery dialog appearing, but it doesn't appear to pick up what checkboxes have been checked.

 

Where am I going wrong oh wise forum members?!

 

Page code:

<apex:page id="MyPage" showHeader="false" controller="testController">
<head><title>My Service Detail</title>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-1.6.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-ui-1.8.16.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
	<script type="text/javascript">
	$(document).ready(function() {
		//var j$ = jQuery.noConflict();
		var $dialog = $('<div></div>')
			.html('{!changes}')
			.dialog({
				autoOpen: false,
				modal: true,
				buttons: {
				"Confirm": function() {
					alert('test');
					$( this ).dialog( "close" );
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
				title: 'Basic Dialog'
			});

		$('#opener').click(function() {
			$dialog.dialog('open');
			// prevent the default action, e.g., following a link
			return false;
		});
	});
	</script>
	
</head>
<apex:form id="myForm">	
		Some header text blah blah blah<br/>
					<apex:pageBlock id="thePageBlock1" title="Available Addons">
						<apex:dataTable value="{!availableaddons}" var="a">
							<apex:column value="{!a.Add_On_Description__c}" width="200px">
								<apex:facet name="header">Addon</apex:facet>
							</apex:column>
							<apex:column value="{!a.Add_On_Cost__c}">
								<apex:facet name="header">Cost</apex:facet>
							</apex:column>
							<apex:column >
								<apex:facet name="header">Checkbox</apex:facet>
                        		<apex:inputCheckbox value="{!a.Dummy_Checkbox__c}"/>
                    		</apex:column>
						</apex:dataTable>	
						<button id="opener">Open the dialog</button>			 
					</apex:pageBlock>
	    	<apex:pageBlock >
		    		<apex:pageMessages />
       		</apex:pageBlock>
   </apex:form>
</apex:page>

Controller code:

 

public class testController {
		List <Subscriber_Add_On__c> SAL = new List <Subscriber_Add_On__c>();
	
		public testController(){
		}
		
		public List<Subscriber_Add_On__c> getAvailableAddOns(){
		return SAL = [Select Add_On_Cost__c,Add_On_Description__c,Dummy_Checkbox__c 
		from Subscriber_Add_On__c];
	}

	public String getChanges() {
    	String newaddons = 'The following addons will be added:';
        
        for (Subscriber_Add_On__c s : SAL) {
            if (s.Dummy_Checkbox__c)
                newaddons=newaddons+s.Add_On_Description__c+',';
        }
		return newaddons;	
	}       
}

 

Subscriber_Add_On__c is a custom object with three fields; description, code and the checkbox.

Hey all,

 

Looking for some help in locating an article/demo online that I recently saw but for the life of me can't locate again.

 

The article/demo showed how you could use javascript remoting to create an instant search functionality. The demo had a input field and as the user entered text (i.e. account name) the results (account details) dynamically updated below. In much the same way that Google instant search works, the more characters you enter the more accurate the results and the returned results update on each character entered.

 

Does anyone remember the article/demo I'm referring to?

 

Someone pointed me at http://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/ but this wasn't the article I read myself.

 

Thanks all!

R

Hey all,

 

I have developed some code that will create a customer portal user using apex. It basically follows the principles in this article. It works correctly, and the user created recieves an email with their login details (username and password).

 

My expectation would have been that when the user first logins successfully with these details, they would be forced to change the password to something different. But my testing does not reflect this expectation.

 

Can anyone confirm that if the behaviour I'm seeing is correct or not? Should the user have to change password on first login?

 

Thanks 

Having an issue with correctly displaying the value of a checkbox field (on Case object) in a datatable.

 

Here is the table code in my VF Page:

<apex:dataTable value="{!CurrentInProgressCaseList}" var="c" width="100%">
	<apex:column >
		<apex:facet name="header">Request ID</apex:facet> 
		{!c.CaseNumber} 
	</apex:column>
	.
	.
	.
	<apex:column >
		<apex:facet name="header">Escalated</apex:facet>
		<c:CP_M2MEscalationComponent escalation="{!c.isEscalated}" />
	</apex:column>
	<apex:column >
		<apex:facet name="header">Raised By</apex:facet>
		{!c.CreatedBy.Name}
	</apex:column>
</apex:dataTable>

 Here is the apex code for the method that pulls in the data for the datatable:

public List<Case> getCurrentInProgressCaseList() {
	if (myInProgressCaseList ==null) {
		myInProgressCaseList = [Select CaseNumber, Customer_Status__c, isEscalated, CreatedDate, CreatedBy.Name from Case where (Customer_Status__c =:'Submitted' or Customer_Status__c =:'In Progress') and AccountId =: this.accountId ORDER BY CreatedDate desc];
	}
	for(Case c:myInProgressCaseList){
		System.debug(c.CaseNumber+': '+c.isEscalated);
	}
	return myInProgressCaseList;
}

 Now if I look in the debug logs for the System.debug statement above, I can clearly see my test case showing with the correct case number and isEscalated set to true.

 

But further down in my debug log I can clearly see the isEscalated value being passed to the component is set to false!

 

13:02:28.597 (597299000)|CODE_UNIT_STARTED|[EXTERNAL]|CP_M2MEscalationComponentController set(escalation,false)
13:02:28.597 (597316000)|SYSTEM_MODE_ENTER|true
13:02:28.597 (597343000)|CODE_UNIT_STARTED|[EXTERNAL]|CP_M2MEscalationComponentController set(escalation,false)
13:02:28.597 (597371000)|CODE_UNIT_FINISHED|CP_M2MEscalationComponentController set(escalation,false)
13:02:28.597 (597383000)|CODE_UNIT_FINISHED|CP_M2MEscalationComponentController set(escalation,false)

 And this is my issue. A case that clearly has its isEscalated field checked/set to true is being passed as false to my component.

 

My question is how/why??

Noticed this morning that many of the apex:commandButtons in our custom VisualForce Pages are not displaying correctly. Their width appears to be 0px in IE 7 and 9. They appear correctly in Firefox 3.6.

 

The visualforce pages form part of our force.com site.

 

I'm assuming this issue is a result of Summer 11 release which went live in emea this weekend,

 

Anyone else seeing this issue?

 

 

 

R

Hey all,

 

I have a VF page that includes an image and a stylesheet that when rendered as html in both org (https://emea.salesforce.com/apex/My_Page) and on my site (http://www.mysite.com/My_Page). But when I change the RenderAs to PDF, the images and CSS fail to work (i.e. broken image in pdf and no styling). I have the two resources as static resources. I've also tried putting the image and css files in Documents and make externally accessible (and tested this) but again still they fail in the pdf.

 

Sample code:

<apex:page standardController="Custom_Object__c" showheader="false" renderAs="pdf">
<apex:image url="{!URLFOR($Resource.MyImage)}" />
<apex:image url="http://www.mysite.com/servlet/servlet.ImageServer?id=015200000010duH&oid=00D200000000MZB&lastMod=1302282092000"/>
<img src="http://www.mysite.com/servlet/servlet.ImageServer?id=015200000010duH&oid=00D200000000MZB&lastMod=1302282092000" />
<img src="{!URLFOR($Resource.MyImage)}" />
etc...

 None of these four work when rendered as pdf when accessed through the site.

 

Anyone any ideas as to why this is? How can I get a static resource accessible in pdf when viewed though a site. As I said, viewing the same VF page thru org works fine. It's only when accessed thru site that the issue arises.

 

thanks

R

Hey all,

 

Hitting a wall in trying to figure this one out.

 

At a high level:

VF Page with a command button whose action returns a pagereference to an external site. This external site checks the referer field in the http headers to determine if it allows access or not.

 

If I use Firefox 3, the referer header is sent and the external site accepts the request. The exact same process in Internet Explorer (7 and 8) fails, as the referer field is not included in the request headers.

 

VF Page (cut out the unrelated code)

<apex:commandButton value="Submit Order" action="{!submit}" rendered="{!DisplayForFinalApprover}"/>

 Controller:

public PageReference submit(){
PageReference pageRef;
pageRef = new PageReference('https://www.externalsite.com/epage.cgi');
pageRef.getParameters().put('MERCHANT_ID','123');
pageRef.getParameters().put('ORDER_ID','123');
etc
pageRef.setRedirect(true);
return pageRef;		
}
	

The above works in FF but not IE. 

 

Now if I put the use outputlink as follows:

<apex:outputLink value="https://www.externalsite.com/epage.cgi?MERCHANT_ID=123&ORDER_ID=123" id="theLink">Submit Order</apex:outputLink>

 

Then the referer field is in the request headers and the external site accepts the request. both in IE and FF.

 

So why does the PageReference work in Firefox, but not in Internet Explorer? Why is the referer field not sent?

Trying  to get the code below to work. I want to create a task when a case owner is changed and assign that task to the new owner using a trigger on the Case object.

 

As the new case owner can be a user or a queue I want to check the new owner's type before creating the task. i.e. if Case Owner is now a queue, then don't create a task.

 

 But for some reason newCase.Owner.Type returns null, when I'm expecting 'User'. Any ideas?

trigger tgrCaseAfterUpdate on Case (after update) {
    for (Case newCase : Trigger.new){        
        Case oldCase = System.Trigger.oldMap.get(newCase.Id); //get old Case
        if(oldCase.ownerID!=newCase.ownerID) &&(newCase.Owner.Type=='User')){
            Task act = new Task();
            act.Subject = 'Case '+newCase.casenumber+' has been assigned to you';
            act.Description = 'Case '+newCase.casenumber + ' has been assigned to you. Click Related To link to view case details.';
            act.ownerId = newCase.ownerID;
            act.Status = 'Not Started';
            act.whatId = newCase.id;
            insert act;
        }
    }
}

Hey all,

 

I'm using Apex to create a customer portal user. Code is below. Just before this method is called I've created an appropriate account and contact. The user is created correctly as expected. However, the login email is never sent. If I reset the password via the org, that email is sent fine. This apex code is executed by a user with a Customer Portal Manager Custom licence. No exceptions are thrown by the method. Any ideas as to why the login email is not sent?

 

    @future static void createUser(String contactId, String email,String firstname, String lastname, String profileId,String deliveryAddress1, String deliveryAddress2,  String deliveryTownCity, String phoneNumber,String approver,Boolean authapprover,String profile,Boolean displayprices,String employeeid,String departmentid,String costcentre,String payrollcode){
        try{
	Database.DMLOptions dmo = new Database.DMLOptions();
	dmo.EmailHeader.triggerUserEmail = true; //sent email with new password, etc
	User u = new User(alias = 'standt', email=email, 
	            emailencodingkey='UTF-8', firstname = firstname, lastname=lastname, languagelocalekey='en_US', 
	            localesidkey='en_IE_EURO', profileid = profileId, contactId=contactId,
	            timezonesidkey='Europe/Dublin', username=email+'.round2',
	            CompanyName = userCompanyName,
	            Approver__c=approver,Authorised_Approver__c=authapprover, Profile__c=profile, 
	            Display_Prices__c=displayprices,
				Employee_ID__c=employeeid, Department_ID__c=departmentid, Cost_Centre__c=costcentre,
			Payroll_Code__c=payrollcode); //create customer portal user
	        
	        u.setOptions(dmo);
	        insert u;

	        insertDeliveryAddress(u,deliveryAddress1, deliveryAddress2,deliveryTownCity, phoneNumber); //insert default delivery address for user
        }catch(System.DmlException e){
								
				ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,e.getMessage());
        }
        	
    }	

Hey all, (apolgoies for cross posting but on reflection I think my question might be better placed here)

 

Anyway, here's a background to what I'd like to do. I have a custom object (Order) which has a status field. When this status field is changed to a certain value I want to sent an email to the Order customer. This is straight forward out of the box funcationality so that's not a problem.

 

Here's where I get stuck. In this email I'd like to include a link to a custom Visualforce page, including the Order Id as a query string. The recipent would click the link and be taken to this VF page. The requirement is that the receipent should not have to login to SFDC to view this page. This VF page will contain one or two fields (probably a datetime type) which the receipent completes and then presses a command button. This command button will trigger code in the controller that will create a case with predefined data as well as the data entered by the receipent.

 

That's it. Not too complex, but I'm not sure if I can do this all without authenticating the user. Can anyone advise please?

 

Thanks

Robin

Hey all,

 

I hope I'm in the right section of the board.

 

Anyway, here's a background to what I'd like to do.

 

I have a custom object (Order) which has a status field. When this status field is changed to a certain value I want to sent an email to the Order customer. This is straight forward out of the box funcationality so that's not a problem.

 

Here's where I get stuck. In this email I'd like to include a link to a custom Visualforce page, including the Order Id as a query string. The recipent would click the link and be taken to this VF page. The requirement is that the receipent should not have to login to SFDC to view this page.

 

This VF page will contain one or two fields (probably a datetime type) which the receipent completes and then presses a command button. This command button will trigger code in the controller that will create a case with predefined data as well as the data entered by the receipent.

 

That's it. Not too complex, but I'm not sure if I can do this all without authenticating the user. Can anyone advise please?

 

Thanks

Robin

Hey all,

 

I have the following chunk of code in a complex VF page:

<apex:dataTable value="{!oi1PricePlans}" width="100%" var="oi1pp" id="oi1pp" rendered="{!renderOi1}">
	<apex:column width="25" styleClass="optionHeight">
		<apex:inputCheckbox id="selectPP1" onclick="deselectOtherOi1(this);calculatePhoneCostOi1({!oi1pp.price}, '{!myOrderItem1.Hardware_Product__r.Name}', '{!oi1pp.smeProductPrice.Price_Plan__r.Name}');calculateMonthlyCostOi1(this,'',{!oi1pp.monthlyCharge},'P');" value="{!oi1pp.selected}">
			<apex:actionSupport event="onchange" action="{!setExtrasAddOnsByPPOI1}" rerender="add_ons_1,extras_1,insurance_1"/>
		</apex:inputCheckbox>
	</apex:column>
	<apex:column styleClass="btext_2">
		{!oi1pp.smeProductPrice.Price_Plan__r.Name}&nbsp;
			<apex:commandLink action="{!setPricePlanDetailsTable}" value="(?)" id="theCommandLink" rel="tooltip" rerender="details" oncomplete="showDetailsDialogPP();" styleClass="see_m_link2" style="font-weight:700;">
				<apex:param assignTo="{!pricePlanId}" value="{!oi1pp.smeProductPrice.Price_Plan__r.id}" name="price_plan_id" />
			</apex:commandLink>
	</apex:column>
	<apex:column width="76" styleClass="b_normal"><strong>€{!oi1pp.monthlyCharge}</strong></apex:column>
</apex:dataTable>

 The object for the data table is a wrapper class, basically consisting of a checkbox, name, price.

 

The desired functionality (which correctly works in IE9 and FF10) is that on selecting one of the checkboxes, the javascript functions should be called using the onclick and then the onchange in the actionsupport rerenders outputpanels that follow the datatable.

 

What happens in IE 8 is that the javascript functions are called on the onclick, but the onchange in the actionsupport doesn't fire until the user has clicked somewhere else on the screen (say a blank area).

 

How can we fix this so it works in IE8? I've tried changing the onchange to onclick and onblur but that doesn't work (the javascript functions failto run properly).

 

Any ideas?

Hey all,

 

Looking for some ideas on the best approach to meet a customer requirement. The requirement is to have a table of available products s and an overlay (or lightbox) that shows more details on a product when a button/link is clicked.

 

The scenario is that there is a VF page that displays all available products (i.e. product image, product name, product price). The data is queried from a custom object that represents the product. The custom object also holds product details/specs. These details will be displayed in the overlay/lghtbox when a link is clicked. By overlay I mean something similiar to this demo: http://flowplayer.org/tools/demos/overlay/index.htm

 

If I was to follow this example, essientially I'd have to create a table to display all the products (this is straight forward, using apex:repeat, and then for each product create a div that holds the product details that is hidden and only shown in the overlay when the appropriate link is clicked. The table and div contents have to generated on page load of course, to allow for an ever changing product set.

 

My concern is that having to generate the table and all the associate divs is quite an overhead and will cause the page to load/refresh slowly.

 

So is there anyway of creating the detail overlay on the fly, using JScript,JQuery, CSS or other method? Or has anyone got a better approach to developing a solution to the requirement?

 

Thanks

R

 

Hey all,

 

We have two force.com sites that have login enabled against two different customer portals. i.e.:

Site 1 -> Customer Portal 1

Site 2 -> Customer Portal 2

 

We had previously modified the SiteLogin page with a custom look and feel associated with Site 1. What I'd like to do is create a second login page (SiteLogin2) that has a look and feel associated with Site 2. So if you're logging in for Site 1 you see SiteLogin page and if you're logging in for Site 2 see SiteLogin2. Is this possible?

 

 

 

Hey all,

 

Taking my first plunge into VisualFlow. I've bashed together a lil proof of concept and it's all working fine bar one thing.

 

What I'd like is that when the flow finishes, the user is taken to another VisualForce page. This Visualforce page is passed a parameter that has the value of a variable in the flow. This is how I'm currently trying to do it:

 

In the VF page:

<flow:interview name="Test_1" interview="{!myflow}" finishLocation="{!EndPage}"/>

 

In the controller for this page:

    public PageReference getEndPage() {
        PageReference pageRef = Page.EndOrder;
         String oid =myflow.vOrder;
         pageRef.getParameters().put('order', oid);   
            return pageRef;
    }

 

where vOrder is a variable set in the flow.

 

But when I try and load the VF page I get the following error:

System.FlowException: Interview not started

 

How can I get the variable value that I can pass as a parameter to the follow page?

 

Thanks

 

 

Hey all,

 

I'm trying to find out a way to determine which accounts records out of my 120K+ accounts have no child objects (contacts, cases, opps, etc).

 

I've tried using apex to determine this but I keep hitting governor limits.

 

Anyone got any suggestions?

Hey all,

 

I have a custom object that is the detail in a master-detail relationship with the Account object. When I create a new instance of the custom object I can select the account (via lookup) that the custom object is related to. But when I go to edit this custom object I am unable to change the master account to different one. I'm logging in as a system admin with view all and modify all permissions for both objects. The OWD for Account is private.

 

Am I missing something obvious here???

Hi

Please find me the solution for this problem. 

I have a object assigned_consultent__c. It contain fields name, projectname__c, startdate__c, Enddate__c.

For eg: name = xyz

project__c = abc

Startdate__c = 2/8/2011

Enddate__c = 20/8/2011

 

I have taken the days from the Enddate and StartDate.

And I have  a another object name Sheduling__c. It contain field name, project__c, day1__c, day2__c, ........ day31__c . 

Now I want to save the data from the assigned_consultent__c to Sheduling__c. According to the date. 

 

For eg: here date start from 2 and enddate is 20. 

According to date I want to save the date as

day1__c = false;

day2__c = true;

day3__c = true;

day4__c = true;

till 

day31__c = false;

 

It mean that day which is between the startdate__c and the enddate__c should be true and others should e false.

 

Please help me 

Thanks

Anuraj

  • September 06, 2011
  • Like
  • 0

Hey all,

 

JQuery novice here so apologies if this is a bit of a palm meet forehead question.

 

I'm trying to create a list of records (for a custom object) and use a JQuery dialog ot confirm which records the user has checked. I've got the Jquery dialog appearing, but it doesn't appear to pick up what checkboxes have been checked.

 

Where am I going wrong oh wise forum members?!

 

Page code:

<apex:page id="MyPage" showHeader="false" controller="testController">
<head><title>My Service Detail</title>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-1.6.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-ui-1.8.16.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
	<script type="text/javascript">
	$(document).ready(function() {
		//var j$ = jQuery.noConflict();
		var $dialog = $('<div></div>')
			.html('{!changes}')
			.dialog({
				autoOpen: false,
				modal: true,
				buttons: {
				"Confirm": function() {
					alert('test');
					$( this ).dialog( "close" );
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
				title: 'Basic Dialog'
			});

		$('#opener').click(function() {
			$dialog.dialog('open');
			// prevent the default action, e.g., following a link
			return false;
		});
	});
	</script>
	
</head>
<apex:form id="myForm">	
		Some header text blah blah blah<br/>
					<apex:pageBlock id="thePageBlock1" title="Available Addons">
						<apex:dataTable value="{!availableaddons}" var="a">
							<apex:column value="{!a.Add_On_Description__c}" width="200px">
								<apex:facet name="header">Addon</apex:facet>
							</apex:column>
							<apex:column value="{!a.Add_On_Cost__c}">
								<apex:facet name="header">Cost</apex:facet>
							</apex:column>
							<apex:column >
								<apex:facet name="header">Checkbox</apex:facet>
                        		<apex:inputCheckbox value="{!a.Dummy_Checkbox__c}"/>
                    		</apex:column>
						</apex:dataTable>	
						<button id="opener">Open the dialog</button>			 
					</apex:pageBlock>
	    	<apex:pageBlock >
		    		<apex:pageMessages />
       		</apex:pageBlock>
   </apex:form>
</apex:page>

Controller code:

 

public class testController {
		List <Subscriber_Add_On__c> SAL = new List <Subscriber_Add_On__c>();
	
		public testController(){
		}
		
		public List<Subscriber_Add_On__c> getAvailableAddOns(){
		return SAL = [Select Add_On_Cost__c,Add_On_Description__c,Dummy_Checkbox__c 
		from Subscriber_Add_On__c];
	}

	public String getChanges() {
    	String newaddons = 'The following addons will be added:';
        
        for (Subscriber_Add_On__c s : SAL) {
            if (s.Dummy_Checkbox__c)
                newaddons=newaddons+s.Add_On_Description__c+',';
        }
		return newaddons;	
	}       
}

 

Subscriber_Add_On__c is a custom object with three fields; description, code and the checkbox.

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

I'm setting up a new site where I don't want users to see any page other than the login page unless they have been authenticated.  I'm having a little trouble figuring out how to set this up though.

 

Ideally I would like the main site page be the 'Active Site Home Page' and when a user goes to any page in my site, if they are not authenticated than they will be sent to the login page.  If they are authenticated, than they can view the page.  Is this something that I have to manually put into code or is that handled for me by the Salesforce Portal authentication?  I set the 'Active Site Home Page' to the page I want logged in users to land on and removed this page from the Visualforce Page Access settings of the public user.  This is not working, however, as the user still lands on that home page.

 

Is there something I am missing about automatic page redirection to the login page if users are not authenticated?

 

Thanks!