• Jack_Salesforce
  • 0 Points
  • Member since 2009

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 3

I have two salesforce orgs, how can I consume a web service from org A to org B? I looked through documents and forums, but did not find anything helpful. I even could not find how to pass user name and password from one org to another (I assume I need get the sessionID first before consuming the webservice).




Hi there,

my name is Jing, and I am living in Sydney Australia.I was working for salesforce Australia for a while as development support. I do have following skills and experiences:

1. salesforce troubleshooting,customization and admin
2. scontrol,trigger,apex and visualforce
3. javascripts and css
4. .Net web development

I've been working in software industry for 7 years,hold solid development,BA and consulting experiences. You can reach me by jinghaili@gmail.com

We're attempting a native force.com app that needs to call web services on another ORG.  (aka ORG to ORG web service call.)
I understand how to consume an ORG's web service using an S-Control, .NET, Java, PHP, Ajax-Toolkit. 
How do I consume a web service using APEX code? 
NOTE:  The ORG with the web service method stores standardized custom objects (DAAS) that will be used by other ORG's that we create.
Please advise if possible.  What are the best ways to login() and work with sessions using apex?
Hello Everyone,

I hope you can help me on this..Im working with singleEmail to send an email to a particular sales representative on every territory. but every time I invoked my trigger via update of my objects, it returns an exception. The error is: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.\.: Trigger.Notify_Rep_Trigger: line 90, column 21

my code is written below:

Account territory = [select Territory_Name__c from Account where Id =:data.Account_ID__c];
            if(territory.Territory_Name__c != null)
                List<string> splitID = territory.Territory_Name__c.split(';', -1);
                Set<string> tID = new Set<string>();
                List<Territory> territoryId = [Select id From Territory where name in :splitID];
                List<UserTerritory> usersId = [Select UserId From UserTerritory where territoryid in :territoryId];
                for(integer x=0; x < usersId.size(); x++)
                List<User> emailAdd = [select Id, email from User where Id in :tID];
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                List <String> Addresses = new List<String>();
                for(integer i=0; i < emailAdd.size(); i++)
                    //String[] toAddresses = new String[] {emailAdd[i].email};
                    String toTargetObjects = (string)emailAdd[i].Id;
                    system.debug('target object deb:'+toTargetObjects);
                    system.debug('data id deb:'+data.Id);
                    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

any suggestion? I would really appreciate it if you can help me on this.

Thanks in advance,


Message Edited by wilson34 on 11-21-2008 01:50 AM

Message Edited by wilson34 on 11-21-2008 01:51 AM

Message Edited by wilson34 on 11-21-2008 01:51 AM

Message Edited by wilson34 on 11-21-2008 01:53 AM

I know it's possible to send outbound email from an Apex Class using a template.  But what if the template has merge fields?  Will those merge fields be resolved correctly?  For example, lets say I have a custom object called XXX, and I create a trigger to call an Apex Class whenever a record of that custom object is created.  If the template has references to XXX merge fields, will these be resolved?