1

I have a scenario where I have an InvocableMethod which takes a custom Class with properties which are made available with the @InvocableVariable annotation, but I want this class to extend a parent class so that I can re-use this structure

    public abstract class Animal {
        @InvocableVariable
        public string Legs;
    }

    public class Cat extends Animal {
        @InvocableVariable
        public string Breed;
    }


    @InvocableMethod(Label='Example Method')
    public static void exampleMethod(List<Cat> cats){
        handlerMethod(cats);
    }

    public static void handlerMethod(List<Animal> animals){
        for(Animal animal : animals){
            animal.Legs; // always null and cannot be set in Flow
        }
    }

In Flow and Process Builder the Breed property is exposed and available but the Legs property is not.

If I add a Legs property to the Cat class, it does appear in Flow but this does not work either as the object appears to maintain them as separate variables.

How can I ensure that either:

a) the properties on the parent are surfaced in Flow and Process Builder

b) I can pass a value to the parent class for this property

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.