0

I'm using Java 8 with FuelSDK and am trying to retrieve some Automations but can however not wrap my head around how do it. I am able to fetch the DataExtensions using the following code:

        ETClient client = new ETClient("fuelsdk.properties");

        ETResponse<ETDataExtension> response = client.retrieve(ETDataExtension.class);

        return response.toString();

But there is no class under ETResponse that is related to Automation or AutomationInstance, they seem to be under ETApiObject, but can't figure out how to use that and I don't really get the documentation how to use the different objects.

Please assist.

Best Regards Cisco

4
  • I am not a Java expert but from a glance, I can see you're retrieving Data Extension using its own class. Hence I believe you'll need to dig into a separate class to retrieve Automation Status. Try this salesforce-marketingcloud.github.io/FuelSDK-Java Jul 8, 2020 at 11:08
  • Hi @BradSapkota. Thanks for your reply. Yes it's fairly easy for a Data Extension because the FuelSDK has a class for it ETDataExtension, but there is nothing like ETAutomation or similiar that is usable with the retrieve function. I've been looking at the documentation for 2 days straight and it's only making me more and more confused.. Jul 8, 2020 at 11:10
  • Are you able to checkout classes in this page salesforce-marketingcloud.github.io/FuelSDK-Java I can see there are classes and nested classes for automation. Once you can retrieve automation, the column Status (which is an integer) should be the one for you. Apologies for not able to assist any further Jul 8, 2020 at 11:16
  • @BradSapkota I am only able to retrieve data on classes in the ET*** format. Not the ones from the "internal" package, where the Automation class exists.. If I try to fetch an Automation object using ETClient, it will just throw errors that Automation cannot conform to ETApiObject.. Jul 8, 2020 at 11:24

2 Answers 2

0

I had the same issue, not found any document. So I used the SOAP API to retrieve the status, here's the link https://developer.salesforce.com/docs/#retrieve-a-single-instance-of-an-existing-automation

1
  • 1
    Thanks for your answer! Yes we are using this solution already with curl functions from shell scripts.. And yes it would be possible to just use soap directly in Java.. But I think it should be possible from SDK. Jul 9, 2020 at 7:28
0

So we managed to solve this by the help of a collegue here. This is our working code:

    public String Etl() throws ETSdkException, RemoteException {

        ETClient client = new ETClient("fuelsdk.properties");
        String response = client.getSoapConnection().getEndpoint();
        //get soap stub
        Soap soapClient=client.getSoapConnection().getSoap();
        //Creating a request for AutomationInstance Object
        RetrieveRequest retrieveRequest = new RetrieveRequest();
        retrieveRequest.setObjectType("Automation"); //set which object we want here
        //Create properties
        List<String> props = new ArrayList<>();
        //{"Name", "StartTime", "CompletedTime", "Status"};
        props.add("Name");
        //props.add("StartTime");
        //props.add("CompletedTime");
        props.add("Status");
        retrieveRequest.getProperties().addAll(props);
        //filter
        SimpleFilterPart filter1 = new SimpleFilterPart();
        filter1.setProperty("CustomerKey");
        filter1.setSimpleOperator(SimpleOperators.EQUALS);
        filter1.getValue().add("SEC_ETL_IMPORT");
        retrieveRequest.setFilter(filter1);
        RetrieveRequestMsg retrieveRequestMsgCont = new RetrieveRequestMsg();
        retrieveRequestMsgCont.setRetrieveRequest(retrieveRequest) ;
        RetrieveResponseMsg retrieveResponseMsgCont = soapClient.retrieve(retrieveRequestMsgCont);
        System.out.println("[overall status message] "
                + retrieveResponseMsgCont.getOverallStatus());
        List<APIObject> apiObjectArray = retrieveResponseMsgCont.getResults();
        return apiObjectArray.toString();

    }

The only issue we're having now is converting the APIObject to the object of Automation in internal classes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .