• AVictorio
  • NEWBIE
  • 55 Points
  • Member since 2005

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

Hi,

 

This initial quesiton really dosn't have anything to do with Apex but if the answer is no then it will!

 

Is there a built in feature that allows the owner of contacts associated with an account to change with the owner of the acount?  I do not see that as an option in the change owner screen on accounts.  The issue is if a person leaves a department or company and the account is transfered to someone else then later they want to update the contacts associated with the account they can't because the previous employee owned the contacts!

 

So if there isn't a built in SFDC feature I am thinking of a VF page that has a look up field to all active users.  The admin selects a user then all that users contacts are pulled onto the list screen with checkbox's next to them.  The admin can select all or specific users then another pick list to select who will be the new owner is selected and finally a Transfer button to do the Apex work of changing the owner.

 

Now my apex / vf question(s).  At a higlevel I am thnking that I can have a top section with the two look up fields (FROM OWNER and TO OWNER) lets.  Next to the FROM OWNER I will have a button named Get Contacts and next to the TO OWNER I will have a button named Transfer..

 

Can I build a controller that I can use in a VF page as an extension and use the built in SFDC List capability that has the checkbox features?  If so can someone guide me a few examples hwo that is used.  I had one months ago but cannot seem to find it.

 

 

I'm a total newbie to Apex and have diligently searched and searched through out the forums for a solution to my problem. I've managed to set up several triggers on my own but I'm facing difficulty with this one.  Anyways, here's my trigger code:

 

 

trigger UpdateHotelAndRFP on Opportunity (before insert, before update) {
    	
	for (Opportunity o : Trigger.new) {
	
	List<Lead> leads = [Select Id From Lead WHERE ConvertedOpportunityId = :o.Id];
	List<RFP__c> rfp = [Select Id From RFP__c WHERE Lead__c IN :leads];
        List<RFPResponse__c> rfps = [Select Id, Hotel__c, Contact__c, 
        Response_Exceptions__c, Comp_Room_Policy__c, Hotel_Cancel_Policy__c, 
        AdditionalFees__c From RFPResponse__c Where RFP_ID__c IN :rfp And Status__c = 'Awarded'];
   	
   		if (rfps.Size() > 0) {
   			
   			if(o.Hotel_Account_Name__c == null){
   			o.Hotel_Account_Name__c = rfps[0].Hotel__c;
   			}
   			if(o.Hotel_Contact__c == null) {
   			o.Hotel_Contact__c = rfps[0].Contact__c;
   			}
   			if(o.RFP_Response__c == null){
   			o.RFP_Response__c = rfps[0].Id;
   			o.Response_Exceptions__c = rfps[0].Response_Exceptions__c;
   			o.Cancellation_Attrition_Policy__c = rfps[0].Comp_Room_Policy__c;
   			o.Hotel_Cancel_Policy__c = rfps[0].Hotel_Cancel_Policy__c;
   			o.Porterage_Fees_Additional_Fees__c = rfps[0].AdditionalFees__c;
   			}

   		}
  	}
}

 

Essentially a Lead has one child object, who also has a child object.

 

 

  • Lead
    • RFP__c
      • RFPResponse__c

 

When a Lead is converted I want to bring across the RFPResponse child object and perform a few updates to the Opportunity based on the contents of the RFPResponse object.

 

This trigger works perfectly, except that i cannot use it on bulk updates. I get the SOQL exception 21+ queries error message.  Any help?

 

Hello out there.  I think I've read every post and just about all documentation I could on the Ajax tool kit and Eclipse.  I'm not a programer by any means so please bear with me as I'm just looking for some guidance.

I'm trying to set up an S-Control that I can call using a custom link on the Lead object.

I need the S-Control to update custom field "Queue__c" with the string value "SupplierRelations". (simple right?)

Below is the code I'm using but I cannot for the life of me get it to work.  Can someone please tell me what I'm doing wrong?

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
<title></title> 
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js—browser=true" type="text/javascript"></script> 
<script id="clientEventHandlersJS" language="javascript"> 
<!-- 
function initPage() { 
sforceClient.registerInitCallback(setup); 
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0"); 
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true); 
} 

//Use this function as the entry point for your DHTML and JAVASCRIPT processing 
function setup() { 
var lead = new Sforce.Dynabean("Lead") 
lead.set("Queue__c","SupplierRelations"); 
lead.save(); 
} 

//--> 
</script> 
</head> 
<body onload="initPage()"> 
</body> 
</html>

