Archive Email on history panel from logic hook

Hi,

I have a custom module that creates a bunch records. I can create most of the by using BeanFactory::newBean(‘Module’). The issues is when trying to storage a record on email to be presented on the history panel.

Doing some research I found that ArchiveEmail under History panel calls a sugar widget called SubPanelTopArchiveEmailButton.
Code for this button can be found under include\generic\SugarWidgets\SugarWidgetSubPanelTopArchiveEmailButton.php.

My question is how to achieve the same result from a logic hook.

Thanks in advance.

Sorry, I don’t quite understand. This email you want to appear on the “Activities” panel already exists in SuiteCRM? Is it already imported?

Maybe you just need to link it, create the relationship, not create the email, that’s why I am asking.

Also, please be more detailed: which version of SuiteCRM is this, which Module you want it to appear in, which logic hook you’re trying to use. Just so I can get a clearer picture.

pgr: Thanks for responding.

I’m using version 7.10.10. As you know, there are ACTIVITIES and HISTORY sub-panels under accounts. From the ACTIVITIES sub-panel you can “ComposeEmail”. A pop-up window comes up (three as there is a bug on this version) and you can create and send your email. It will automatically be logged to the next sub-panel called “HISTORY”.

Now from HISTORY sub-panel, you can “ArvhiveEmail”. When doing this, a new window comes up with three fields only: Assigned to, Related to and Category. When saved, it is logged to the HISTORY sub-panel. This is the same function I want to achieve from my custom module.

I don’t know how to call the BeanFactory::newBean to create the record.

Today I’ll try to do direct insert into the DB. Any suggestion is welcome.

Thanks,

Update. I was able to complete it by direct insert into tables emails and emails_beans

Cool B-)

If you can share your code here, it might help someone else in the future. Make sure you put it inside the Forum’s “code” tags, otherwise parts of it will be stripped out.

Thanks!

1 Like