• Collaborative e
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 24
    Replies

Built a controller and an visualforce page. Trying to gather records from an object and then use <apex:repeat> to display them on the page. Here's the controller code:

 

public class MyCustomRentalExtension {
	
	//The standard controller on which this extension is based
	Custom_Rental__c rental;
	
	//Properties of this class
	public String booth {get;set;}
	List<Custom_Rental__c> allSizes = new List<Custom_Rental__c>();
	
	//Constructor
	public MyCustomRentalExtension() {
		//set the default size
		booth = '10x10';
		
		//on page load, get the size param from the URL 
		String sizeParam = ApexPages.currentPage().getParameters().get('booth');
		if (sizeParam != ''){
			for (Custom_Rental__c cr : allSizes){
				if(cr.Booth__c == sizeParam){
					booth = cr.Booth__c;
				}
			}
		}
	}
	
	
	//List records for a specific booth size
	public List<Custom_Rental__c> getBooths() {
		return [Select p.id, p.File_Name__c, p.Preview_Link__c from Custom_Rental__c p where p.Booth__c = :booth Order By p.File_Name__c];
	}
}

Here is the VF Page:

<apex:page showHeader="false" id="body" standardStylesheets="false" controller="MyCustomRentalExtension" cache="true" expires="600">
<head>
<title>{!booth} Customer Rental Extension Site</title></head>

<h2> {!booth} Custom Rental Portfolio</h2><br/>
<p>To learn more about our {!booth} custom rental solutions click on one of the booth photographs below.</p><br/>

<apex:form id="form">
	<apex:outputPanel id="list">
		<apex:repeat value="{!Booths}" var="booth" id="boothList">
			<div style="float: left; padding:0; margin:0px 15px 15px 0px;">
				<h4 align="center">{!booth.File_Name__c}</h4>
				<div style="border: 2px solid #e2e2e2; margin:0; padding:2px;">
					<a href="Page1?id={booth.id}">
						<img src="{!booth.Preview_Link__c}" width="250" height="200" alt="{!booth.Name}" />
						</a>
						</div>
					</div>
				</apex:repeat>
			</apex:outputPanel>
		</apex:form>

</apex:page>

 

 I am getting an error on the VF page saying "Unknown Property 'String.File_Name__c'

I am attempting to add default text to a long text area field that is broken up into sections (paragraphs). I've tried using the BR() function but it doesn't render as a break in a a default value function. Any ideas?

I have a visualforce page that does a rerender on a a PageBlock when a field is updated. When that code executes any field that contains default text loses it's default text. How can I rerender the block but keep my default text?

 

 

<apex:page standardController="Proposal_Initiation_Form__c" >
  <apex:sectionHeader title="Edit Creative Proposal Initiation Form" subtitle="{!Proposal_Initiation_Form__c.name}"/>
  <apex:form >
      <apex:pageBlock title="Edit Creative PIF" id="thePageBlock" mode="edit">
          <apex:pageMessages />
          <apex:pageBlockButtons >
              <apex:commandButton value="Save" action="{!save}"/>
              <apex:commandButton value="Cancel" action="{!cancel}"/>
          </apex:pageBlockButtons>
          <apex:actionRegion >
              <apex:pageBlockSection title="General Information" columns="1">
                  <apex:inputField value="{!Proposal_Initiation_Form__c.name}" required="true"/>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Account__c}" required="true"/>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Opportunity__c}"/>
                  
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Is_there_an_RFP__c}"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Request__c}"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Proposal_Budget__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Presentation_Budget__c}" required="true"/>
                  	
                  	<apex:pageBlockSectionItem >
                      <apex:outputLabel value="Customer Type"/>
                      <apex:outputPanel >
                          <apex:inputField value="{!Proposal_Initiation_Form__c.Customer_Type__c}" required="true">
                              <apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
                          </apex:inputField>
                          <apex:actionStatus startText="   applying value . . ." id="status"/>
                      </apex:outputPanel>
                  </apex:pageBlockSectionItem>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Business_Lead__c}"/>
                  	
                  </apex:pageBlockSection>
                  </apex:actionRegion>
                  <apex:pageBlockSection title="Show Management Customer Information" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Show Management'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Events__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Portfolio_Value__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Customer Information (Single Show)" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Corporate'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Event_s__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Event_Date_s__c}" required="true"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Show_City_ies__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Producing_Branch_es__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Facility_ies__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Opportunity_Value__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Attendees__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Exhibitors__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Association Customer Information" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Association'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Events__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Portfolio_Value__c}"/>
                  </apex:pageBlockSection>

                  <apex:pageBlockSection title="Scope of Work Information" columns="1">
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Scope_of_Work_for_this_Proposal__c}" style="width:90%" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Strategic_Value__c}" style="width:90%"/> 
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Deliverables__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Capabilities_Included_in_Response__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Proposal Due Dates" columns="2">
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Submission_of_intent_to_bid__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Questions_Due_to_Customer__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Discovery_meeting_with_customer__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Walk_through_Site_Visit__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Physical_Proposal_Delivery__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Proposal_Submission_Type__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Stand_up_Presentation_Date__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Customer_Decision_Date__c}" required="true"/>               
                  </apex:pageBlockSection>
                 
              </apex:pageBlock>    
  </apex:form>
