• sunil316
  • NEWBIE
  • 50 Points
  • Member since 2009

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

I'm using this bit of code to allow a save button on a page to save a list, but I'd like the button to redirect the user to a different page after they click Save, much like the Cancel button does now.

 

 

public PageReference cancel() {
          PageReference pr = new PageReference('/a0G/o');
          pr.setRedirect(true);
          return pr;
          }
    public void save() {
    
        try{
            update pfc;
        }
        catch(DmlException ex){
            ApexPages.addMessages(ex);
            
        }
        }
           

 

 

The save method works, in that what is edited in the list saves, I would just like to add the same PageReference bit from the cancel method to the save method, and I don't know how to do that. :smileyindifferent:

 

Ideally both cancel and save buttons would direct the user back to the List View from where the visualforce page that uses this class is accessed, but simply redirecting back to the object URL is fine.

 

Any help would be greatly appreciated!

 

  • May 14, 2010
  • Like
  • 0

I have 4 filters 2 inputtext boxes and 2 picklists on a VF Page and a button.

 

Now my  report works when u pick or type in anyof the forms on the VF and then click Go...

 

My question is how do I write conditions if they pick 2 or more values from the VF page in apex to re-query..

 

I am using Dynamic SOQL and requery function...

 

This works for one filter... How do I make it for 2 or more filters????

 

if(course!='Select a Course'){
qryString = qryString + 'where ' + CourseName + '=' + '\''+ course+'\'';
}
if(teachername!=null){
qryString = qryString + 'where ' + teacher + '=' + '\''+ teachername+'\'';
}
if(studentname!=null){

qryString = qryString + 'where ' + student + '=' + '\''+ studentname+'\'';
}

 

 

 

Message Edited by MMA_FORCE on 03-03-2010 12:56 PM

Can we remove,

1) Popular Tag

2) Recent Activity

3) To Contributor

4) Top Content

sections from Library tab? Do we have any access setting for these section in salesforce?

I want only My Library section in Shared Content tab of Library to be displayed.

 

 

Thanks,

Sunil

Hi,

 

Here, I have an object, in which there are 2 lookup fields, Account and CustomObject__c. CustomObject__c is a filtered lookup and its value depends on the value of Account Lookup value.

 

I am using both Account and Filtered Lookup in VF page. Because of the CustomObject__c field, if I perform any AJAX call from the VF page irrespective of the rerender attribute, whole page gets rerendered and focus always goes back to first input field.

 

How can I eliminate rerendering of the whole page and focus change?

 

Thanks,

Sunil

Hello,
 
I am getting following error,
FATAL_ERROR|System.DmlException: Update failed. First exception on row 0 with id a00A0000005jZMDIA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,  reciprocalRelationship: execution of AfterUpdate

caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

My SOQL query is,

SELECT  ReciprocalType__c, ReciprocalId__c, Notes__c, End_Date__c FROM Realted_Obj__c WHERE isDeleted = false and ((Account2__c  != null and Account__c  != null) OR (Contact__c  != null and Contact_2__c  != null)) and ReciprocalId__c IN: setReciprocalId

setReciprocalId : this set doent contain any null value.

Also in this object Realted_Obj__c , more than 4,00,000 records are there.

Any suggestions?

Hi,

 

Here, I have an object, in which there are 2 lookup fields, Account and CustomObject__c. CustomObject__c is a filtered lookup and its value depends on the value of Account Lookup value.

 

I am using both Account and Filtered Lookup in VF page. Because of the CustomObject__c field, if I perform any AJAX call from the VF page irrespective of the rerender attribute, whole page gets rerendered and focus always goes back to first input field.

 

How can I eliminate rerendering of the whole page and focus change?

 

Thanks,

Sunil

I'm using this bit of code to allow a save button on a page to save a list, but I'd like the button to redirect the user to a different page after they click Save, much like the Cancel button does now.

 

 

public PageReference cancel() {
          PageReference pr = new PageReference('/a0G/o');
          pr.setRedirect(true);
          return pr;
          }
    public void save() {
    
        try{
            update pfc;
        }
        catch(DmlException ex){
            ApexPages.addMessages(ex);
            
        }
        }
           

 

 

The save method works, in that what is edited in the list saves, I would just like to add the same PageReference bit from the cancel method to the save method, and I don't know how to do that. :smileyindifferent:

 

Ideally both cancel and save buttons would direct the user back to the List View from where the visualforce page that uses this class is accessed, but simply redirecting back to the object URL is fine.

 

Any help would be greatly appreciated!

 

  • May 14, 2010
  • Like
  • 0

Hai everyone,

 

 

 

 

 

I have a command button used in one visualforce page.Can I navigate to another visualforce page onclicking that command button.Please help...........

 

 

 

 

Ok this is a strange two-part question/issue.

 

We have analytic snapshots that run once/week based on a report.  There are two issues we've just noticed with these.

 

