# Enterprise forms set Subject Programatically in MailFormDataBehavior

**URL:** <https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [December 3, 2018, 10:23am UTC](https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644 "2018-12-03T10:23:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aitoraznar](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/aitoraznar/32/195_2.png) [@aitoraznar](https://community.bloomreach.com/u/aitoraznar)\
**Post date:** [December 3, 2018, 10:23am UTC](https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644/1 "2018-12-03T10:23:59Z")

</div>

Hi,

I just trying to set the email subject using MailFormDataBehavior in Enterprise Forms programatically depending on HippoCMS locale.

I have a custom form class extending AutoDetectFormComponent and I’m unable to override **getSubject** method from MailFormDataBehavior. Other methods I’ve seen are read-only and I can just call the getters methods, not set the value.

I tried creating a new plugable form behavior based on MailFormDataBehavior which is a identical copy but in another package. Adding this new custom behavior I could change the **getSubject** method.  
CustomMailFormDataBehavior extends MailFormDataBehavior

But the new class is not detected by HippoCMS, I attach screenshots of my configuration:

New custom behavior

 ![Selection_999(130)](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/2293472c697de63737a1fdc1166e09565de3b993.jpeg)

Set the new behavior to the form component:

 ![Selection_999(133)](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/c9f1bd0b15e45c882e7793920e47110098a7b27b.jpeg)

Hippo CMS can’t load the class:

 ![Selection_999(134)](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/087b8a8bab215ddabe1a9c041cf34f1961b4a6bd.jpeg)

Could you help with any clues?  
Regards,  
Aitor

---

<div class="post-metadata">

**Author:** ![ThoLe](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/thole/32/98_2.png) [@ThoLe](https://community.bloomreach.com/u/ThoLe)\
**Post date:** [December 3, 2018, 10:29am UTC](https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644/2 "2018-12-03T10:29:59Z")

</div>

Hi @aitoraznar

Do you got this error locally or in production ? For me it is because the class CMSMailFormDataBehavior has not been loaded by your JVM Runtime classloader. So where do you put the class in /site or /cms project ? are you sure that you have deployed it ?

---

<div class="post-metadata">

**Author:** ![aitoraznar](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/aitoraznar/32/195_2.png) [@aitoraznar](https://community.bloomreach.com/u/aitoraznar)\
**Post date:** [December 3, 2018, 11:31am UTC](https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644/3 "2018-12-03T11:31:13Z")

</div>

Hi @ThoLe,

Thanks for your quick feedback.  
I’m developing this locally, I have stopped, cleared the project (mvn clean) and compiled again.

The new custom class **CustomMailFormDataBehavior** is in /site. Additionally I have tried to move the class to /cms project with the same “class not found” result.

There is any way to set the email’s subject programatically? Maybe exists another simpler way to accomplish that.

Note: I renamed the classes to illustrate the sample

---

<div class="post-metadata">

**Author:** ![aitoraznar](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/aitoraznar/32/195_2.png) [@aitoraznar](https://community.bloomreach.com/u/aitoraznar)\
**Post date:** [December 5, 2018, 10:45am UTC](https://community.bloomreach.com/t/enterprise-forms-set-subject-programatically-in-mailformdatabehavior/644/4 "2018-12-05T10:45:23Z")

</div>

Tackling this in [https://issues.onehippo.com/browse/SMC-43](https://issues.onehippo.com/browse/SMC-43).

This can be closed