</apex:page>

 

 

I am trying to add a script to adjust CSS depending on which version of IE the site visitor is using. My code for this script is in the <head> tag:

 

   <!--[if IE 7]>
        <apex:stylesheet value="{!URLFOR($Resource.styles3, 'styles.ie7.css')}"/>
    <![endif]-->
    <!--[if IE 6]>
        <apex:stylesheet value="{!URLFOR($Resource.styles3, 'styles.ie6.css')}"/>
        <apex:includeScript value="{!$Resource.supersleight}"/>
        <apex:includeScript value="{!URLFOR($Resource.styles3, 'supersleight_internal.js')}"/>
    <![endif]-->

 It isn't working. When I view code in the browser window I get the folling where the script should be:

 

<!--**********
*********************************************************************************
*************-->
    <!--**********
*********************************************************************************
***************************************************************
**********************************************************************************************
*************-->

 What am I doing wrong?

 

 

Thanks for the help.

 

I built a trigger that we now use in production that runs nightly and iterates through all opportunities looking for where one of our partners is listed as either the account or the opportunity partner. Where it finds one of the two options it adds everything with that partner's role (we are using partner portal) to the sales team for that opportunity.

 

I am wanting to add a statement to the code that, after the partner users are added to the sales team, updates the Date_Partner_Added__c field (date field) with today's date.

 

For the life of me I've tried several different ways and it's not working. Here's the code as it sits today. Any help is appreciated.

 

 

