Skip to content
+1-888-319-3663

EONE BLOG

Tech Tuesday: Restricting the Modification of Existing SmartLists by SmartList Builder


One of the great features of SmartList Builder is that not only can you create new SmartLists from scratch, it also gives you the ability to modify existing Dynamics GP out-of-the-box SmartLists.

Actually, SmartList Builder does not actually modify the GP SmartList. It runs an eOne created SmartList that copies the functionality of the original GP SmartList and then hides the original one in SmartList itself.

What we’ve seen at eOne is that sometimes users don’t want this type of functionality. There are various reasons I’ve heard for this – but the common one is that since the “modified” version is actually a new SmartList – then non PowerUsers won’t have security to it by default.

Since the original one is hidden and the “modified” version displayed – it isn’t evident this has occurred and an admin would either need to adjust security for all users or delete the “modified” SmartList Builder version so that SmartList will revert back to the original one.

While this seems to be a good feature to add into SmartConnect – as a developer I wondered if it was possible that we could make our own (temporary) solution?

From an eOne solution perspective, Extender Enterprise would seem logical using the same type of technique I used in a previous article.

Unfortunately that isn’t possible due to the eventing model currently in the product.

We could perhaps create a Visual Studio Tools addin. While I didn’t try this, I don’t think it would work either due to the order the Dynamics Runtime loading the events (vstools events are loaded last).

We could use Dexterity to do this customization. But as I noted previously, while a simple customization, you would have a separate customization outside of the application to maintain and of course there are not that many Dexterity developers out there.

The last customization tool that we could consider is using Dynamics GP VBA. While still a separate customization – VBA has been in Dynamics GP since version 4.0 so most partners are familiar with it. Users accustomed to using VBA in Microsoft Office will find the environment familiar as well.

I’ll skip the explanation of adding the Extender fields to Visual Basic and how to create the VBA project as that information is included with the VBA Developers Guide include with the Dynamics GP documentation.

But I’ll give the explanation and the code behind the customization for those that are interested. If not, skip to the end where I discuss the two package files and instructions to use them in GP.

The Code

In order to not let SmartList Builder modify our existing SmartList, we have to get to the event before SLB does.

From VBA, this is a “BeforeUserChanged” event and it will run on the Modify button.

Private Sub Modify_BeforeUserChanged(KeepFocus As Boolean, CancelLogic As Boolean)
    'Don't allow any SmartLists that aren't from SLB to be modified from this UI
    If ASIFavoriteDictID <> 3830 Then
        CancelLogic = True
        MsgBox "This SmartList cannot be modified."
    End If
 End Sub

In the VBA code above the Modify_BeforeUserChanged() event runs. In it, the VBA code checks the Product ID (In the field ASIFavoriteDictID) to check to see if it a SmartList created by SLB or not.

In the above code, if it is not 3830, it cancels the GP business logic but also would cancel the SmartList Builder logic. After doing so, it gives a message to the user “This SmartList cannot be modified”.

The results of the above code when I try to Modify the Customers SmartList are given in the following screenshot.

Figure 1: This SmartList cannot be modified

Figure 1: This SmartList cannot be modified

With the above code, it isn’t possible to allow the SmartList to be “modified” by pressing the Modify button in SmartList itself. However the user can still modify the SmartList by using the SmartList Builder window and choose SmartList Type = Existing.

If we wish to be more flexible for our users, instead of flatly denying them the ability to Modify the existing SmartList in the SmartList window, we could choose to warn the user that we were attempting to do this and let them choose to Modify it or not.

Private Sub Modify_BeforeUserChanged(KeepFocus As Boolean, CancelLogic As Boolean)
    'Promt the user to confirm if they want to change a non-SLB SmartList
    'We don't need a warning statement because the user was warned in the dialog
    If ASIFavoriteDictID <> 3830 Then
        If MsgBox("This SmartList is not a SLB Smartlist, do you still wish to modify it?", vbYesNo) = vbNo Then
            CancelLogic = True
        End If
    End If
 End Sub

When choosing the Modify the existing Customers SmartList, we are now given the warning as in the following diagram.

Figure 2: This SmartList is not a SLB SmartList, do you still wish to modify it?

Figure 2: This SmartList is not a SLB SmartList, do you still wish to modify it?

Pressing the No button will then cancel the Modify action. Pressing the Yes button will open the Customers SmartList in the SmartList Builder window as normal.

How do you use the customization?

I believe all Dynamics GP Customers have at least the Customization Site Enabler module now meaning they should be able to use any created VBA customizations.

To use these in your Dynamics GP install:

  1. Download the zip file containing the package files I created here
  2. Launch Dynamics GP right clicking on your Dynamics shortcut and choosing “Run as administrator”
  3. Import the SmartList_DoNoAllowModify.package to not allow changes or SmartList_PromptToModify.package to prompt the user

Again remember, no matter which package you choose to use, the user can always modify an existing SmartList.

Just launch the SmartList Builder menu item to open the SmartList Builder window.

Next choose SmartList Type = Existing and then choose the SmartList ID for the existing out-of-the-box SmartList you wish to Modify and SLB will “modify” the SmartList the same as it always has.

Hope this helps everyone out – or at least shows off the ability for SmartList Builder to make SmartList better and faster!

Until next time,

Patrick
eOne

1 Comment

  1. Chuck Docekal on April 11, 2017 at 11:41 am

    I have a request to only show the last sales date for an inventory item from a client. I can get the data, but I just want to see one data by item. I do not have an option under restrictions. What other options do I have?

Leave a Comment





RECENT POSTS


Happy Thanksgiving from eOne! - US Office Closed November 25 & 26
Popdock: What is your Locale?
Q4 2021 Partner All Hands Call - Recording Now Available
An Announcement regarding SmartList Builder and SmartView from eOne Solutions
Join us for the Q4 2021 Partner All Hands Call!

POPULAR POSTS


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships partners Popdock release Reporting SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.