• mitu
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi,

I want create a out bound mesage using  Apex  & i successfully did it.I am posting the code down.

 

But here   I  am  hard-coding the add chidelement here.

 

Can some body let me know  is it possible to pass  the childelement Dynamically.Since  I am hardcording the field plz let.

 

HERE IS CODE

 

 public static void sendRequest()

{

 

 

String soapNS = 'http://schemas.xmlsoap.org/soap/envelope/';

String xsi = 'http://www.myservice.com/services/MyService/';

String endpntUrl = 'www.google.com';

String timeout = '10

 

// Account Fields

 

list<Account> lstAccounts = [Select id,Name from Account];

 

DOM.Document doc = new DOM.Document();

dom.XmlNode envelope = doc.createRootElement('Envelope', soapNS, 'soapenv');

envelope.setNamespace('xsi', xsi);

 

//Header

dom.XmlNode configData = envelope.addChildElement('_configData', soapNS, null);

dom.XmlNode endpointURL = configData.addChildElement('endpointURL', xsi, null).addTextNode(endpntUrl);

dom.XmlNode tout = configData.addChildElement('timeout', xsi, null).addTextNode(timeout);

 

 

//Body

dom.XmlNode body = envelope.addChildElement('Body', soapNS, null);

 

for(Account acc: lstAccounts){

 

dom.XmlNode accountList = body.addChildElement('accountList',xsi,null);

dom.XmlNode AccountName = accountList.addChildElement('Name', xsi, null).addTextNode(acc.Name);

dom.XmlNode Id = accountList.addChildElement('Id', xsi, null).addTextNode(acc.Id);

 

 

}

 

String req = doc.toXmlString();

system.debug('req----------------'+req);

}

 

Please Help me on this  :)

 

  • October 20, 2011
  • Like
  • 0

this is my trigger plz help with the test case

 

trigger Assert_Update on Opportunity (after update) {

if(trigger.isupdate)
{
for(Opportunity o1:trigger.new)
{
 opportunity o=[select id,Accountid,Name,Manager__r.name,Sales_Consultan__r.name,
                       Process_Consultant_User__r.name,Process_Consultant_Manager__r.name,
                       Branch__c,Payment_Option__c,Sales_Date__c,Process_Stage__c from opportunity where id=:o1.id];
                       
                       
                       
asset a= [select id,name,Accountid,Sales_Consultant__c,Sales_Consultant_Manager__c,Process_Consultant__c,
          Process_Consultant_Manager__c,Branch__c,Payment_Option__c,Expected_Sale_Date__c,Process_Stage__c,opportunity__c from asset where opportunity__c=:o1.id];
 a.name=o.name;
 a.Accountid=o.Accountid;
 a.Sales_Consultant__c=o.Sales_Consultan__r.name;
 a.Sales_Consultant_Manager__c=o.Manager__r.name;
 a.Process_Consultant__c=o.Process_Consultant_User__r.name;
 a.Process_Consultant_Manager__c=o.Process_Consultant_Manager__r.name;
 a.Branch__c=o.Branch__c;
 a.Payment_Option__c=o.Payment_Option__c;
 a.Expected_Sale_Date__c=o.Sales_Date__c;
 a.Process_Stage__c=o.Process_Stage__c;
 a.opportunity__c=o.id;
update a;
}
}
}

 

Hi,

I want create a out bound mesage using  Apex  & i successfully did it.I am posting the code down.

 

But here   I  am  hard-coding the add chidelement here.

 

Can some body let me know  is it possible to pass  the childelement Dynamically.Since  I am hardcording the field plz let.

 

HERE IS CODE

 

 public static void sendRequest()

{

 

 

String soapNS = 'http://schemas.xmlsoap.org/soap/envelope/';

String xsi = 'http://www.myservice.com/services/MyService/';

String endpntUrl = 'www.google.com';

String timeout = '10

 

// Account Fields

 

list<Account> lstAccounts = [Select id,Name from Account];

 

DOM.Document doc = new DOM.Document();

dom.XmlNode envelope = doc.createRootElement('Envelope', soapNS, 'soapenv');

envelope.setNamespace('xsi', xsi);

 

//Header

dom.XmlNode configData = envelope.addChildElement('_configData', soapNS, null);

dom.XmlNode endpointURL = configData.addChildElement('endpointURL', xsi, null).addTextNode(endpntUrl);

dom.XmlNode tout = configData.addChildElement('timeout', xsi, null).addTextNode(timeout);

 

 

//Body

dom.XmlNode body = envelope.addChildElement('Body', soapNS, null);

 

for(Account acc: lstAccounts){

 

dom.XmlNode accountList = body.addChildElement('accountList',xsi,null);

dom.XmlNode AccountName = accountList.addChildElement('Name', xsi, null).addTextNode(acc.Name);

dom.XmlNode Id = accountList.addChildElement('Id', xsi, null).addTextNode(acc.Id);

 

 

}

 

String req = doc.toXmlString();

system.debug('req----------------'+req);

}

 

Please Help me on this  :)

 

  • October 20, 2011
  • Like
  • 0

I'm using outbound messages to insert/update contact records on a local database. But I would also like to delete (or deactivate) these records when they are deleted through the salesforce web interface. Is it possible?

 

I see there's a IsDeleted field in Contacts, but the delete action doesn't trigger the workflow that sends an outbound message.