global class UniplanBatchOpportunityPartners implements Database.Batchable<SObject>{
	global String query;
	global String email;
	global Id toUserId;
	global Id fromUserId;
	
	global database.querylocator start(Database.BatchableContext BC){
		system.debug('@@@BC=' + BC);
		system.debug('@@@query=' + query);
		
		return	Database.getQueryLocator(query);
	}
	
	global void execute(Database.BatchableContext BC, Sobject[] scope){
		//PURPOSE: TO ITERATE THRU ALL THE OPPORTUNTIES WITH THE Uniplan GmbH & Co KG ACCOUNT PARTNER
		// AND UPSERT ALL THE ACCOUNT SALES TEAM MEMBERS INTO THE OPPORTUNITY SALES TEAM MEMBER LIST
		
		List<Opportunity> oList             = new List<Opportunity>();
		List<Account> aList                 = new List<Account>();
		List<User> uList                    = new List<User>();
		List<OpportunityShare> oShareList   = new List<OpportunityShare>();
		List<OpportunityTeamMember> oTMList = new List<OpportunityTeamMember>();		
		List<OpportunityTeamMember> opTMList = new List<OpportunityTeamMember>();		
		List<AccountTeamMember> aTMList     = new List<AccountTeamMember>();
		Set<Id> oIdSet                      = new Set<Id>();
		Set<Id> accSet                      = new Set<Id>();
		Set<Id> uIdSet                      = new Set<Id>();
		Set<Id> aPIdSet                     = new Set<Id>();
		Set<Id> aTMUserIdSet                = new Set<Id>();
		Set<Id> oTMUserIdSet                = new Set<Id>();
		Set<Id> aIdSet                      = new Set<Id>();
		Set<Id> oShareIdSet                 = new Set<Id>();
		Set<Id> opAccIdSet                  = new Set<Id>();
		Set<Id> inactiveOOwnerIdSet         = new Set<Id>();
		Map<Id,Account> aMap                = new Map<Id,Account>();
		Map<Id,List<User>> accMap           = new Map<Id,List<User>>();
		Map<Id,Set<Id>> aTMIdMap            = new Map<Id,Set<Id>>();  //<Account Id, Current Set of User Ids>
		Map<Id,OpportunityShare> oShareMap  = new Map<Id,OpportunityShare>();
		Map<Id,List<AccountTeamMember>> aTMMap  = new Map<Id,List<AccountTeamMember>>();
		Map<Id,Set<Id>> aTMUserIdMap            = new Map<Id,Set<Id>>();
		Map<Id,Set<Id>> opOIdOpIdSetMap     = new Map<Id,Set<Id>>();
		Map<Id,Set<Id>> oTMIdSetMap         = new Map<Id,Set<Id>>();
		Id oId;
		Id aId = '0014000000GvtqD';
		String idStr;
		
		//THESE ARE THE ACCOUNTS THAT ARE TO BE USED IN THE BATCH
		accSet.add('0014000000GvtqD');
		accSet.add('00130000008w1qI'); 
		accSet.add('0014000000MnJPv'); 
		accSet.add('0014000000MnJAu');
		accSet.add('0014000000MnJB5'); 
		accSet.add('0014000000MnJVI'); 
		accSet.add('0014000000KGcAk'); 
		accSet.add('0014000000MnJRz'); 
		accSet.add('0014000000MnJ0e');		
		
		//BUILD THE accMap WHICH HOLDS THE LIST OF USERS FOR EACH ACCOUNT in the accSET
		for (Id accId : accSet) accMap.put (accId,new List<User>());
		
		UserRole ur = [Select u.Name, u.Id 
			From UserRole u
			where name = 'Uniplan GmbH & Co KG Partner User'
			limit 1];
			
		uList = [Select u.UserRole.Name, u.UserRoleId, u.Id, u.isActive, u.UserRole.PortalAccountId  
			From User u 
			where userRole.name = 'Uniplan GmbH & Co KG Partner User' 
			and isActive=true
			limit 1000];

		//BUILD A SET OF ACTIVE Uniplan GmbH & Co KG Partner User USERS
		for (User u : uList) uIdSet.add(u.id);
			
		//BUILD A LIST OF ACCOUNTS WITH VALID ACCOUNT TEAM MEMBERS	
		aList = [Select a.Name, a.Id, 
			(Select Id, AccountId, UserId, TeamMemberRole, AccountAccessLevel, IsDeleted 
				From AccountTeamMembers
				WHERE UserId in :uIdSet
				and isDeleted = false) 
			From Account a 
			where id in :accSet];

		//BUILD A MAP OF ACCOUNTS WITH VALID ACCOUNT TEAM MEMBERS
		Boolean aTMFlag = false;

		for (Account a : aList) {
			aTMList = a.AccountTeamMembers;
			if (aTMList.size()>0) aTMFlag = true;
			aTMMap.put(a.id, a.AccountTeamMembers);			

			aTMUserIdSet = new Set<Id>();
			for (AccountTeamMember atm :aTMList) aTMUserIdSet.add(atm.UserId);
			aTMUserIdMap.put(a.id,aTMUserIdSet);
		}

			
		system.debug('@@@uList=' + uList);						
		system.debug('@@@aTMUserIdMap=' + aTMUserIdMap);		
		system.debug('@@@scope.size=' + scope.size());
		system.debug('@@@scope=' + scope);
		
		//CHECK IF THERE EXISTS ACCOUNT TEAM MEMBERS
		if (atmFlag==true) {
			Integer ct = 0;
			oIdSet = new Set<Id>();
			olist = new List<Opportunity>();
			
			//INITIALIZE SETS AND LISTS
			Id  curOpId = null;
			oTMUserIdSet = new Set<Id>();	
			oShareIdSet  = new Set<Id>();	
			oTMList      = new List<OpportunityTeamMember>();
			oShareList   = new List<OpportunityShare>();
			inactiveOOwnerIdSet = new Set<Id>();
			
			//LOOP THRU ALL THE OPPORTUNITY PARTNERS	
			for(sobject s : scope){
				OpportunityPartner op = (OpportunityPartner)s;
				oIdSet.add(op.opportunityId);
				//system.debug('@@@op=' + op);
			}
			
			oList = [Select o.Id, o.Owner.IsActive, o.OwnerId, o.IsDeleted, o.Date_Uniplan_Partner_Added__c,  
				(Select OpportunityId, UserId From OpportunityTeamMembers) 
				From Opportunity o 
				where id in :oIdSet];
				
				
			for (Opportunity oo : oList) {
				Set<Id> tmpOTMSet = new Set<Id>();
				
				if (oo.Owner.IsActive == false || oo.isDeleted == true) inactiveOOwnerIdSet.add(oo.id);
				
				for (OpportunityTeamMember oOTM : oo.OpportunityTeamMembers) 
					tmpOTMSet.add(oOTM.UserId);
				oTMIdSetMap.put(oo.Id, tmpOTMSet);
			}
				
			system.debug('@@@oTMIdSetMap=' + oTMIdSetMap);
			
			for(sobject s : scope){

				OpportunityPartner op = (OpportunityPartner)s;

				//system.debug('@@@op.opportunityId=' + op.opportunityId);
				//system.debug('@@@inactiveOOwnerIdSet=' + inactiveOOwnerIdSet);
				
				if (inactiveOOwnerIdSet.contains(op.opportunityId) == false) {
					//CHECK IF NEW OPPORTUNITY ID
					if (curOpId != op.opportunityId) {
						//FIRST CREATE OTM AND SHARE RECORDS FOR EACH USER IN THE oTMUserIdSet					
						//LOOP THRU ALL THE oTMUserIdSet SET OF USER IDS FOR THE AccountToId 
						for (Id oTMId : oTMUserIdSet) { 
							
							if (oTMIdSetMap.get(op.opportunityId).contains(oTMId) == false) {
							//ADD A NEW OTM RECORD TO THE LIST
							//ADD A NEW SHARE RECORD TO THE LIST
								oTMList.add(new OpportunityTeamMember(UserId = oTMId, OpportunityId=op.opportunityId,
									TeamMemberRole='Uniplan'));
		
								oShareList.add(new OpportunityShare(UserOrGroupId = oTMId, OpportunityId=op.opportunityId,
									OpportunityAccessLevel='Edit'));
								
								if (oTMList.size()==1000) {
									insert oTMList;	
									oTMList = new List<OpportunityTeamMember>();
								} 
		
								if (oShareList.size()==1000) {
									insert oShareList;	
									oShareList = new List<OpportunityShare>();
								} 
									
									
							}			
						}
						system.debug('@@@oTMList=' + oTMList);
						system.debug('@@@op.AccountToId=' + op.AccountToId + ' :aTMUserIdMap.get(op.AccountToId)=' + aTMUserIdMap.get(op.AccountToId));
																	
						//RESET THE curOpId AND oTMUserIdSet FOR NEXT OPPORTUNITY ID					
						curOpId = op.opportunityId;	
						oTMUserIdSet = new Set<Id>();				
					}
				
					//ADD ALL THE ACCOUNT TEAM MEMBERS FROM THE OPPORTUNITY PARTNER'S AccountToId ID
					//TO THE SET OF OPPORTUNITY A
					for (Id opId : aTMUserIdMap.get(op.AccountToId)) oTMUserIdSet.add(opId);
					
					
				}
			}
			
			system.debug('@@@oTMList=' + oTMList);
			system.debug('@@@oShareList=' + oShareList);
			
			//INSERT THE Opportunity Team Member List
			//INSERT THE OPPORTUNITY SHARE MEMBER TABLE WITH
			//EDIT ACCESS. NEW OPPORTUNITY SHARE MEMBER RECORDS
			//WERE CREATED ON OPPORTUNITY TEAM MEMBER RECORDS CREATED
			
			if (oTMList.size()>0)insert oTMList;			
			if (oShareList.size()>0) insert oShareList;

		}		
	}
	
	global void finish(Database.BatchableContext BC){
		Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
		mail.setToAddresses(new String[] {email});
		mail.setSubject('Batch Process Complete-Uniplan Account Sales Teams Added to Opportunities');
		mail.setReplyTo(email);
		mail.setSenderDisplayName('Batch Processing');
		mail.setPlainTextBody('Batch Process has completed');
		Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
	}


}

 

 

