Infor CRM (Formerly Saleslogix) Embedding quickforms on quickforms

 I recently had a client who needed to have a lot of elements on a form.  They wanted a kind of “Back” “Next” functionality where the user could scroll through a series of screens.  How to do that?  Well the solution I came up with was to use a panel control, and then load a smartpart onto that panel control.  Lets look at how to do this:

Here is a very simple step-through:

On a quickform we’ll call FormMain, add a Panel control called pnlControl
Add 2 buttons to the FormMain quickform.
Add a hidden fields to the form called QFHidden

On the load Action of the FormMain quickform, add the following code snippet (make sure to set the OnRepaint property to true):

//Load Action
if (string.IsNullOrEmpty(QFHidden.Value))
{
    QFHidden.Value=”Test1″;
}
string controlPath = string.Format(“~/SmartParts/Account/{0}.ascx”,QFHidden.Value);
UserControl uc = (UserControl)Page.LoadControl(controlPath);
Sage.Platform.WebPortal.SmartParts.SmartPart sp = uc as Sage.Platform.WebPortal.SmartParts.SmartPart;
if (sp != null)
{
    sp.InitSmartPart(ParentWorkItem, PageWorkItem.Services.Get<Sage.Platform.Application.UI.Web.IPageWorkItemLocator>());
    sp.DialogService = DialogService;
    Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart esp = sp as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart;
    if (esp != null)
    {
        esp.InitEntityBoundSmartPart(PageWorkItem.Services.Get<Sage.Platform.Application.IEntityContextService>());
    }
}
pnlControl.Controls.Add(uc);

Now on the 1st button on the FormMain quickform, add the following code on the click event:
QFHidden.Value=”Test1″;

And on the 2nd button on the FormMain quickform, add the following code on the click event:
QFHidden.Value=”Test2″;

So what this code does is set the hidden field with a value of either “Test1” or “Test2” when the appropriate button is clicked.  Then the load action on the page (remember we set the OnRePaint=true so it runs each postback) the system looks at the value stored in the hidden field, then goes and gets a smartpart in the Account folder with the name matching what is in the hidden field (i.e. Test1.ascx or Test2.ascx).  It the creates a user control for that smartpart and loads it onto the panel control.

Pretty cool.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!