Should I use transformers or put everything into javascript


I have a module with an output that can changes the fields that it displays depending on the tab that you are in. And depending on that, the submit button disables or enables if that respective field is filled in.


Normally I put the javascript code in the disable component field, sometimes even when it's quite complex. But when it's very cumbersome I tend to create a transformer.

In this case I created a transformer


and I just put, transformer.value on the disable field.

But if I wanted to, I would put something like this on the disable field:

{{ actionType.value === "Product" ? CAproduct.value === null :
actionType.value === "Session" ? CAsession.value === null :
actionType.value === "Opportunity" ? CAopportunity.value === null : false }}


I was wondering in terms of performance, is there any advantage or disadvantages on using transformers? Normally I tried to avoid using transformers since In my mind I think they will lower the apps performance. But maybe sometimes I might making things more complicating to myself.

nah the code being put in a Transformer or in the disable component field will have the same performance impact. it has to do with how Transformers would be implemented, it would be the same as a function (or JMP/GOTO command) that is or isn't called at the end of any other function/query/ect. if the code loops through a few mil records and changes all of them, it'll be just as slow in a Transformer as it would be in a disabled field.

transformers are nice so you don't have to go looking around for everywhere you stuck JS you duplicated from one place to another when you need to make a change.... instead you can keep the transformer in the Code UI and just reuse that one. this way if you ever need to change it, everywhere that uses it will have the updated code (having to find everywhere you have duplicate code to make 1 change can get mind numbingly annoying especially if you forget about 1 spot lol)


Thank you! I'm finding transformers more and more useful but I was worrying about abusing them so I was trying to use them sparsely. So I'll take as much advantage of them and make them as
multipurpose as I can.