• Alaa
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 20
    Replies

Hi , I have a trigger on opportunities after update, in the trigger am trying to get the Account object as follow:

 

for (Opportunity o : Trigger.new) {
.

.

.
acc=o.Account;
.

.

.
}

 

but the acc object is always null while the oportunity am updating has parent acount, whats wrong?

  • March 03, 2013
  • Like
  • 0

Hi , am writing an apex trigger in which I need to validate the account name if already exist before insertion... so this trigger event will be "before insert" on "Account" object... my question is there is a way from the trigger to stop the insertion process and rase an error or warning to the user that this account name already exist?

 

  • November 28, 2011
  • Like
  • 0

I have some "System.debug" statement in my apex class.. where can I see the output of these statements after executing the class?

  • June 23, 2011
  • Like
  • 0

Hi , where can i find the documentation on how to write unit test for my apex classes and triggers?

  • June 07, 2011
  • Like
  • 0

Hi, am running a future method in a pex class , I call this method in trigger after opportunity update, here is the trigger:

 

Trigger test on Opportunity(after update) {
  OppDateTest.updateOppDate();
  }

 

and here is the class and the future method am calling:

global class OppDateTest{

@future(callout=true)
  public static void updateOppDate() {
 
  Http h = new Http();

// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint  
    String url='http://xxx.xxx.com/xxx/xxx.php';
    HttpRequest req = new HttpRequest();
    req.setEndpoint(url);
    req.setMethod('GET');

// Send the request, and return a response  
    
    HttpResponse res = h.send(req);
    String str=res.getBody();

  Opportunity[] opp = [SELECT id, name FROM Opportunity where name='test'];
    for (Opportunity o : opp) {
     o.description = str;
      update o;
      
      }

 

  }

 

}

 

 

 

but am getting this error whever the trigger fires:

 

 

Failed to invoke future method 'public static void updateOppDate()' on class 'OppDateTest' for job id '707M0000000E4PF'

caused by: System.DmlException: Update failed. First exception on row 0 with id 006M00000026BVNIA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, cloudswarm.opptySwarm: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a future method: cloudswarm.SwarmHelper.evaluateOpptyRules(LIST<Id>)

(cloudswarm): []

Class.OppDateTest.updateOppDate: line 22, column 7
External entry point
Any idead why is this and what does this error mean?
  • May 08, 2011
  • Like
  • 0

I have an apex code in which am using the HTTP class to call a PHP page in external server and getting the following error all the time: "Invalid HTTP method"


when I open the page in a web broswer it opens and I can see the output so why am geting this error in the apex class , any idea?

 

 

 

  • May 04, 2011
  • Like
  • 0

Hi, am writing a visualforce page and using the <apex:iframe> tag the src attribute .. I need to encode the URL am passing in the src ..how can I do so?

  • May 04, 2011
  • Like
  • 0

Hi Am trying to do soem HTTp callouts from an apex triger but when itest it fires I get the error:

contact your administrator Callout from triggers are currently not supported

 

whats this? any idea?

  • May 02, 2011
  • Like
  • 0

Hi, I created a visualforce page and mapped it to opportunity object ... in some scenario I want to update the value of one field in the opportunity object from this visualforce page so what apex tag should I use? Is there anyway to do so?

  • April 21, 2011
  • Like
  • 0

Hi , I have a trigger on opportunities after update, in the trigger am trying to get the Account object as follow:

 

for (Opportunity o : Trigger.new) {
.

.

.
acc=o.Account;
.

.

.
}

 

but the acc object is always null while the oportunity am updating has parent acount, whats wrong?

  • March 03, 2013
  • Like
  • 0

Hi , am writing an apex trigger in which I need to validate the account name if already exist before insertion... so this trigger event will be "before insert" on "Account" object... my question is there is a way from the trigger to stop the insertion process and rase an error or warning to the user that this account name already exist?

 

  • November 28, 2011
  • Like
  • 0

I have some "System.debug" statement in my apex class.. where can I see the output of these statements after executing the class?

  • June 23, 2011
  • Like
  • 0

Hi , where can i find the documentation on how to write unit test for my apex classes and triggers?

  • June 07, 2011
  • Like
  • 0

Hi, am running a future method in a pex class , I call this method in trigger after opportunity update, here is the trigger:

 

Trigger test on Opportunity(after update) {
  OppDateTest.updateOppDate();
  }

 

and here is the class and the future method am calling:

global class OppDateTest{

@future(callout=true)
  public static void updateOppDate() {
 
  Http h = new Http();

// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint  
    String url='http://xxx.xxx.com/xxx/xxx.php';
    HttpRequest req = new HttpRequest();
    req.setEndpoint(url);
    req.setMethod('GET');

// Send the request, and return a response  
    
    HttpResponse res = h.send(req);
    String str=res.getBody();

  Opportunity[] opp = [SELECT id, name FROM Opportunity where name='test'];
    for (Opportunity o : opp) {
     o.description = str;
      update o;
      
      }

 

  }

 

}

 

 

 

but am getting this error whever the trigger fires:

 

 

Failed to invoke future method 'public static void updateOppDate()' on class 'OppDateTest' for job id '707M0000000E4PF'

caused by: System.DmlException: Update failed. First exception on row 0 with id 006M00000026BVNIA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, cloudswarm.opptySwarm: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a future method: cloudswarm.SwarmHelper.evaluateOpptyRules(LIST<Id>)

(cloudswarm): []

Class.OppDateTest.updateOppDate: line 22, column 7
External entry point
Any idead why is this and what does this error mean?
  • May 08, 2011
  • Like
  • 0

I have an apex code in which am using the HTTP class to call a PHP page in external server and getting the following error all the time: "Invalid HTTP method"


when I open the page in a web broswer it opens and I can see the output so why am geting this error in the apex class , any idea?

 

 

 

  • May 04, 2011
  • Like
  • 0

Hi, am writing a visualforce page and using the <apex:iframe> tag the src attribute .. I need to encode the URL am passing in the src ..how can I do so?

  • May 04, 2011
  • Like
  • 0

Hi Am trying to do soem HTTp callouts from an apex triger but when itest it fires I get the error:

contact your administrator Callout from triggers are currently not supported

 

whats this? any idea?

  • May 02, 2011
  • Like
  • 0

Hi, I created a visualforce page and mapped it to opportunity object ... in some scenario I want to update the value of one field in the opportunity object from this visualforce page so what apex tag should I use? Is there anyway to do so?

  • April 21, 2011
  • Like
  • 0