Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > BizForm GUID Question View modes: 
User avatar
Member
Member
dmeyer-92y - 8/31/2010 11:25:51 AM
   
BizForm GUID Question
I would like to have a BizForm that upon submit generates a GUID that is saved to the DB and also goes out in the confirmation email. The idea being the submitter would come back to the site later using the guid to fill out additional information.

I can create a BizForm with a GUID field using the designer, but how would I populate it with a GUID? Do I need some custom code? I can write something but I'm not sure where it would go.

User avatar
Member
Member
dmeyer-92y - 8/31/2010 2:44:02 PM
   
RE:BizForm GUID Question
OK I figured out one way to do it- Starting with this example I created a custom bizform. Then I added an attribute to the .ascx markup OnOnBeforeSave="viewBiz_SetGUID". In the codebehind my method for viewBiz_SetGUID looks like this:
    protected void viewBiz_SetGUID()
{
string aguid = Guid.NewGuid().ToString();
if (this.viewBiz.BasicForm.FieldControls.ContainsKey("AGUID"))
{
this.viewBiz.BasicForm.DataRow["AGUID"] = aguid;
}
}

(Note: "AGUID" is the name of my GUID field on my BizForm.)