We have an application where we process several orders in a batch. to process each order requires quite a bit of work and hence we have decided to have a batch size of 1 and process each order in a batch. That way the governor limits get reset for each order. now we are encountering a problem where suppose  an order has 1000 lines, we are hitting the script statement limit. It seems that to process these 1000 lines we can atmost have 200 scripts statements for each line before we run out of limits.

I find this restriction quite limiting. while i agree with the SOQL and memory limits, not being able to execute more script statements per batch seems very restrictive.

is there a way salesforce can increase the limits based on a fee. that way, our larger customers can pay an additional fee to process bigger orders.

so my question is if governor limits are fixed or can they be flexible based on a fee.

 

  • August 16, 2011
  • Like
  • 0

Hi,

 

This initial quesiton really dosn't have anything to do with Apex but if the answer is no then it will!

 

Is there a built in feature that allows the owner of contacts associated with an account to change with the owner of the acount?  I do not see that as an option in the change owner screen on accounts.  The issue is if a person leaves a department or company and the account is transfered to someone else then later they want to update the contacts associated with the account they can't because the previous employee owned the contacts!

 

So if there isn't a built in SFDC feature I am thinking of a VF page that has a look up field to all active users.  The admin selects a user then all that users contacts are pulled onto the list screen with checkbox's next to them.  The admin can select all or specific users then another pick list to select who will be the new owner is selected and finally a Transfer button to do the Apex work of changing the owner.

 

Now my apex / vf question(s).  At a higlevel I am thnking that I can have a top section with the two look up fields (FROM OWNER and TO OWNER) lets.  Next to the FROM OWNER I will have a button named Get Contacts and next to the TO OWNER I will have a button named Transfer..

 

Can I build a controller that I can use in a VF page as an extension and use the built in SFDC List capability that has the checkbox features?  If so can someone guide me a few examples hwo that is used.  I had one months ago but cannot seem to find it.

 

 

I'm a total newbie to Apex and have diligently searched and searched through out the forums for a solution to my problem. I've managed to set up several triggers on my own but I'm facing difficulty with this one.  Anyways, here's my trigger code:

 

 

trigger UpdateHotelAndRFP on Opportunity (before insert, before update) {
    	
	for (Opportunity o : Trigger.new) {
	
	List<Lead> leads = [Select Id From Lead WHERE ConvertedOpportunityId = :o.Id];
	List<RFP__c> rfp = [Select Id From RFP__c WHERE Lead__c IN :leads];
        List<RFPResponse__c> rfps = [Select Id, Hotel__c, Contact__c, 
        Response_Exceptions__c, Comp_Room_Policy__c, Hotel_Cancel_Policy__c, 
        AdditionalFees__c From RFPResponse__c Where RFP_ID__c IN :rfp And Status__c = 'Awarded'];
   	
   		if (rfps.Size() > 0) {
   			
   			if(o.Hotel_Account_Name__c == null){
   			o.Hotel_Account_Name__c = rfps[0].Hotel__c;
   			}
   			if(o.Hotel_Contact__c == null) {
   			o.Hotel_Contact__c = rfps[0].Contact__c;
   			}
   			if(o.RFP_Response__c == null){
   			o.RFP_Response__c = rfps[0].Id;
   			o.Response_Exceptions__c = rfps[0].Response_Exceptions__c;
   			o.Cancellation_Attrition_Policy__c = rfps[0].Comp_Room_Policy__c;
   			o.Hotel_Cancel_Policy__c = rfps[0].Hotel_Cancel_Policy__c;
   			o.Porterage_Fees_Additional_Fees__c = rfps[0].AdditionalFees__c;
   			}

   		}
  	}
}

 

Essentially a Lead has one child object, who also has a child object.

 

 

  • Lead
    • RFP__c
      • RFPResponse__c

 

When a Lead is converted I want to bring across the RFPResponse child object and perform a few updates to the Opportunity based on the contents of the RFPResponse object.

 

This trigger works perfectly, except that i cannot use it on bulk updates. I get the SOQL exception 21+ queries error message.  Any help?

 

Hi, I am pretty new to force.com. I am wondering how I could take an rss feed from an external site and display it using visual force. Is there any built in functionality for this. Or would I have to write an xml parser to populate salesforce objects, and then display using visualforce?

Regards,

jp

  • October 20, 2010
  • Like
  • 0

Hello,

 

I am trying to roll up a custom amount fields based on the parent/child relationship on the account.

 

For Example: 

 

 

  • There is a Parent Company record, and two Child company records.
  • Each Child Company has 100k in the field (Assets Under Advisement). I would like to sum the Child company Assets Under 
  • Advisement on the parent company. Hence the parent company Assets Under Advisement should be 200k.

 

 