1. For some reason, a couple of the date fields that are pulled from the report are storing an incorrect date.  The snapshot is due to run on a user in the PST timezone but the create and last modified dates from the report are storing an incorrect date in some cases.  If it's a record owned by a user in a different timezone, the snapshot is storing their date, not the person the context of the report is run as.

 

2. But more importantly, we have an apex controller class that pulls from the snapshot table a list of the snapshot dates.  These dates are showing up in each users local time zone settings when we need it to be consistent for all users.  So if the snapshot is run on 04-17-2010, then when we present the list of snapshots to all users they should see 04-17-2010.  not 04-18-2010 in some cases.


Here is the code that we're using to find the snapshot dates.  The goal is to create a selectlist for a VisualForce page to let the user choose which snapshot they want to run some analytics against.

 

 

	public List<SelectOption> getSnapShotDates() {
        List<SelectOption> optionList = new List<SelectOption>();
		Set <DateTime> snapdates = new Set <DateTime>();

// go get the most recent snapshot
		Analytics_Pipeline_Snapshots__c[] aps = 
			([SELECT Pipeline_Date__c 
			FROM Analytics_Pipeline_Snapshots__c 
			ORDER BY Pipeline_Date__c DESC LIMIT 1]);
// loop thru and create other snapshot dates one week before each one (up to 2 maximum)
		if (aps.size() > 0) {
			for (Integer i=0; i < 2; i++) {
				Datetime tempdate = datetime.newInstance(aps[0].pipeline_date__c.addDays(7 * -i).year(), 
														aps[0].pipeline_date__c.addDays(7 * -i).month(),
														aps[0].pipeline_date__c.addDays(7 * -i).day());
	            optionList.add(
	            	new SelectOption(String.valueof(tempdate.format('yyyy-MM-dd')),
	            					String.valueof(tempdate.format('yyyy-MM-dd'))));
			}
		}

        return optionList;
	}

 

 

 

 

 

 

 

I have a lookup relationship  for a custom object with account. I am displaying the fields of object within a pageblocktable using the soql query.

In the Pageblocktable the lookup field is displayed with the id of account instaed of Name. How can i display the account name for this in page block table.

 

SoQL:

 

select id, field1__C, filed2__c, lookup__c from object__c

 

Thanks

Hey, I have a trigger on the allocation that is trying to loop through the associated opportunities. Here is the code:

 

List<Opportunity> donations; for(Payment_Detail__c pd :Trigger.new){ donations.add(pd.Donation__c); system.debug(pd.Donation__c); for(Opportunity o : donations){ // do action here

} }

 

Incompatible element type Id for Opportunity, although it is the field that holds the ID of the Opportunity (Donation)

 

I am trying to run the following 2 simple relationship queries in Eclipse and can not get them to take. I getand error saying it didn't understand the relationship be sure to append the __r. Can anyone assist?

 

Example Child to parent:

Select TIMEHDR__r.name,  Id, Name,  Date__c,  Project__c, Project_Task__c, Hours__c

 

From TIMEDET__c

 

 

Example Parent to child

 

select id, name, Time_Card_Period__c,

(Select id, Name, Project__c, Project_Task__c, Date__c, Hours__c From TIMEDET__r )

 

from TIMEHDR__c

 

Hi, I have successfully installed eclipse but cannot install force ide.  When I start the installation process it seems to work fine then a box appears listing the following errors:

 

An error occurred while collecting items to be installed
  No repository found containing: org.eclipse.emf.common/osgi.bundle/2.4.0.v200808251517
  No repository found containing: org.eclipse.emf.ecore/osgi.bundle/2.4.1.v200808251517
  No repository found containing: org.eclipse.emf.ecore.change/osgi.bundle/2.4.0.v200808251517
  No repository found containing: org.eclipse.emf.ecore.edit/osgi.bundle/2.4.1.v200808251517
  No repository found containing: org.eclipse.emf.ecore.xmi/osgi.bundle/2.4.1.v200808251517
  No repository found containing: org.eclipse.emf.edit/osgi.bundle/2.4.1.v200808251517
  No repository found containing: org.eclipse.wst.common.emf/osgi.bundle/1.1.202.v200809111955
  No repository found containing: org.eclipse.wst.common.emfworkbench.integration/osgi.bundle/1.1.201.v200808071700
  No repository found containing: org.eclipse.wst.common.frameworks/osgi.bundle/1.1.200.v200805140020
  No repository found containing: org.eclipse.wst.common.modulecore/osgi.bundle/1.1.203.v200809110700
  No repository found containing: org.eclipse.wst.common.project.facet.core/osgi.bundle/1.3.3.v200809102124
  No repository found containing: org.eclipse.wst.common.ui/osgi.bundle/1.1.301.v200805140415
  No repository found containing: org.eclipse.wst.html.core/osgi.bundle/1.1.202.v200808281704
  No repository found containing: org.eclipse.wst.html.ui/osgi.bundle/1.0.301.v200809120137
  No repository found containing: org.eclipse.wst.sse.core/osgi.bundle/1.1.302.v200808260045
  No repository found containing: org.eclipse.wst.sse.ui/osgi.bundle/1.1.2.v200809120159
  No repository found containing: org.eclipse.wst.validation/osgi.bundle/1.2.2.v200809050219
  No repository found containing: org.eclipse.wst.xml.core/osgi.bundle/1.1.305.v200809120354
  No repository found containing: org.eclipse.wst.xml.ui/osgi.bundle/1.0.410.v200809120143

 

 

 

