Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Bizform: can we send different email for each alternative form? View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 3/29/2011 5:48:00 PM
   
Bizform: can we send different email for each alternative form?
Hi Guys,

We have a bizform with 20 fields in it.
Now we have some Alternative-forms with each having only 5 fields.
It works exactly as I expected.

But when the E-mail is sent to the Administrator it sends all the 20 fields instead of that 5 fields only.

Any advice is appreciated.

Thanks
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_radekm - 4/7/2011 12:04:01 PM
   
RE:Bizform: can we send different email for each alternative form?
Hello.

Are you using custom layout on your bizform? You can check it in CMSDesk -> Tools -> BizForms -> edit -> Forms tab.

Is "Use custom form layout" option checked? If so, how many fields are there? Thank you.

Best Regards,
Radek Macalik

User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 4/7/2011 5:41:36 PM
   
RE:Bizform: can we send different email for each alternative form?
Hi Radek,

Custom Form Layout is unticked in Bizform.
Is it suppose to be turned on?

But my problem is with the emails and not the website forms.

I am sending you the logins, so that it might be easy for you to check.

Cheers
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_radekm - 4/8/2011 1:36:57 AM
   
RE:Bizform: can we send different email for each alternative form?
Hello.

So, let me summarize what´s the problem. You can BizForm with 20 fields and alternative form with 5 fields visible on public form. When you receive notification e-mail, as you can set it on Notification e-mail tab, it contains all 20 fields, not 5 only.

Is that correct?

If so, you can change it in a very easy way. On "Notification e-mail" tab you can enable custom layout, clicking "Use custom layout" checkbox. Then, default layout is generated and it contains all (20) fields. However, you can delete 15 of them you don´t want to use, and keep 5 required only. Then, administrator will receive notification message with these 5 fields only. Thank you.

Best Regards,
Radek Macalik

User avatar
Certified Developer v7
Certified  Developer v7
Gitesh - 4/10/2011 4:21:32 PM
   
RE:Bizform: can we send different email for each alternative form?
Hello Radek,

That's right.
But scenario is little different.

Bizform is having 20 fields.
1st alternative form is having 5 fields.
2nd alternative form is having 10 fields
3rd alternative form has 5 fields(all different fields than 1st alternative form).

I hope the scenario is clear now.

Thanks
Gitesh Shah

User avatar
Kentico Support
Kentico Support
kentico_radekm - 4/11/2011 4:00:00 AM
   
RE:Bizform: can we send different email for each alternative form?
Hello.

So, if I understand it well - you want to modify notification email´s layout as per current alternative form, selected in your bizform properties? I mean when 1st alternative form is selected, you want to send notification e-mail with 5 fields, when 2nd alternative form is selected, you want to send notification e-mail with 10 fields, and so on? Is that correct?

If so, you would need to ensure it via customization, since by default you can have only 1 notification email layout defined, and it cannot be switched dynamically. However, you can send notification e-mail in code and set any layout, according to what alternative form is selected.

You can do it in OnBeforeSave method of your bizform: devnet.kentico.com/docs/devguide/modifying_the_code_of_standard_web_parts.htm, where you can get current alternative form´s name from viewBiz.AlternativeFormFullName property and set FormEmailTemplate property of given BizFormInfo object according to it.

Then notification e-mail based on this template (which is chosen according to selected alternative form) is sent.

Please find code example below.

// OnBeforeSave method

//get alternative form´s full name
string sAltFormName = viewBiz.AlternativeFormFullName;

//get BizFormInfo object
CMS.FormEngine.BizFormInfo iBiz = CMS.FormEngine.BizFormInfoProvider.GetBizFormInfo(int.Parse(viewBiz.ID));

//set notification template as per alternative form name
switch (sAltFormName)
{
case "SomeName": iBiz.FormEmailTemplate = "some string"; break;
case "SomeOtherName": iBiz.FormEmailTemplate = "some other string"; break;
default: break;
}


Best Regards,
Radek Macalik