• GuyClairbois
  • 210 Points
  • Member since 2009

  • Chatter
  • 4
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 6
  • 128



I'm trying to create a trigger that fires when a formula field is updated.


My question is whether a formula field updating automatically (without the user entering the record and editing or saving) constitutes an UPDATE event that could fire a trigger?







I'm trying to use an apex trigger to update the value of a picklist field on a related object. The trigger will execute when a custom object is inserted and then retrive a list of all the Tasks associated with the custom object.


I then want to change the 'Status' field (which is a picklist field) on the tasks.


Does anyone have any sample code for changing picklist field values in Apex?


Thank you.

I'm having trouble returning back to the correct page using the retURL parameter.  Here's the function from a customer controller extension that is triggered from a button on a VF page.
 public pagereference createInstall(){
  Service__c tempService = new Service__c();
  tempService.Account__c = this.myAsset.AccountId;
  tempService.Contact_1__c = this.myAsset.ContactId;
  tempService.Description__c = 'INST SO '+this.myAsset.Sales_Order__c;
  tempService.Classification__c = 'New Installation';
  tempService.RecordTypeId = '01230000000DMrlAAG';
  tempService.Start_Date__c = this.myAsset.Target_Ship__c+14;
  tempService.SO__c = this.myAsset.Sales_Order__c;
  tempService.PO__c = this.myAsset.Purchase_Order__c;
  tempService.Quote__c = this.myAsset.Quote__c;
  tempService.Stage__c = 'Not Shipped';
  insert tempService;
  Link__c tempLink = new Link__c();
  tempLink.Asset__c = this.myAsset.Id;
  tempLink.Service__c = tempService.Id;
  insert tempLink;
  PageReference editService = new PageReference('/'+tempService.Id+'/e?retUrl=https://cs2.salesforce.com/'+this.myAsset.Id);
  return editService;

This 1st chunk creates a new Service Record (custom object).  The second chunk inserts a record linking the new service to an Asset.  The final 3 lines call up the service edit page so the user can review the new record.  After saving (or cancelling) I would like the user to be returned back to the asset detail page.
Passing the retURL should take the user back to the Asset detail page (which is where this code is triggered from).  This is the only part of the code that fails.  The service record gets created just fine, the link gets created just fine, the Service Edit screen opens just fine but when the user clicks 'Save' on that screen they are returned to the SF home page instead of the asset detail screen.
I have tried both methods of including the full server address (https://cs2.salesforce.com/recordId) and also the partial method (/recordId).  Both methods return the user to the home page.
Anyone know what I'm doing wrong?
  • August 01, 2008
  • Like
  • 0
hi all,
i got an error message saying : request failed with http status 407: proxy authentication required(ISA server requires authorization to fulfill the request. access to the web proxy filter is denied )
whenever i try to run apex explorer.
what changes should i make into tools-> options to make it run properly?
  • November 14, 2007
  • Like
  • 0

Hi all,

We built an interface to an external system using SOAP Callouts that trigger upon update on a certain object ('object1'). In order to successfully do the SOAP callout, we needed to put the callout in an @Future context, because callouts are only allowed from @Future classes.


This works fine, but....


We also have some processes in place that, whenever a certain other object ('object2') is updated, updates the matching object1. Since there can be a lot (thousands)  of matches, we also made this an @Future method. 


The problem, however, is that @Future methods cannot call @Future methods, so whenever object1 gets updated because of an update on object2, the export callout does not get triggered.


We've tried multiple solutions:

- using Outbound Messages instead. This is not an option since the object that gets exported also draws data from child objects when composing the SOAP message 

- I tried creating a static variable that checks whether an @Future method was already started, and proactively determines whether or not to run the callout as another @Future, but that doesn't help because the system tells me "Callout from triggers are currently not supported." (there is not @Future between the trigger on the object and the callout).


Any other suggestions? We'd want the interface to stay as 'online' as possible, so we will only try time-based workflow or batch apex if nothing else helps..


Many thanks!



For who's interested: we (not Salesforce.com!) created an improved version of the Excel Addin with the following improvements:


1. Enhanced login-screen: easier switching between environments (less typing)
2. Validation rules are applied by default (by using newer api version)
3. Fixed error on duplicate columns (required custom fields were downloaded twice)
4. Removed default query on 'systemModeDate > [last 7 days]' if no filter criteria were filled in
5. Increased standard batch size from 50 to 200, improving upload performance
6. Removed checks on maximum amount of lines
7. Improved dates handling (sometimes downloaded dates would not upload back into salesforce again)

(update 2012-12-04, 2 more fixes)

8. ability to upload numberic fields as null instead of always 0

9. corrected the bug to cope with error when uploading numbers with many decimals. These were put into scientific notation in Excel but not loaded properly to SF

(update 2013-05-03, 1 fix)

10. ability to query more than 32766 rows (was hitting the VBA limit on Integer size)


Our users are very happy with it. Feel free to try it out or further build on it and let me know what you think:



Disclaimer: Though we made and tested all enhancements with great care, we take no responsibility for the consequences of the use of this tool. Also note that this is an open source tool and not maintained nor supported by Salesforce.com.





We are using the new bulk API for uploading large volumes of data with .NET Webrequests.


In order to improve performance, Salesforce recommends compressing the files that are sent to the systen. Does anybody know how to use compression in the outgoing webrequest? We would love to see some example .NET code, or e.g. the source code of the new DataLoader (v9), even java code would do.


Many thanks,


Hi all,


I have a custom object Deal with Deal_Location child objects. I created a custom button 'Replace Deal Locations' as a List Button on Deal_Location and placed this button in the Deal screen, located with the Deal_Location related list.


I created a custom VisualForce page that opens when the button is clicked, displaying the selected Deal_Locations for further processing. 


However, I'd like to do a quick check when a user clicks the button, on whether any Deal_Locations were actually checked. This can be done e.g. with the following Javascript:


var records = {!GETRECORDIDS($ObjectType.Deal_Location__c )};

if (records[0] == null) {
alert("Please select at least one Deal Location.") }
else {


The problem is that when I open the VisualForce page with the window.parent.location.href command, I loose the reference to the Deal_Location controller, so my VisualForce page has no idea of what Deal_Locations to show.


How can I solve this?

An option would be to only do the check in VisualForce, but this is a huge performance killer as it will load all the VisualForce code for nothing, and will also need a page reload for the original Deal page.


Many thanks in advance,



Message Edited by GuyClairbois on 10-07-2009 02:32 AM

I am creating a VF page on a standard controller. I'd like to create a button on the page that opens the new Record input screen (similar to the one on any tab home page). However, I can't find the correct action syntax for my commandButton.


Is this feature actually available for VF?


Many thanks,


Hi all,


I was wondering if there is an easy way to retrieve a list of changed fields from an update-trigger.

I mean without going through each and every field and checking whether if changed or not. I need this for an e-mail notification of the changes done on a custom object. Otherwise, whenever I add, remove or change a field, the trigger has to be updated.


Many thanks,


Hello all,

I tried overriding a standard "New" action on a custom object and it works fine for internal users. However, that makes the "New" button vanish completely in communities. Here's what my component implements:
implements="lightning:actionOverride, forceCommunity:availableForAllPageTypes"
The use case for this is prepopulating some fields on the child record using information retrieved from Apex.

So main question is: are Lightning Component Action Overrides supported in Partner Communities? If so, what could I be doing wrong?

Before Summer 15, I used

 Account.IsPartner = true;

Sometime this approach ran into weird code exception. but It did work for most time.

Now in sandbox with Summer 15. the same code is broken.  it already runs into exception

System.SObjectException: Field is not writeable: Account.IsPartner 
Currently I am working on my DEV401 certification and as an excersise I tried making an IBAN validation rule. Since it actually works I thought I post it here. For some reason the rule editor didn't allow me to concatenate numbers so I had to convert them to text first and convert the result back to a number so I could MOD97 it. 
Suggestions for improvement of course are welcome.

<> 1

Hi Guys,
I am trying to rebuild the Excel formula "Rate" definition see below, did someone already rebuild it in Apex, or can provide me some hints.

The goal is, to get the interest rate, based on the loan duration, monthly rate, and Loan amount.

Thanks a lot.


Sunny regards




RATE(nper, pmt, pv, [fv], [type], [guess])
Nper  Required. The total number of payment periods in an annuity.
Pmt  Required. The payment made each period and cannot change over the life of the annuity. Typically, pmt includes principal and interest but no other fees or taxes. If pmt is omitted, you must include the fv argument.
Pv  Required. The present value — the total amount that a series of future payments is worth now.
Fv  Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type  Optional. The number 0 or 1 and indicates when payments are due.

  • July 09, 2013
  • Like
  • 0

I have a Pageblocktable which displays a set of values. Now each row in this table has a commandbutton whose action method will display another table below this pageblocktable.Now I want to highlight the row  whose commandbutton I clicked. Can somebody help me with this?

  • June 12, 2013
  • Like
  • 0

I am running in to an issue with generating apex code using a WSDL. The generated apex code does not seem to recognize the <xsd:extension> tage. Is this a known issue? 


Here is the WSDL snippet:


<xs:complexType name="Account">
<xs:extension base="snet:BaseObject">
          <xs:element minOccurs="0" name="Reference" type="snet:AccountReference"/>
          <xs:element minOccurs="0" name="AccountName" nillable="true" type="xs:string"/>
           <xs:element minOccurs="0" name="AccountNote" nillable="true" type="xs:string"/>
           <xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/>


However, the generated Apex code, does not seem to extend the BaseObject.


 public class Account {
        public uriSubscribenetIntrawareCom.AccountReference Reference;
        public String AccountName;
        public String AccountNote;
        public String Status;
        public Boolean AccountNoteToNull;
        private String[] Reference_type_info = new String[]{'Reference','uri:subscribenet.intraware.com','AccountReference','0','1','false'};
        private String[] AccountName_type_info = new String[]{'AccountName','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] AccountNote_type_info = new String[]{'AccountNote','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] Status_type_info = new String[]{'Status','http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'uri:subscribenet.intraware.com','true','false'};
        private String[] field_order_type_info = new String[]{'Reference','AccountName','AccountNote','Status'};


Any ideas on how to get around this issue? 

  • January 21, 2013
  • Like
  • 0

I've been trying to use the Excel Connector for the last two weeks to manage the data in our organisation, but I'm having a problem where I get the following error in Excel which is preventing me from using this tool:


Error Generated by request::An internal server error has occured while processing your request.

ExceptionCode : 5103

The first couple of times I tried to use Excel Connector it worked fine. However I then started seeing this error every time I tried to use it - the error appears after I put in my password in Excel Connector and click Login.


We are on Salesforce Professional. I have tried uninstalling and reinstalling the toolkit and connector, but it hasn't made a difference. I'm using Excel 2010 32-bit on Windows 7 64-bit.


I can log in to Salesforce in my browser on the same computer.


I've checked that IE is not in Offline Mode, and verified that Excel can actually connect to the internet (pinged a URL using VBA script).


I've tried disabling my antivirus (MSE) and windows firewall.


I've tried changing the server url as suggested by this thread (had to modify registry keys to do this as that field was not editable in the connector.


None of these resolutions worked.


Has anyone experienced and managed to resolve this, or can anyone suggest any other possible resolutions?

I'm having trouble saving from eclipse, and receive following error:


Save error: Unable to perform save on all files: Destination URL not reset. The URL returned from login must be set in the SforceSerice


The thing is, I do not continuesly get it, it get it some hours, in a row, and then I don't anymore. Without changing any sf login settings. Sometimes it passes by by restarting eclips, sometimes it doesn't.


I've got running projects on different sf organizations, and sometimes i can't save to one because of this error, but have no trouble saving to another. Trying to look up the error, i mostly came across problems with API webservice connection problems, and no mentions of IDE problems.


Does anyone know what the issue might be, and how to fix/avoid it ?

In my component I use actionfunction and rerender

<apex:component controller="MultiSelectBoxController">
	<apex:panelGrid columns="4">
		<apex:actionFunction name="moveDown" action="{!moveDown}" reRender="selectedRight"/> 
	    <apex:selectList id="selectedRight" required="false" value="{!selectedRight}" multiselect="true" size="20" style="width:250px">
	        <apex:selectOptions value="{!rightOptions}"/> 
	    <apex:panelGroup layout="block" style="text-align: center; padding:10px;">
	        <a href="javascript&colon;moveUp();" style="text-decoration:none">
	            <img src="/s.gif" alt="Move Up" class="upArrowIcon" title="Move Up"/>


By debuging I am sure that my action method is called correctly


public class MultiSelectBoxController {

	public PageReference moveDown() {
		// For each selected item right
		for(Integer r=0; r<selectedRight.size(); r++) {
			// Iterate over right list
			for(Integer pos=rightOptions.size()-2; pos >=0; pos--) {
				// When select item is found 
				if(rightOptions[pos].getValue() == selectedRight[r]) {
					// Save item above
					SelectOption tmp = rightOptions[pos+1];
					// Switch options with item above
					rightOptions[pos+1] = rightOptions[pos];
					rightOptions[pos] = tmp;
		return null; 

 Even in Firebug I can see the AJAX POST request coming from the rerender. But on the page nothing happens although the rightOptions have changed...


After an hour of trial and error I hand this over to someone whos smarter than me....



Hello ,


I tried to push some objects and its fields from sandbox to production. But, after uploading the objects and thier dependent fields, the data has been uploaded successfully and i got mail from salesforce that, Your change set was uploaded successfully


Then when i look in to the production in Inbound Change Sets  there are no Change sets available for the deployment.


And i have pushed the data from sandbox many times, and every time i am getting the same problem as mentioned above.


So please anyone can help me or if any one faced the same problem. please let me know the solution.


Thanks & Regards,




Can someone suggest if there is any helptext kind of thing available in the Visual Force.


This is regarding the help icon which, when hovered by a mouse gives a help text explanation


which is present in the Standard objects & Custom Objects for the standard fields in them.


Is there a way of achieving this through javascript?


Please give me pointers in this issue. TIA.

Getting some strange behaviour. I have a trigger that creates sharing rules when an object is created, so that customer portal users can see the object in their portal. Basically the object setup is "User" - "Contact" - "Membership Card". So anytime a membership card is created for a contact, a sharing rule is created so the user can see it via the portal.

This works fine if the new membership card is created by a standard user in SFDC.

However, the portal user has the abilty to create a membership card from a VisualForce page in the portal, and when they do the sharing rule trigger throws up the error: "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" on the line where i insert the sharing rule

However I thought that triggers run under the system account?


Any help is greatly appreciated

  • November 20, 2009
  • Like
  • 0

I'm trying to sign an XML document in one of my Apex classes.  Does Apex have any built in classes for signing XML documents?  Ie, like using the javax.xml.crypto.dsig.XMLSignature class or the Apache Santuario library?  I've looked at the Crypto.sign function, but I don't think it does what I need it to do (or if it does, please let me know!).


Thanks for any suggestions!



Hello, I have installed Excel connector and have not yet been able to import a report. I have chosen a variety of report types and report locations and get the same error message each time. Is there a setting I need to adjust? Thanks!


Error: Unable to retrieve the requested report. Please log in to Salesforce using a web browser to confirm the report's availability.
I am trying to create a Date of Birth field. Whether you are using a VF page or a regular page layout, when you use the calendar in Salesforce, it only lets you pick from years going forward. So the calendar is useless for something like a Date of Birth since obviously the year is before this year. Obviously the user can type the date, but is there any other way to adjust how the calendar behaves.
How do i resolve this...This is my code...I am sending an XML to an endpoint n number of times(its in a for loop)...Cant i do that?

public PageReference saveUsers() {
String[] listOfSelectedUsers = getUsers();
String domainId = System.currentPageReference().getParameters().get('ex');
for(String presentVar: listOfSelectedUsers)

Http h = new Http();
HttpRequest req = new HttpRequest();

TestExtranet__c extranet = [select Extranet_Name__c from TestExtranet__c where id = :domainId];
Lead lead = [select id,firstname,lastname,email from Lead where id = :presentVar];
String requestXML = buildXMLRequest('createUser',extranet.Extranet_Name__c,lead.id,lead.firstname,lead.lastname,lead.email);

HttpResponse res = h.send(req);
XmlStreamReader reader = res.getXmlStreamReader();
boolean errorExists = parseResponseForError(reader);
Extranet_User_Mapping__c mapping = new Extranet_User_Mapping__c();
mapping.Extranet_Id__c = domainId;
mapping.Leads__c = presentVar;
insert mapping;


PageReference userConfPage = new PageReference('/apex/userConfirmation?ex='+ System.currentPageReference().getParameters().get('ex'));
return Page.userConfirmation;

In a standard salesforce pages there is a way to filter/Sort the list based on staring Letter. This is precisely the requirement which was required to be built for custom visualforce page. I built a page and class which would do this functionality


click here to check the visualforce page and the controller to built the list

We are doing a massive upgrade of an org with a managed package. The package must be switched out with a new version (since managed packages can't be changed). Unfortunately we have about 200 custom fields on top of a managed package component. I can't seem to find the meta-data in the IDE. I know that there is a section for "Referenced Packages" which shows the schema of the packaged object only, no customizations. Also I can't see the customizations under src -> objects either. I would really like to copy and paste the XML and not recreate these 200 fields from scratch. Any ideas??

  • March 12, 2011
  • Like
  • 3