• sabsi
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi everybody,

I'm a newbie...

I need to post  Opportunity fields to an Https URL after updating one of this field. I've tried with a simple http but that doesn't work

I created a trigger (after Update)

Is it possible with a trigger to do this?

code:

global class RequestClass {
     @Future(callout=true)
   
     Public static void myMethod(string xml)
     {
         Http http= new Http();
        HttpRequest req=new HttpRequest();
        req.setEndpoint('http://test.salesforce.com');
        req.setMethod('POST');
        //Second, invoke web service call
        HttpResponse res=http.send(req);
        //Last, handling the response
        req.setBody(xml);
        //string deb=string.valueOf(res.getBody());
        string deb=res.getBody();
        string username='';
        string passwd='';
        blob headerValue=Blob.valueOf(username+':'+passwd);
        string autHeader='Basic'+Encodingutil.base64Encode(headerValue);
        req.setHeader('Authorization',autHeader);
        system.debug(res);
        system.debug(xml);
        //system.debug(req);
        system.debug(deb+'**********************deb*************************');   
     }
 
}

Trigger

trigger SentToAsw on Opportunity (after update) {
    for (Opportunity opp: Trigger.new){
        if (opp.StageName == 'Closed Won')
        {
                
        string xml='<oppOwner>'+opp.OwnerId+'<oppOwner>'+'<oppName>'+opp.Name+'<oppName>'

+'<oppAccountName>'+opp.AccountId+'<oppAccountName>'+'<oppType>'+opp.Type+'<oppType>'

+'<oppCloseDate>'+opp.CloseDate+'<oppCloseDate>'+'<oppStage>'+opp.StageName+'<oppStage>'

+'<oppApproved>'+opp.Approved__c+'<oppApproved>'+'<oppExpectedRevenue>'+opp.ExpectedRevenue+'<oppExpectedRevenue>'

+'<oppProbability>'+opp.Probability+'<oppProbability>'+'<oppBuyChange>'+opp.Buy_Change_percentage__c+'<oppBuyChange>'

+'<oppBuyChangeWestburg>'+opp.Buy_Change_Westburg_percentage__c+'<oppBuyChangeWestburg>'

+'<oppInvoiceAcc>'+opp.Invoice_Account__c+'<oppInvoiceAcc>'+'<oppDeliveryAcc>'+opp.Delivery_Account__c+'<oppDeliveryAcc>'

+'<oppGrossTotalPrice>'+opp.Gross_Total_Price__c+'<oppGrossTotalPrice>'+'<oppDiscount>'+opp.Discount_percentage__c+'<oppDiscount>'

+'<oppLeadSource>'+opp.LeadSource+'<oppLeadSource>'+'<oppNextStep>'+opp.NextStep+'<oppNextStep>'

+'<oppDescritpion>'+opp.Description+'<oppDescritpion>' +'<oppCreatedBy>'+opp.CreatedById+'<oppCreatedBy>'+'<oppLastModified>'+opp.LastModifiedById+'<oppLastModified>'

+'<oppRecordType>'+opp.RecordTypeId+'<oppRecordType>';               
        system.debug('testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+opp.StageName);
        RequestClass.myMethod(xml);
        System.debug('AAAAAAzzzzzzzzz');
        system.debug('*********'+xml+'!!!!!!!!!!!!!!!!!');
        }
    }
   
}

 

 

Thanks for any explaination

Message Edited by sabsi on 04-20-2009 03:31 AM
  • April 14, 2009
  • Like
  • 0

Hi everybody,

I'm a newbie...

I need to post  Opportunity fields to an Https URL after updating one of this field. I've tried with a simple http but that doesn't work

I created a trigger (after Update)

Is it possible with a trigger to do this?

code:

global class RequestClass {
     @Future(callout=true)
   
     Public static void myMethod(string xml)
     {
         Http http= new Http();
        HttpRequest req=new HttpRequest();
        req.setEndpoint('http://test.salesforce.com');
        req.setMethod('POST');
        //Second, invoke web service call
        HttpResponse res=http.send(req);
        //Last, handling the response
        req.setBody(xml);
        //string deb=string.valueOf(res.getBody());
        string deb=res.getBody();
        string username='';
        string passwd='';
        blob headerValue=Blob.valueOf(username+':'+passwd);
        string autHeader='Basic'+Encodingutil.base64Encode(headerValue);
        req.setHeader('Authorization',autHeader);
        system.debug(res);
        system.debug(xml);
        //system.debug(req);
        system.debug(deb+'**********************deb*************************');   
     }
 
}

Trigger

trigger SentToAsw on Opportunity (after update) {
    for (Opportunity opp: Trigger.new){
        if (opp.StageName == 'Closed Won')
        {
                
        string xml='<oppOwner>'+opp.OwnerId+'<oppOwner>'+'<oppName>'+opp.Name+'<oppName>'

+'<oppAccountName>'+opp.AccountId+'<oppAccountName>'+'<oppType>'+opp.Type+'<oppType>'

+'<oppCloseDate>'+opp.CloseDate+'<oppCloseDate>'+'<oppStage>'+opp.StageName+'<oppStage>'

+'<oppApproved>'+opp.Approved__c+'<oppApproved>'+'<oppExpectedRevenue>'+opp.ExpectedRevenue+'<oppExpectedRevenue>'

+'<oppProbability>'+opp.Probability+'<oppProbability>'+'<oppBuyChange>'+opp.Buy_Change_percentage__c+'<oppBuyChange>'

+'<oppBuyChangeWestburg>'+opp.Buy_Change_Westburg_percentage__c+'<oppBuyChangeWestburg>'

+'<oppInvoiceAcc>'+opp.Invoice_Account__c+'<oppInvoiceAcc>'+'<oppDeliveryAcc>'+opp.Delivery_Account__c+'<oppDeliveryAcc>'

+'<oppGrossTotalPrice>'+opp.Gross_Total_Price__c+'<oppGrossTotalPrice>'+'<oppDiscount>'+opp.Discount_percentage__c+'<oppDiscount>'

+'<oppLeadSource>'+opp.LeadSource+'<oppLeadSource>'+'<oppNextStep>'+opp.NextStep+'<oppNextStep>'

+'<oppDescritpion>'+opp.Description+'<oppDescritpion>' +'<oppCreatedBy>'+opp.CreatedById+'<oppCreatedBy>'+'<oppLastModified>'+opp.LastModifiedById+'<oppLastModified>'

+'<oppRecordType>'+opp.RecordTypeId+'<oppRecordType>';               
        system.debug('testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+opp.StageName);
        RequestClass.myMethod(xml);
        System.debug('AAAAAAzzzzzzzzz');
        system.debug('*********'+xml+'!!!!!!!!!!!!!!!!!');
        }
    }
   
}

 

 

Thanks for any explaination

Message Edited by sabsi on 04-20-2009 03:31 AM
  • April 14, 2009
  • Like
  • 0
Hi...
 
        In my sandbox org I got Index 4, Size 4 error when I give renderas pdf for my VF page ..
 
My VF page work fine in HTML format.. I have to render a PDF when I click a Detail page button....
 
Some records rendered a PDF correctly.. Some record I got a error index 4, Size 4.....
 
How to avoid it...  How to fix this problem...
 
 
 
 
 
Hello,
 
Where can I get a copy (pdf is ok) of the default Salesforce.com Enterprise Database Schema.
 
I need to know the names of all the tables, the field names and data types.
 
Thanks,
 
Michael
  • April 24, 2007
  • Like
  • 0