• JoAnnCulbertson
  • NEWBIE
  • 0 Points
  • Member since 2010

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

I'm not sure what I'm missing on this code.  Any suggestions? Thanks in advance for your assistance. 

 

I keep getting this error (Save error: Non-void method might not return a value or might have statement after a return statement. ) on the update opptysToUpdate; line the end of this method:

 

public with sharing class CurrentPumpASP {

	Date currentDate = date.today();
 	Integer currentYearDate = currentDate.year();
	String currentYear = String.valueof(currentYearDate);

 Opportunity writePumpASP(){
	
	List<Opportunity> opptysToUpdate = [SELECT o.id, o.name, o.ASP__c, o.Product_Product_Group__c,
			        o.Account.Primary_GPO__c
				FROM Opportunity o
				WHERE o.Type = 'MMS' 
				AND o.ASP__c = NULL];
				
	  for(Opportunity pumpOpptys : opptysToUpdate ){
					
				pumpOpptys.ASP__c = [SELECT Year__c, Pump_ASP__c, Primary_GPO__c, DTS_Pump_Type__c, CreatedDate 
						   	 			 FROM PumpASP__c 
							 			 WHERE Year__c = :currentYear 
							 			 AND DTS_Pump_Type__c = : pumpOpptys.Product_Product_Group__c
							 			 AND Primary_GPO__c = : pumpOpptys.Account.Primary_GPO__c].Pump_ASP__c;
				opptysToUpdate.add(pumpOpptys);
				}
				
		if(!opptysToUpdate.isEmpty()){		
		update opptysToUpdate;
		}
	 }
  }	

 

 Description Resource Path Location Type

When trying to display the account that is associated to the quote with this code:

 

<apex:outputField value="{!quote.Account}"/>

 

I keep getting a "ErrorError: Invalid field Account for SObject Quote" message when I try to save.  But - when I go to the list of fields for the Quote object, there is a field with the label Account Name and the field name of Account. 

 

What am I missing here.l..

 

Thanks for your help!

 

JoAnn

I need to set up a form that creates an account and allows the submitter to add multple contacts to the record as well.  Is this possible using the CMSForce2 webform interface?

 

Thanks for your help

 

JoAnn

Hi,

 

I am not able to understand how can i write the test class for the following trigger. The functionality of the trigger is described below.

 

 

 

trigger updatecurrentallocation on RMG_Employee_Allocation__c (after insert,after update)
{
List<RMG_Employee_Master__c> opps = new List<RMG_Employee_Master__c>();
RMG_Employee_Master__c oppty;
List<ID> masterIds = new List<ID>();
Map<ID, String> childDetailMap = new Map<ID, String>();
for(RMG_Employee_Allocation__c c: Trigger.new)
{
 masterIds.add(c.RMG_Employee_Code__c);
 childDetailMap.put(c.RMG_Employee_Code__c, (c.project__c+'-'+c.Manager_Name__c));
}
opps = [select id, Current_Allocation1__c from RMG_Employee_Master__c where id in :masterIds];
for(RMG_Employee_Master__c rem: opps)
{
  if(rem.Current_Allocation1__c != null)
  {
 String[] semiColonSplittedString = rem.Current_Allocation1__c.split(' ;');
 String[] splittedChildVal = childDetailMap.get(rem.id).split('-');
 Boolean flag = false;
 String tempString1 ='';
 String tempString2 = '';
 for(String s: semiColonSplittedString)
{
tempString1 = s;
tempString1 = tempString1.toLowerCase();
tempString2 = splittedChildVal[0].toLowercase();

if(tempString1.contains(tempString2))
{

system.debug('Current Allocation is   :::::::::   '+rem.Current_Allocation1__c);

system.debug('Map value is :::::::::::::::::::  '+childDetailMap.get(rem.id));
rem.Current_Allocation1__c = rem.Current_Allocation1__c.replace(s, childDetailMap.get(rem.id));

system.debug('Current Allocation after replacement   :::::::::   '+rem.Current_Allocation1__c);
flag = true;
system.debug('Flag is    '+flag);


 

}
}

if(!flag)
    rem.Current_Allocation1__c = rem.Current_Allocation1__c + ' ;'+ childDetailMap.get(rem.id);
  }
 else
   rem.Current_Allocation1__c = childDetailMap.get(rem.id);
}
if(opps.size() > 0)
      Update opps;
}

 

And the functionality of this trigger is as follows:

RMG_Employee_Master__c is a Master object and RMG_Employee_Allocation__c is a child object.

 

In the child object i have two custom field project__c , Manager_Name__c, In the Master object i have a custom field Current_Allocation1__c

 

Current_Allocation1__c i.e. a master object field that gets updated with the Custom object fields and are seperated by "-". Something like project__c1-Manager Name1;project__c2-Manager Name2 and so on...

 

: semicolon is used as an symbol to seperate between each detail records Manager Name and Project code...

 

 

 

  • January 23, 2011
  • Like
  • 0

I'm not sure what I'm missing on this code.  Any suggestions? Thanks in advance for your assistance. 

 

I keep getting this error (Save error: Non-void method might not return a value or might have statement after a return statement. ) on the update opptysToUpdate; line the end of this method:

 

public with sharing class CurrentPumpASP {

	Date currentDate = date.today();
 	Integer currentYearDate = currentDate.year();
	String currentYear = String.valueof(currentYearDate);

 Opportunity writePumpASP(){
	
	List<Opportunity> opptysToUpdate = [SELECT o.id, o.name, o.ASP__c, o.Product_Product_Group__c,
			        o.Account.Primary_GPO__c
				FROM Opportunity o
				WHERE o.Type = 'MMS' 
				AND o.ASP__c = NULL];
				
	  for(Opportunity pumpOpptys : opptysToUpdate ){
					
				pumpOpptys.ASP__c = [SELECT Year__c, Pump_ASP__c, Primary_GPO__c, DTS_Pump_Type__c, CreatedDate 
						   	 			 FROM PumpASP__c 
							 			 WHERE Year__c = :currentYear 
							 			 AND DTS_Pump_Type__c = : pumpOpptys.Product_Product_Group__c
							 			 AND Primary_GPO__c = : pumpOpptys.Account.Primary_GPO__c].Pump_ASP__c;
				opptysToUpdate.add(pumpOpptys);
				}
				
		if(!opptysToUpdate.isEmpty()){		
		update opptysToUpdate;
		}
	 }
  }	

 

 Description Resource Path Location Type