I'm looking for a way to update an opportunity custom field when someone is added to the opportunity sales team. Can that be done through workflow?

Newer developer here looking for some guidance. I developed the following trigger that queries information on opportunities tied to a campaign and populates opportunity amount data from the opportunities up to the campaign:

trigger rollupBranchAVtoCampaign on Opportunity (after delete, after insert, after undelete,
after update) {
double sumTotalRollUpBranchAVOpportunities = 0.0;
double sumTotalBookedRollupBranchAVOpportunities = 0.0;

Campaign [] revenueToUpdate = new Campaign[]{};


//***********************************************
//Code for updating existing records and new records
//***********************************************

if(Trigger.isInsert)
{
Opportunity [] opNew = trigger.new;

for(Opportunity op : opNew)
{
for (Campaign totalRevenue : [select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Campaign where Id = :op.CampaignId])
{

//Sum all the Branch AV opportunities
for (Opportunity opptyRevenue: [select Id, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Opportunity where CampaignId = :totalRevenue.id])
{
//gather all formula currency fields for record types from opportunities tied to event campaign
sumTotalRollUpBranchAVOpportunities += opptyRevenue.Roll_Up_Open_AV_Branch__c;
sumTotalBookedRollupBranchAVOpportunities += opptyRevenue.Roll_up_Booked_AV_Branch__c;
}
//set campaign fields to variables from above
totalRevenue.Roll_up_Booked_AV_Branch__c = sumTotalRollUpBranchAVOpportunities;
totalRevenue.Roll_Up_Open_AV_Branch__c = sumTotalBookedRollupBranchAVOpportunities;
//add opportunity to list to be updated outside of the loop
revenueToUpdate.add(totalRevenue);
}
}

//commit the changes to Salesforce
update revenueToUpdate;
}


//***********************************************
//Code for updating when a record is updated
//***********************************************

else if(Trigger.isUpdate)
{
//sum total both old and new
Opportunity [] oldOppty = Trigger.old;
Opportunity [] newOppty = Trigger.new;
Double newSumBranchAV = 0.0;
Double oldSumBranchAV = 0.0;
Double OldSumBranchAVBooked = 0.0;


for(Opportunity oldOp : oldOppty)
{

Campaign oldTotalBranchAVValue = [Select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Campaign where Id = :oldOp.CampaignId];

Opportunity [] oldSumBranchAVRevenues = [Select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Opportunity where CampaignId = :oldTotalBranchAVValue.Id];


//sum premiums from child objects
for(Opportunity oldSumBranchAVRevenue : oldSumBranchAVRevenues)
{
oldSumBranchAV += oldSumBranchAVRevenue.Roll_Up_Open_AV_Branch__c;
oldSumBranchAVBooked += oldSumBranchAVRevenue.Roll_up_Booked_AV_Branch__c;
}

oldTotalBranchAVValue.Roll_Up_Open_AV_Branch__c = oldSumBranchAV;
oldTotalBranchAVValue.Roll_up_Booked_AV_Branch__c = oldSumBranchAVBooked;

revenueToUpdate.add(oldTotalBranchAVValue);
}

update revenueToUpdate;
}

//***********************************************
//Code for updating when a record is deleted
//***********************************************

else if(Trigger.isDelete)
{

Opportunity [] opptyOld = trigger.old;

for(Opportunity op: opptyOld)
{

for (Campaign totalRevenue: [select Id, Name, Roll_Up_Open_AV_Branch__c,Roll_up_Booked_AV_Branch__c from Campaign where Id = :op.CampaignId])
{
for (Opportunity opptyRevenue: [select Id, Roll_Up_Open_AV_Branch__c,Roll_up_Booked_AV_Branch__c from Opportunity where CampaignId = :totalRevenue.id])
{
sumTotalRollUpBranchAVOpportunities += opptyRevenue.Roll_Up_Open_AV_Branch__c;
sumTotalBookedRollupBranchAVOpportunities += opptyRevenue.Roll_up_Booked_AV_Branch__c;
}

totalRevenue.Roll_Up_Open_AV_Branch__c = sumTotalRollUpBranchAVOpportunities;
totalRevenue.Roll_up_Booked_AV_Branch__c = sumTotalBookedRollupBranchAVOpportunities;

revenueToUpdate.add(totalRevenue);
}
}

update revenueToUpdate;
}
}

 When I run the code in sandbox it works fine, performing just want I want it to peform.

 

