Go back to mobile site

 

Please note: The forums are currently intended for Kentico community. Although we monitor them time to time, we cannot guarantee a timely response. If you need a help with Kentico CMS, please feel free to send your message to support@kentico.com.

If you want to add new post or reply to post, please sign in.

Search: 

Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Macro in BizForm To E-mail View modes: 
User avatar
Member
Member
ctaleck IPAGlobal - 4/16/2009 4:42:54 PM
     
Macro in BizForm To E-mail
Under CMS Desk > Tools > BizForms > Notification e-mail the To e-mail: apparently can contain a macro as indicated by this error when I leave it blank.

Please enter a valid e-mail to address or macro.

So I want to try to dynamically assign the To e-mail by trying:

{%Email_Address%}

where Email_Address is a field from a custom document type I created (which my BizForm is on). It is not working in this case.

Am I attempting to do something that is possible? What macros are valid in this context?

User avatar
Kentico
Kentico
kentico_martind - 4/22/2009 8:05:22 AM
     
RE:Macro in BizForm To E-mail
Hello,

Unfortunately, you can specify only columns of BizForm to get value from this column.

You could eventually try procedure bellow to pass value from field of document type to field of BizForm:

1) Create some another field for BizForm and set it not to be displayed in public form

2) Implement OnBeforeSave event handler (similarly as described at http://www.kentico.com/docs/devguide/modifying_the_code_of_standard_web_parts.htm) and in this handler you can add value from custom field of document type into new field of BizForm. Please see sample code bellow:

this.BizFormNew.BasicForm.DataRow["NameOfBizFormField"] =
CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("NameOfDocumentTypeField");

Best Regards,

Martin Dobsicek

User avatar
Member
Member
ctaleck IPAGlobal - 4/23/2009 1:52:04 PM
     
RE:Macro in BizForm To E-mail
Thank you for sending me in the right direction with this.

I had to use the OnBeforeSave event (as opposed to the OnAfterSave) to get it to work.

    protected void viewBiz_OnBeforeSave()
{
// put into the form a field containing the e-mail address of the current contact from custom_contact table
this.viewBiz.BasicForm.DataRow["EmailToContact"] = CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("Email_Address");
}


In the CMS Desk > Tools > BizForms > [Choose Form] > Notification e-mail > To e-mail field I inserted this macro {%EmailToContact%} which is the extra field I added to my form fields.

One thing to note: I was not able to uncheck the Show on public form in the Field definition as it removed the field completely from the form. I instead had to set the Caption style and the Input style to display:none so that the field was available when I copied the value into it.

1

Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2013 Kentico Software | Powered by Kentico CMS