I've tried the workaround solution (i think) but adding a url but not sure if I have done this properly.  Any help would be appreciated.

 

Thank you

 

Aiyaz

  • March 09, 2010
  • Like
  • 0
Hi sorry if this is in the wrong place but i am struggling to create a trigger that will automaticially add the date entered in Actual_Completion_Date__c on the Opportunity object to one (Actual_Completion_Date__c) in the plot object. I have created a look up field in the plot object called Opportunity_Link as i was unable to fill the date field using formulas and different field types.
  • March 05, 2010
  • Like
  • 0
Does anyone know of a way, either through url query parameters or some other mechanism, to display the Salesforce Content Detail screen by itself?  Basically I want to take away the sidebar and header and just have the detail screen for an individual content item.  The goal of this would be to display the item in an iframe on a Visualforce page.  Thanks for any insight.  I have the page working but want to hide the unnecessary parts and show only the detail.
  • March 03, 2010
  • Like
  • 0

Hi:

   I have an inputText Field in VF:

 

<td><apex:inputText value="{!teachername}"/></td>

 Then in my Apex Code I have:

 

if(teachername!=null){
qryString = qryString + 'where ' + teacher + '=' + '\''+ teachername+'\'';
}

 


 

 

Now the issue is if I do not place anything in that textbox and click on another filter and then click go button...

It gives me an error on my where statement bring up the teacher where statement...

 

It is null, I left it blan/empty/nothing in there...

 Should I place something else instead of a null???

Thanks

 

 

I have 4 filters 2 inputtext boxes and 2 picklists on a VF Page and a button.

 

Now my  report works when u pick or type in anyof the forms on the VF and then click Go...

 

My question is how do I write conditions if they pick 2 or more values from the VF page in apex to re-query..

 

I am using Dynamic SOQL and requery function...

 

This works for one filter... How do I make it for 2 or more filters????

 

if(course!='Select a Course'){
qryString = qryString + 'where ' + CourseName + '=' + '\''+ course+'\'';
}
if(teachername!=null){
qryString = qryString + 'where ' + teacher + '=' + '\''+ teachername+'\'';
}
if(studentname!=null){

qryString = qryString + 'where ' + student + '=' + '\''+ studentname+'\'';
}

 

 

 

Message Edited by MMA_FORCE on 03-03-2010 12:56 PM

I am very new to APEX, triggers and classes and trying to create a trigger that will create a new quote record when a new opportunity has been created. (I would like the quote name to be "Quote-"+the opportunity name.)
 
I'm sure this is a very basic code but I am having a hard time getting my bearings straight.
 
Would someone be willing to share how this code would be written.
 
thanks in advance
 
Ben 

Hi members.. i have a question about developing apex code in salesforce. i am a fresher completed my masters in management. i trained in salesforcce as admin and developer. but i am worrying about developing apex code for a real time project.could you please tell me what percent of code is written by developers as own and what percent of code will be available from the sources like forums, google, importing the existindg code...... etc.

 

waiting for the responses from all

 

THANKS IN ADVANCE

HARRY

I'm creating a simple trigger to update a few fields of the related account object when an opportunity is updated. I've tried a few variations but none validate correctly. Here's the current version of the trigger. Thanks in advance for the lesson.

 

 

trigger AccountBecameClient on Opportunity (after update) { Opportunity myOpportunity = trigger.new[0]; Account myAccount = myOpportunity.AccountId; if (myOpportunity.StageName == 'Closed Won' && myAccount.First_Became_Client__c == Null) { myAccount.First_Became_Client__c = date.today(); myAccount.Next_Annual_Review__c = date.today() + 365; date thisDate = date.today(); date quarterlyReview = thisDate.addMonths(3); myAccount.Next_Quarterly_Review__c = quarterlyReview; } }

 

 

 

  • February 20, 2010
  • Like
  • 0

This works fine as a single trigger.  I'm new to writing bulk triggers. 

 

How do I go about bulk-ifying this trigger?

 

Ben

 

 

temp_studentid = sa[0].StudentID_SIS__c;
if (temp_studentid <> null) {
temp_recordtype = 'onsite - coaching';
try {
RelatedStudentId = [select
id, Extreme_Student_ID__c
from Student__c where Extreme_Student_ID__c = :temp_studentid].id;
} catch (system.Exception e4){
}

}

//----------------------------------------------------------------
// Set fields for Updating
//----------------------------------------------------------------

sa[0].Related_School_Account__c = RelatedSchoolid;
sa[0].Related_District_Account__c = RelatedDistrictid;
sa[0].Related_Student__c = RelatedStudentid;
sa[0].Record_Type__c = temp_recordtype;

 

 

 

  • February 19, 2010
  • Like
  • 0