When I then tried to do a data loader to enact the trigger on multiple opportunities I got the following error:

 

Apex script unhandled trigger exception by user/organization: 00540000000sPw1/00DS0000000FLsO
Source organization: 00D300000000O4F (null)
rollupBranchAVtoCampaign: execution of AfterUpdate

caused by: System.QueryException: List has no rows for assignment to SObject

Trigger.rollupBranchAVtoCampaign: line 59, column 26

 

 Any thoughts on what I might be doing that's causing the trigger exception?

Message Edited by Collaborative e on 11-13-2009 07:13 PM

I want to create a roll-up summary field on the campaign object that totals opportunity values that meet certain criteria (date range of close date & Record Type).

 

I am at a loss. Any ideas? 

Looking for some ideas and any sample code.

 

I have a field that determines which division of our business owns an opportunity. I want that picklist to auto-update based on the role of the opportunity owner. (example: if the owner role starts with "NE -" change the division picklist to "Northeast".

 

Anyone done something similar? 

Is there a way to create multiple communities (all internal) and only show certain internal communities to certain users based on profile?

I'm trying to create a VF page that loads on login (similar to task reminders) and remains until a user has read the page and accepted the terms. Then I want to report on the results (who has accepted, who has not).

 

Anyone done VF or custom splash pages

I need to pass the Account Owner's phone number to a custom field on the account object. Is there a simple way or code clip?
I have 5 custom lookup fields on a campaign:
- Customer (1)
- Customer (2)
- Customer (3)
- Customer (4)
- Customer (5)

All are lookup fields to Account

Only Customer 1 is filling in on the Account Related List. How can I put the other 4 on there?
Is there a way to create multiple custom fields on a campaign (customer 1, 2, 3, etc) and have each of them post to a campaign related list on an account?
Need to build a workflow rule to trigger when opportunities owned by certain users (all a part of the same role) meet a certain criteria (close date is within 3 days of today).

I have all figured out execpt for how to tell the system to look for these users.

Any/all help appreciated.
Is there any way possible to "clone" entire report folders or am I left to create each report individually?

Built a controller and an visualforce page. Trying to gather records from an object and then use <apex:repeat> to display them on the page. Here's the controller code:

 

public class MyCustomRentalExtension {
	
	//The standard controller on which this extension is based
	Custom_Rental__c rental;
	
	//Properties of this class
	public String booth {get;set;}
	List<Custom_Rental__c> allSizes = new List<Custom_Rental__c>();
	
	//Constructor
	public MyCustomRentalExtension() {
		//set the default size
		booth = '10x10';
		
		//on page load, get the size param from the URL 
		String sizeParam = ApexPages.currentPage().getParameters().get('booth');
		if (sizeParam != ''){
			for (Custom_Rental__c cr : allSizes){
				if(cr.Booth__c == sizeParam){
					booth = cr.Booth__c;
				}
			}
		}
	}
	
	
	//List records for a specific booth size
	public List<Custom_Rental__c> getBooths() {
		return [Select p.id, p.File_Name__c, p.Preview_Link__c from Custom_Rental__c p where p.Booth__c = :booth Order By p.File_Name__c];
	}
}

Here is the VF Page:

<apex:page showHeader="false" id="body" standardStylesheets="false" controller="MyCustomRentalExtension" cache="true" expires="600">
<head>
<title>{!booth} Customer Rental Extension Site</title></head>

<h2> {!booth} Custom Rental Portfolio</h2><br/>
<p>To learn more about our {!booth} custom rental solutions click on one of the booth photographs below.</p><br/>

<apex:form id="form">
	<apex:outputPanel id="list">
		<apex:repeat value="{!Booths}" var="booth" id="boothList">
			<div style="float: left; padding:0; margin:0px 15px 15px 0px;">
				<h4 align="center">{!booth.File_Name__c}</h4>
				<div style="border: 2px solid #e2e2e2; margin:0; padding:2px;">
					<a href="Page1?id={booth.id}">
						<img src="{!booth.Preview_Link__c}" width="250" height="200" alt="{!booth.Name}" />
						</a>
						</div>
					</div>
				</apex:repeat>
			</apex:outputPanel>
		</apex:form>

</apex:page>

 

 I am getting an error on the VF page saying "Unknown Property 'String.File_Name__c'

I am attempting to add default text to a long text area field that is broken up into sections (paragraphs). I've tried using the BR() function but it doesn't render as a break in a a default value function. Any ideas?

I have a visualforce page that does a rerender on a a PageBlock when a field is updated. When that code executes any field that contains default text loses it's default text. How can I rerender the block but keep my default text?

 

 

<apex:page standardController="Proposal_Initiation_Form__c" >
  <apex:sectionHeader title="Edit Creative Proposal Initiation Form" subtitle="{!Proposal_Initiation_Form__c.name}"/>
  <apex:form >
      <apex:pageBlock title="Edit Creative PIF" id="thePageBlock" mode="edit">
          <apex:pageMessages />
          <apex:pageBlockButtons >
              <apex:commandButton value="Save" action="{!save}"/>
              <apex:commandButton value="Cancel" action="{!cancel}"/>
          </apex:pageBlockButtons>
          <apex:actionRegion >
              <apex:pageBlockSection title="General Information" columns="1">
                  <apex:inputField value="{!Proposal_Initiation_Form__c.name}" required="true"/>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Account__c}" required="true"/>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Opportunity__c}"/>
                  
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Is_there_an_RFP__c}"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Request__c}"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Proposal_Budget__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Presentation_Budget__c}" required="true"/>
                  	
                  	<apex:pageBlockSectionItem >
                      <apex:outputLabel value="Customer Type"/>
                      <apex:outputPanel >
                          <apex:inputField value="{!Proposal_Initiation_Form__c.Customer_Type__c}" required="true">
                              <apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
                          </apex:inputField>
                          <apex:actionStatus startText="   applying value . . ." id="status"/>
                      </apex:outputPanel>
                  </apex:pageBlockSectionItem>
                  <apex:inputField value="{!Proposal_Initiation_Form__c.Business_Lead__c}"/>
                  	
                  </apex:pageBlockSection>
                  </apex:actionRegion>
                  <apex:pageBlockSection title="Show Management Customer Information" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Show Management'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Events__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Portfolio_Value__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Customer Information (Single Show)" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Corporate'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Event_s__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Event_Date_s__c}" required="true"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Show_City_ies__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Producing_Branch_es__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Facility_ies__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Opportunity_Value__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Attendees__c}"/>
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Exhibitors__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Association Customer Information" columns="2" rendered="{!Proposal_Initiation_Form__c.Customer_Type__c == 'Association'}">
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Number_of_Events__c}" />
                      <apex:inputField value="{!Proposal_Initiation_Form__c.Portfolio_Value__c}"/>
                  </apex:pageBlockSection>

                  <apex:pageBlockSection title="Scope of Work Information" columns="1">
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Scope_of_Work_for_this_Proposal__c}" style="width:90%" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Strategic_Value__c}" style="width:90%"/> 
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Deliverables__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Capabilities_Included_in_Response__c}"/>
                  </apex:pageBlockSection>
                  
                  <apex:pageBlockSection title="Proposal Due Dates" columns="2">
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Submission_of_intent_to_bid__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Questions_Due_to_Customer__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Discovery_meeting_with_customer__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Walk_through_Site_Visit__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Physical_Proposal_Delivery__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Proposal_Submission_Type__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Stand_up_Presentation_Date__c}" required="true"/>
                  	<apex:inputField value="{!Proposal_Initiation_Form__c.Customer_Decision_Date__c}" required="true"/>               
                  </apex:pageBlockSection>
                 
              </apex:pageBlock>    
  </apex:form>
</apex:page>

 

 

I'm looking for a way to update an opportunity custom field when someone is added to the opportunity sales team. Can that be done through workflow?

Newer developer here looking for some guidance. I developed the following trigger that queries information on opportunities tied to a campaign and populates opportunity amount data from the opportunities up to the campaign:

trigger rollupBranchAVtoCampaign on Opportunity (after delete, after insert, after undelete,
after update) {
double sumTotalRollUpBranchAVOpportunities = 0.0;
double sumTotalBookedRollupBranchAVOpportunities = 0.0;

Campaign [] revenueToUpdate = new Campaign[]{};


//***********************************************
//Code for updating existing records and new records
//***********************************************

if(Trigger.isInsert)
{
Opportunity [] opNew = trigger.new;

for(Opportunity op : opNew)
{
for (Campaign totalRevenue : [select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Campaign where Id = :op.CampaignId])
{

//Sum all the Branch AV opportunities
for (Opportunity opptyRevenue: [select Id, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Opportunity where CampaignId = :totalRevenue.id])
{
//gather all formula currency fields for record types from opportunities tied to event campaign
sumTotalRollUpBranchAVOpportunities += opptyRevenue.Roll_Up_Open_AV_Branch__c;
sumTotalBookedRollupBranchAVOpportunities += opptyRevenue.Roll_up_Booked_AV_Branch__c;
}
//set campaign fields to variables from above
totalRevenue.Roll_up_Booked_AV_Branch__c = sumTotalRollUpBranchAVOpportunities;
totalRevenue.Roll_Up_Open_AV_Branch__c = sumTotalBookedRollupBranchAVOpportunities;
//add opportunity to list to be updated outside of the loop
revenueToUpdate.add(totalRevenue);
}
}

//commit the changes to Salesforce
update revenueToUpdate;
}


//***********************************************
//Code for updating when a record is updated
//***********************************************

else if(Trigger.isUpdate)
{
//sum total both old and new
Opportunity [] oldOppty = Trigger.old;
Opportunity [] newOppty = Trigger.new;
Double newSumBranchAV = 0.0;
Double oldSumBranchAV = 0.0;
Double OldSumBranchAVBooked = 0.0;


for(Opportunity oldOp : oldOppty)
{

Campaign oldTotalBranchAVValue = [Select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Campaign where Id = :oldOp.CampaignId];

Opportunity [] oldSumBranchAVRevenues = [Select Id, Name, Roll_up_Booked_AV_Branch__c,Roll_Up_Open_AV_Branch__c from Opportunity where CampaignId = :oldTotalBranchAVValue.Id];


//sum premiums from child objects
for(Opportunity oldSumBranchAVRevenue : oldSumBranchAVRevenues)
{
oldSumBranchAV += oldSumBranchAVRevenue.Roll_Up_Open_AV_Branch__c;
oldSumBranchAVBooked += oldSumBranchAVRevenue.Roll_up_Booked_AV_Branch__c;
}

oldTotalBranchAVValue.Roll_Up_Open_AV_Branch__c = oldSumBranchAV;
oldTotalBranchAVValue.Roll_up_Booked_AV_Branch__c = oldSumBranchAVBooked;

revenueToUpdate.add(oldTotalBranchAVValue);
}

update revenueToUpdate;
}

//***********************************************
//Code for updating when a record is deleted
//***********************************************

else if(Trigger.isDelete)
{

Opportunity [] opptyOld = trigger.old;

for(Opportunity op: opptyOld)
{

for (Campaign totalRevenue: [select Id, Name, Roll_Up_Open_AV_Branch__c,Roll_up_Booked_AV_Branch__c from Campaign where Id = :op.CampaignId])
{
for (Opportunity opptyRevenue: [select Id, Roll_Up_Open_AV_Branch__c,Roll_up_Booked_AV_Branch__c from Opportunity where CampaignId = :totalRevenue.id])
{
sumTotalRollUpBranchAVOpportunities += opptyRevenue.Roll_Up_Open_AV_Branch__c;
sumTotalBookedRollupBranchAVOpportunities += opptyRevenue.Roll_up_Booked_AV_Branch__c;
}

totalRevenue.Roll_Up_Open_AV_Branch__c = sumTotalRollUpBranchAVOpportunities;
totalRevenue.Roll_up_Booked_AV_Branch__c = sumTotalBookedRollupBranchAVOpportunities;

revenueToUpdate.add(totalRevenue);
}
}

update revenueToUpdate;
}
}

 When I run the code in sandbox it works fine, performing just want I want it to peform.

 

