back to top

Refreshing the Sales Order snapshot from a sales order tab event

Recently I needed to find a way to cause the sales order snapshot to refresh when a server event triggered on a different Sales Order tab.  I was able to do so using the following code.

The snapshot is loaded onto the SalesOrderDetail quickform as a registered custom user control with the following syntax:

<%@ Register tagPrefix=”SalesLogix” tagName=”wbrSalesOrder” src=”~/SmartParts/SalesOrder/FXOrderSnapShot.ascx” %>
<SalesLogix:wbrSalesOrder id=”wbrSalesOrder” runat=”server” OnInit=”setwbrSalesOrderContext” ></SalesLogix:wbrSalesOrder>

The first thing we need to do is to get a reference to this custom user control from our other tab.  The best way of doing this is to loop through the controls on the form until we find the one we are looking for.  We can construct a recursive method to handle this function for us like so:

private static T FindControlRecursive<T>(Control Root, string Id) where T : Control
{

    if (Root.ID == Id && Root is T)
        return (T)Root;
    foreach (Control Ctl in Root.Controls)
    {
        var FoundCtl = FindControlRecursive<T>(Ctl, Id);
        if (FoundCtl != null)
            return FoundCtl;
    }
    return default(T);
}

Then to call the recursive method for the one item we want we can construct a method like so:

public static T GetControlReference<T>(System.Web.UI.Control form, string controlId) where T : Control
{
    return (T)FindControlRecursive<T>(form, controlId);
}

With these two methods we can then locate and instantiate a reference to the user control by calling something like this:

Sage.Platform.WebPortal.SmartParts.SmartPart sp =
GetControlReference<Sage.Platform.WebPortal.SmartParts.SmartPart>(this.Page,
“wbrSalesOrder”);

As you can see we are defining the control we are searching for is a SmartPart control type.  We are searching on the current page for the control and the control ID we are looking for is “wbrSalesOrder”, as defined on the SalesOrderDetails.ascx.  With our reference we are then able to work with the SmartPart methods available to rebind and refresh the snapshot.

Here is the completed code:

protected void RefreshSnapshot()
{
    Sage.Platform.WebPortal.SmartParts.SmartPart sp = GetControlReference<Sage.Platform.WebPortal.SmartParts.SmartPart>(this.Page, “wbrSalesOrder”);
    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>());
            esp.PanelRefresh.RefreshAll();
        }
    }
}

public static T GetControlReference<T>(System.Web.UI.Control form, string controlId) where T : Control
{
    return (T)FindControlRecursive<T>(form, controlId);
}

private static T FindControlRecursive<T>(Control Root, string Id) where T : Control
{

    if (Root.ID == Id && Root is T)
        return (T)Root;
    foreach (Control Ctl in Root.Controls)
    {
        var FoundCtl = FindControlRecursive<T>(Ctl, Id);
        if (FoundCtl != null)
            return FoundCtl;
    }
    return default(T);
}

Using this kind of logic allows you to not only work with a specific SmartPart user control.  You could also use the same procedure to manipulate any web control on the form, like a picklist, textbox, etc.

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Kris Halsrud
Kris Halsrud
Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos