The Hidden JavaScript Extension – customValidation

Now obviously with a click-bait title like this, you have to accept that what is in this article is not documented and therefore not supported in any way. But I figured that you maybe would be interested by the customValidation extension.

As you may already know, there are many different types of custom JavaScript Extension that relate to Inputs – Custom Input, Full Custom Input and a few more that are related – Custom Options, Custom Search and so on. But there is also a hidden one called custom Validation. It’s in the file, but not documented anywhere public.

As the customValidation name suggests, it simply allows you to add a validation to an Input Control. No further work is required other than supplying the validate object key. The user experience will be as standard. So an example would look like this piece of simple code:

OraclePolicyAutomation.AddExtension({
    customValidation: function(control, interview) {
        if (control.getProperty("name") == "xMyExtension") {
            return {
             
                validate: function(el) {
                    console.log("Starting name:xMyExtension customInput Validate");
                    if (el.value == 'BANANA') {
                        control.setValue(el.value);
                        return true;
                    } else {
                        return 'PLEASE ENTER BANANA!'
                    }
                    console.log("Ending name:xMyExtension customInput Validate");
                }
            }
        }
    }
})

So the execution of this customValidation code, tied to a suitable attribute, looks like this:

The cool thing about this custom Validation undocumented extension is that the user experience is standard – no need to implement a mount object key or anything else. Of course, this is not documented and therefore does not exist. But if you happen to have need of it, and want to experiment, go ahead, just remember it is not supported and therefore should not ever be used in production. Until such times as someone says that it is acceptable to do so.

There are several other hidden jewels in the JavaScript Extensions, if there is time one day we will talk about them. Until then they must remain secret 🙂

The documentation of the “official” JavaScript Extensions can be found online here. Have a nice day!

Author: Richard Napier

After 8 years in case management and ERP software roles, Richard Napier joined Siebel Systems in 1999 and took up the role of managing the nascent Siebel University in Southern Europe. He subsequently was Director of Business Development and Education for InFact Group (now part of Business & Decisions) for 8 years. He now runs Intelligent Advisor IT Consulting OÜ. Owner of intelligent-advisor.com, he also is Co-Founder of the Siebel Hub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Intelligent Advisor IT Consulting Serving Customers Worldwide
Hide picture