replicate custom button from Salesforce classic in Skuid

edited February 4, 2020 in Questions

I'd like to replicate the behavior from a custom button built for us by a consultancy in the classic interface, into a new Skuid page built by me. My understanding is that it's not possible to call a custom button from Skuid, or at least it doesn't appear as an option under the "Run Salesforce Action", which is a shame, as I don't have the best understanding of what the button does.


Currently the custom button calls a visualforce page (see screenshot)


It calls this visualforce page


Which calls this apex class:

public with sharing class MergerOverrideExtension {

    public Merger__c controllerMerger { get; set; }
    public MergerServices mergerService;

    private CDFIntegration cdfIntegration;

    private MergingAccountService mergerAccountService;

    public MergerOverrideExtension(ApexPages.StandardController controller) {
        this(controller, new CDFIntegration());
    }

    @TestVisible
    private MergerOverrideExtension(ApexPages.StandardController controller, CDFIntegration cdfIntegration) {
        this.cdfIntegration = cdfIntegration;
        this.controllerMerger = (Merger__c)controller.getRecord();
        this.mergerService = new MergerServices(cdfIntegration);
        this.mergerAccountService = new MergingAccountService();
    }

    public PageReference saveMerger() {

        try {
            upsert controllerMerger; // this should trigger a flow to insert the merging accounts?
        } catch (DMLException e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDmlMessage(0)));
            return null;
        } catch (Exception e) {
            ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, e.getMessage()));
            return null;
        }

        return new ApexPages.StandardController(controllerMerger).view();
    }

    public PageReference initiateMerger() {
        return mergerAccountService.initiateMerger(controllerMerger, mergerService);
    }

    public PageReference abandonMerger() {
        return mergerAccountService.abandonMerger(controllerMerger, mergerService);
    }

}

Which displays an error message like this in classic:

image


From what I've read, I need to change class above to make it "invocable". Making it invocable will mean I can use the method in Skuid, with it appearing as an apex action. Is there anyone that can help me change my apex class to do this please, or just anyone able to suggest a declarative alternative?

Thanks

Glenn





Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!