You need to sign in to do that
Don't have an account?
Vinay_gupta
Invocable method to get record and store the response in wrapper
Hi All,
I am new to Salesforce integration. I have to write an invocable method that will get records from an external system. I have endpoint URL and parameter. I want to store the result in wrapper response.
I have tried this but was not able to get the exact code.
public class fetchdetails{
@InvocableMethod
public static List<Results> FetchZillowEstimation(List<Results> address)
{
HTTP h = new HTTP();
HTTPRequest req= new HTTPRequest();
req.setEndpoint('https://api.getfurnituredata.com/?address=test');
req.setMethod('GET');
HTTPResponse res= h.send(req);
if (res.getStatusCode() == 200) {
String jsonInput =res.getBody();;
}
System.debug(res.getBody());
String jsonInput =res.getBody();
Map<String,Object> m =(Map<String, Object>) json.deserializeUntyped(jsonInput);
system.debug(m);
}
}
global class Results{
@InvocableMethod
global decimal name;
}
I am new to Salesforce integration. I have to write an invocable method that will get records from an external system. I have endpoint URL and parameter. I want to store the result in wrapper response.
I have tried this but was not able to get the exact code.
public class fetchdetails{
@InvocableMethod
public static List<Results> FetchZillowEstimation(List<Results> address)
{
HTTP h = new HTTP();
HTTPRequest req= new HTTPRequest();
req.setEndpoint('https://api.getfurnituredata.com/?address=test');
req.setMethod('GET');
HTTPResponse res= h.send(req);
if (res.getStatusCode() == 200) {
String jsonInput =res.getBody();;
}
System.debug(res.getBody());
String jsonInput =res.getBody();
Map<String,Object> m =(Map<String, Object>) json.deserializeUntyped(jsonInput);
system.debug(m);
}
}
global class Results{
@InvocableMethod
global decimal name;
}
system.debug((cls_FRAPI) System.JSON.deserialize(jsstring, cls_FRAPI.class));
public class ACCOUNT {
public String ACCOUNTID;
public String ACCOUNTNAME;
public String DEFAULTDATE;
}
public class cls_FRAPI {
public FRAPI FRAPI;
}
public class ACCOUNTLIST {
public List<ACCOUNT> ACCOUNT;
}
public class FRAPI {
public String STATUS;
public String MSG;
public ACCOUNTLIST ACCOUNTLIST;
That should help