Here is my  Trigger for the same (I need help on how can I complete this trigger without running on Apex Governor limit for too many SOQL Queries. Please note that my trigger is not complete.Of course :smileytongue::)

 

 

trigger RecalculateAssetsUnderAdvicement on Account (after update) {
	Double AssetsTotal =0.0;
	Account[] Originator = Trigger.new;
	Account [] UpdateAcc = new Account[]{};

for (Account Origin : Originator){
for (Account OuterLoop : [select id, Assets_Under_Advicement__c from Account where id =: Origin.ParentId]) {
		for (Account ChildRecords: [select id, Assets_Under_Advicement__c from Account where id =: Origin.ParentId]) {
					AssetsTotal = ChildRecords.Assets_Under_Advicement__c;
				}
				OuterLoop.Assets_Under_Advicement__c = AssetsTotal;
				UpdateAcc.add(OuterLoop);
			}
			update UpdateAcc;
	}
}

 

 

 

trigger RecalculateAssetsUnderAdvicement on Account (after update) {
Double AssetsTotal =0.0;
Account[] Originator = Trigger.new;
for (Account Origin : Originator){
if (Origin.ParentId != null) {
for (Account ChildRecords: [select id, Assets_Under_Advicement__c from Account where id =: Origin.ParentId]) {
AssetsTotal = ChildRecords.Assets_Under_Advicement__c;
}
}
update UpdateAcc;
}
}

I need to know how to roll-up a simple number field. We have multiple Regional Managers that I've been rolling up to a few State mangers.  I ran out of roll-up fields and want to know if you can do this with a formula or Apex trigger (I have no clue how to write code).  Any suggestions would be great.

 

Cheers

Will

 

  • March 24, 2010
  • Like
  • 0

Hi all,

 

The code Im working on here calls 'Lead' for the recipientType and 'LeadFloorPlanAssoc' as the relatedTo Object.  LeadFloorPlanAssoc is a custom object created to pull information from the Floor Plan custom object and the Lead Object.  Finally it displays a related list of Floor Plans in the Lead object.  We are trying to create an email template that lists available Floor Plans in an email sent to a Lead.  However, when I run the template nothing shows up in the list even though I should have the property name and price showing up for the available floor names.

 

I've tried a number of workarounds.  Changing relatedToType to Lead and trying to call floor plan straight from the Lead related list, which creates this error:

 Error: Invalid field Floor_Plan__r for SObject Lea

 

I've also tried changing the   value="{!relatedTo.Floor_Plan__r}" to a Floor_Plan_c which would seem to more closely fit the example in the Visualforce manual, but this creates the error:

 Error: Unknown property 'String.id'

 

Any help or ideas would be really appreciated.

 

Heres the code:

 

 

<messaging:emailTemplate recipientType="Lead"
relatedToType="LeadFloorPlanAssoc__c"
subject="Properties for: {!recipient.name}"

replyTo="support@acme.com">
<messaging:htmlEmailBody >
<html>
<body>
<p>Dear {!recipient.name},</p>
<p>Below is a list of Properties</p>
<table border="1" >
<tr>
<th>Property Name</th><th>Price</th><th>Community</th>

</tr>
<apex:repeat var="cx" value="{!relatedTo.Floor_Plan__r}">
<tr>
<td><a href =
"https://na7.salesforce.com/{!cx.id}">{!cx.Name}
</a></td>
<td>{!cx.Price__c}</td>
<td>{!cx.Property__c}</td>
</tr>
</apex:repeat>
</table>
<p/>

</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Hello out there.  I think I've read every post and just about all documentation I could on the Ajax tool kit and Eclipse.  I'm not a programer by any means so please bear with me as I'm just looking for some guidance.

I'm trying to set up an S-Control that I can call using a custom link on the Lead object.

I need the S-Control to update custom field "Queue__c" with the string value "SupplierRelations". (simple right?)

Below is the code I'm using but I cannot for the life of me get it to work.  Can someone please tell me what I'm doing wrong?

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
<title></title> 
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js—browser=true" type="text/javascript"></script> 
<script id="clientEventHandlersJS" language="javascript"> 
<!-- 
function initPage() { 
sforceClient.registerInitCallback(setup); 
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0"); 
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true); 
} 

//Use this function as the entry point for your DHTML and JAVASCRIPT processing 
function setup() { 
var lead = new Sforce.Dynabean("Lead") 
lead.set("Queue__c","SupplierRelations"); 
lead.save(); 
} 

//--> 
</script> 
</head> 
<body onload="initPage()"> 
</body> 
</html>