You need to sign in to do that
Don't have an account?
Mohsinkhan Pathan
How to fetch the HttpPost response and assign it to the body of a attachment.
Hi Team,
I am creating a record in custom object every time a transaction happens between salesforce and external system. When this record is created, I need to attach the request and the response to this record.
I am able to save the request as attachment.But unable to save the response.I am trying to save the respone returned by Httppost method in a string before it is returned. It saves the response in the string. I verified it by having a debug statement. But when I use the same string variable to assign to attachment.body (Creating a attachment record) it is null. Creation of attachment is happening in seperate method (public) based on the success or Failure of the transaction. I have also declared the string as global static so that I can use it in other methods.
How can I assign the response to attachment.body so that the response that is sent to external system is saved as attachment to the record.
Note I am using wrapper class to set the response variables. Below is the code of wrapper class.
global class createNewwrapper
{
global String Fields {get;set;}
global String Message {get;set;}
global String Statuscode {get;set;}
global createNewwrapper(){ }
}
Please help me on how to do this. Looking forward to hear from you. Thanks in Advance.
Regards,
Khan
I am creating a record in custom object every time a transaction happens between salesforce and external system. When this record is created, I need to attach the request and the response to this record.
I am able to save the request as attachment.But unable to save the response.I am trying to save the respone returned by Httppost method in a string before it is returned. It saves the response in the string. I verified it by having a debug statement. But when I use the same string variable to assign to attachment.body (Creating a attachment record) it is null. Creation of attachment is happening in seperate method (public) based on the success or Failure of the transaction. I have also declared the string as global static so that I can use it in other methods.
How can I assign the response to attachment.body so that the response that is sent to external system is saved as attachment to the record.
Note I am using wrapper class to set the response variables. Below is the code of wrapper class.
global class createNewwrapper
{
global String Fields {get;set;}
global String Message {get;set;}
global String Statuscode {get;set;}
global createNewwrapper(){ }
}
Please help me on how to do this. Looking forward to hear from you. Thanks in Advance.
Regards,
Khan
Thanks for the reply. But this is not working. I am trying to access the returned values of one method and use them in another.