• SF Expert.ax1061
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 10

Hi, In MySQL we have limit on select for examle "SELECT * from Table where x=y order by z LIMIT 5,10"


It will return only 6,7,8,9 rows.


What is a equal sintax in appex trigger?

please help me ...how to learn apex coding......

I developed a Force.Com SIte that display an account in a form. I have a save button. But i receive this error when i try to save :



My VF :

<apex:page showheader="false" controller="DemoForceComSite">
    <apex:form id="ficherenseignementform">
        <apex:pageMessages />                     
        <apex:inputHidden value="{!accountId}"/>
        <apex:outputLabel value="Raison sociale " for="RaisonSociale"/>  
        <apex:inputText id="RaisonSociale"  value="{!oAccount.name}" styleClass="inputtext" />
             <apex:commandButton action="{!save}" value="Save"  />
             <apex:commandButton action="{!save2}" value="Save2"  />
             <apex:commandButton action="{!cancel}" value="cancel"  />

 My controller :

public class DemoForceComSite{

    public Account        oAccount {get;set;}  
    public String         accountId {get;set;} 
    public DemoForceComSite() {        
        accountId = '001P000000WlX5O';
        try {
            oAccount = [Select Id, Name From Account where Id= :accountId limit 1];
       } catch (Exception e) {
                // Display error message
            ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.ERROR, 'Impossible de retrouver les informations nécessaires à l\'affichage de la page. Veuillez prendre contact avec votre interlocuteur.'));

   public PageReference save() {      
        oAccount = [Select Id, Name From Account where Id= :accountId limit 1];
        oAccount.name = 'Test';
        upsert oAccount ;  
        return null;
   public PageReference save2() {    
        upsert oAccount;
        return null;
   public PageReference cancel() {
        return null;


Every method fails. Even the cancel method !! The rights are ok on the object.


It seems that the error not occurs when i withdraw all the account fields on the VF !! But i need them !!


Any idea ?


Everything seems to work fine until the controller DML Save function attempts to run from the Guest user. Here is a few relevant lines from the logs, the last line showing the insufficient privilages.


13:59:57.127 (127222000)|SYSTEM_METHOD_ENTRY|[15]|ApexPages.StandardController.save()
13:59:57.127 (127249000)|SYSTEM_MODE_ENTER|false
13:59:57.127 (127273000)|DML_BEGIN|[15]|Op:ControllerSave|Type:Partner_Position_Draft__c|Rows:1
13:59:57.155 (155907000)|VF_PAGE_MESSAGE|Insufficient Privileges

Things I think i have checked in the Site User profile


- Enabled Visibility for all fields

- Added the APEX extension class to the the Site User Profile

- Added the VisualForce page to the Site User Profile

- Have both Read and Edit privilages enabled for the Site User Profile


I don't have create privilages for the Site User for that profile but don't think that should be relevant.


I appriciate any hints provided as to the next thing I should be checking.

I am looking for someone to convert our existing website to Siteforce.

If anyone has the skills and time I will provide the specs for a quote.




There is no lookup relationship field on User object.


I have created one object and needed to link with the User object. But there is no lookup relationship option available on User object.


Why there is no lookup relationship available on User object? Any specific reason?



Devendra S

Hi All,


Can u explain Diff between Sandbox and Dev Environment


Thanks & Regards,


wat is the difference between " triggers and workflows"?


plz help me out... thanks in advance

  • September 06, 2011
  • Like
  • 0



Dont quite get test classes yet.... could someone help me write one for the following:


trigger UpdateCountOfScriptBuildsInProgress on Case (before update) {
     // service agreements are on the case record
     Set<Id> saIds=new Set<Id>();
     for (Case cs : trigger.new)

     List<Service_Agreement__c> sas=[select id, COUNT_of_Script_Builds_In_Progress__c, (select id from Cases__r where Reason = 'New Build'and Status = 'In Progress') 
     from Service_Agreement__c where id in :saIds];
     for(Service_Agreement__c sa : sas) {
      sa.COUNT_of_Script_Builds_In_Progress__c = sa.Cases__r.size();
  update sas;

 thanks in advance.




I am a new bie to write a trigger code. I seek some help.

There are four objects namely: Job, Job Task, Schdule Template and Schedule Template Item.

In first relationship Job is Child and ScheduleTemplate is Master where they have lookup relationship.(Job has lookup to Schedule Template)

In second relationship,

Schedule Template (Master) and  Schedule Template Item (Child) : Master-Detail Relationship

When a particular Job is created then i want to save Job Name(which belongs to job) and Schedule Template Item fields into the Job Task object.

Scedule Template can contain many schedule template items.

How i can write a trigger code to implement this functionality??

Devendra S