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.
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.
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.
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:
- Download the zip file containing the package files I created here
- Launch Dynamics GP right clicking on your Dynamics shortcut and choosing “Run as administrator”
- 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,