When I then tried to do a data loader to enact the trigger on multiple opportunities I got the following error:

 

Apex script unhandled trigger exception by user/organization: 00540000000sPw1/00DS0000000FLsO
Source organization: 00D300000000O4F (null)
rollupBranchAVtoCampaign: execution of AfterUpdate

caused by: System.QueryException: List has no rows for assignment to SObject

Trigger.rollupBranchAVtoCampaign: line 59, column 26

 

 Any thoughts on what I might be doing that's causing the trigger exception?

Message Edited by Collaborative e on 11-13-2009 07:13 PM

So I am new at the developer Sites. I m looking to get some help with a request that came across my desk. I am looking to write a s-control or an Apex trigger that will lookup the Owners information to pull in the Owners Email on the account records. I know this can be done simple, Just not sure how to start out. Which is easier to an S-control or a Apex trigger. I am not a developer by far. I need to know how to start them out and how to reference the owners users record within the account. Then what Tag I can use to bring that information to update a new field.

 

Can someone please help the new guy out?

 

Thanks

Travis Wright

I'm trying to create a VF page that loads on login (similar to task reminders) and remains until a user has read the page and accepted the terms. Then I want to report on the results (who has accepted, who has not).

 

Anyone done VF or custom splash pages

Hi guys,

This is the first trigger i am trying. I wanted to create a workflow or something by which i could populate a custom field in Account with some profile info from a field from the User Info page. It seems there is no way to get the user info for the person who created the record using workflow and triggers are the only choice.

So i have been reading up on it and trying to come up with a solution. I will post my attempts here, hopefully you guys can help me so that i can archive my goal and also learn about triggers.

trigger updateProfile on Account (after update)
{
      Account.Profile__c = User.Division;
}

Here i am trying to get the Division name for the user and input it into the custom field called Profile in the Account object. This is not working for me, can someone tell me what i am doing wrong?

Thanks!