if you use REST activity, it will return the content without file type extension.
You may need to write java action to make http request, the result of http request maybe InputStream
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public InputStream makeHttpRequest(String fileUrl, String accessToken) throws Exception {
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + accessToken);
connection.setConnectTimeout(5000); // Timeout for connecting to the server
connection.setReadTimeout(5000); // Timeout for reading the data from the server
int responseCode = connection.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
throw new Exception("HTTP request failed with response code " + responseCode);
}
return connection.getInputStream();
}
InputStream fileStream = makeHttpRequest(salesforceFileUrl, accessToken);
Then you can store in mendix FileDocument, you can create the filedocument from microflow as an input in java action
private technoapi.proxies.GeneratedExcel GeneratedExcel; // if this was an input these line will auto generate by mendix
GeneratedExcel.setName("ExcelOutput.xlsx"); //Set the file type in code or you can set it in microflow when creating obj
Core.storeFileDocumentContent(context, GeneratedExcel.getMendixObject(), fileStream); // fileStream will get from the function makeHttpRequest
return GeneratedExcel.getMendixObject(); // in java action return it as FileDocument as GeneratedExcel is an object generalization from FileDocument.