Something I have been asked more than a few times is how to use a SQL view in SmartList Builder to create a new SmartList. I am going to walk through this step by step using Dynamics GP 10.0 SP 3 and SQL Server 2005 SP 3:
STEP 1 – create SQL view
To start we need a SQL view. I have published a number of views for getting GP data, so I will use one of my favorites – Payables Apply Information. You can see the list of other SQL views I have published on my GP Reports page.
To create the view in SQL:
-
Open SQL Server Management Studio and connect to your GP SQL Server
-
Click on the New Query button at the top left
-
Copy the SQL code into the new window that opens (on my blog, I put the code to copy between tildes: ~~~~~)
-
Click Execute
-
You will get a message saying “Command(s) completed successfully.”
-
If you want to use your SmartList in multiple companies, repeat steps 4 and 5 for each company database
STEP 2 – set up SmartList security for SQL view
Before we can use a SQL view in SmartList Builder we need to grant SmartList Builder security to that view:
-
Log into GP as a user that has all the proper security access
-
Open the SQL Table Security window by going to Microsoft Dynamics GP > Tools > SmartList Builder > Security > SQL Table Security
-
Choose Views at the top
-
Click on your company database on the left
-
If you created the SQL view in multiple company databases, repeat steps 4 and 5 for each company database
STEP 3 – create SmartList
Now we are ready to create the SmartList:
-
Open SmartList Builder by going to Microsoft Dynamics GP > Tools > SmartList Builder > SmartList Builder
-
Type in a SmartList ID and Name (the Item Name will default to the SmartList Name, I recommend leaving these the same to avoid confusion)
-
Choose what Product and Series to put your SmartList in – this is a great new option in GP 10.0 and allows you to group SmartLists as you want. This is also something that can be changed later, so some people like to create all new SmartLists is a separate place until they are satisfied with them, then move them to their ultimate location. Up to you on this one.
-
Check the Use Company Database checkbox if you are creating a SmartList that should run against whatever company database the user is logged into (or if you are planning that for the future)
-
Click on the company database on the left
-
Select Views and click on your view on the right
-
Click Save to return to the SmartList Builder window
-
Once you’re done configuring all the additional options for your SmartList, click Save
Next steps & additional resources
Below are some additional resources for creating SmartLists and dealing with SmartList security in GP:
-
This blog – Granting access to a new SmartList in GP 10.0
-
Mariano Gomez – Changing SQL Server views for SmartList Builder SmartLists
-
Mariano Gomez – SmartList Builder Security for SQL Server Views
-
David Musgrave – Creating SQL Views of Extender Data
-
This blog – Reporting on Extender data in Dynamics GP
-
David Musgrave – Creating SQL Views of DUOS Data (added 04.22.2009)
-
Interesting Findings & Knowledge Sharing – SmartList Builder Objects using SQL Tables and Views (added 04.22.2009)
-
Steve Chapman from Rose Business Solutions – video on how to Use SQL Views to Create SmartLists (added 04.14.2010)
If you know of any other resources to add to this list, please let me know.
Thanks for this! Just what I needed.
LikeLike
I got to step 1 number 5, but got this message instead of what number 6 says I should have see: Msg 2714, Level 16, State 3, Procedure view_AP_Apply, Line 22
There is already an object named ‘view_AP_Apply’ in the database.
Any ideas? Could it have anything to do with my smartlist builder being greyed out under tools logged in as sa? I only ran the execute once. I’ve contact my GP partner to get the right keys so I can view smartlist builder. Thanks for your help in advance!
LikeLike
PS…I just tried with your view_ap_distributions and I got the “command(s) completed successfully”…maybe I need to wait and see when I get smartlist builder access if there really is already an object names view_ap_apply in the database?!?!
LikeLike
Hi Andrew,
That just means you already have a view called view_AP_Apply and you can skip to Step 2, number 1. 🙂
-Victoria
LikeLike
Hi Victoria,
Whenever I tried a SQL View in my Smartlist, my Views list is empty.
I did grant DYNGRP to select on my view.
Any idea how to fix that?
Regards,
Julien
LikeLike
Oh yeah, using GP 2013 and SQL Server 2008 R2.
LikeLike
Julien,
What happens if you run the view directly in SQL? Does it return data?
-Victoria
LikeLike
Hi Victoria,
Yes it does.
LikeLike
Julien,
Have you tried it as ‘sa’ or someone who has the POWERUSER role in GP?
-Victoria
LikeLike
I tried it as “sa” and as “julien” which is a POWERUSER.
User “julien” has POWERUSER and IT OPERATIONS MANAGER roles selected.
LikeLike
Julien,
Are you using one of the views posted on my blog? Or your own view?
-Victoria
LikeLike
Victoria,
I’m using my own which goes like this.
———————————————-
SELECT TOP (100) PERCENT ITEMNMBR, SUM(PROD) AS PROD
FROM (SELECT RTRIM(w.ITEMNMBR) AS ITEMNMBR, w.STARTQTY_I – COALESCE (r.QTYRECVD, 0) AS PROD
FROM dbo.WO010032 AS w LEFT OUTER JOIN
(SELECT MANUFACTUREORDER_I, SUM(QTYRECVD) AS QTYRECVD
FROM dbo.MOP1100 AS m
WHERE (REVERSED_RECEIPT_I = 0)
GROUP BY MANUFACTUREORDER_I) AS r ON w.MANUFACTUREORDER_I = r.MANUFACTUREORDER_I
WHERE (w.MANUFACTUREORDERST_I IN (2, 3, 7))) AS t1
GROUP BY ITEMNMBR
HAVING (SUM(PROD) 0)
LikeLike
Julien,
Just as a test, can you try creating a new view and SmartList based on it with something really simple? Like:
select top 100 * from GL00100
To rule out something complicated going on in the logic/data causing what you’re seeing.
-Victoria
LikeLike
Wow,
I found out my problem, I missed out your step II.
Sorry for wasting your time, it works now.
Thank you for your support and for your entire website,
Very helpful!
Regards,
Julien
LikeLike
Hi Julien,
Great, glad it’s working now and thanks for letting me know what it turned out to be. 🙂
-Victoria
LikeLike
Dear Victoria,
Thank you very much for the tutorial.
I have been using smartlist for a while now.
But I am now facing a very strange issue and I need your help.
We are working on 3 companies (company1, company2, company3). And since our go live, I have created a smartlist that returns the journal entry number, audit trail code, source document number and the transaction date on company1 and company2.
2 days ago I have been asked to add the company3 to this smartlist.
I did it and granted the select on this view and added it to the smartlist.
But still, the data shown in the smartlist are from company1 and company2.
I thought that I could solve it if I create an SQL view on DYNAMICS DB which is a consolidated report as follows:
SELECT ‘COMPANY1’ AS COMPANY, *
FROM COMPANY1.dbo.AUDIT_TRAIL_CODE
UNION
SELECT ‘COMPANY2’ AS COMPANY, *
FROM COMPANY2.dbo.AUDIT_TRAIL_CODE
UNION
SELECT ‘COMPANY3’ AS COMPANY, *
FROM COMPANY3.dbo.AUDIT_TRAIL_CODE
ALSO I granted the select on this view and added it to the smartlist.
BUT NOW THE SMARTLIST IS RETURNING NOTHING AT ALL!!!
Your help is most appreciated.
Thank you in advance
-Mona
LikeLike
Mona,
There are a number of things that could be going wrong here, but the first thing I would check is whether you get any data in the SmartList when you log into GP as ‘sa’. Second thing would be to try it in all 3 companies…does it return no data in all 3?
-Victoria
LikeLike
Victoria,
You’re a 100% right. I did check the smartlist with the sa user and in the 3 companies… same same… no data returned.
Actually Victoria I think that this may be caused by the the view that I have added for the third company.
because the smartlist only returns data from company1 and company2 when am using each company’s view not the consolidated one that i have created in Dynamics DB.
What else maybe causing this issue?
Thank you Victoria
-Mona
LikeLike
Mona,
Did you create a new SmartList for this or update the existing one? If you updated your existing one, most likely it is pointing to your view in each company. Can you try creating a new SmartList, point it to the Dynamics database and make sure the Use Company Database is unchecked?
-Victoria
LikeLike
Victoria,
This is the solution 🙂
I was actually updating the existing one.
I deleted it then created a new one and it worked!!
Thank you very much
Regards
-Mona
LikeLike
Mona,
Excellent! I have seen that happen quite a bit, where updating existing SmartLists just does not work how you think it will. I always test with a new one when making major changes like this. Glad you’ve got it working now. 🙂
-Victoria
LikeLike
Hi Victoria,
I created a SLB from a view and can see it only as sa and not as any other user even though their setup as POWERUSER and the task for the Smartlist object permissions is assigned. Do you have any suggestions?
thanks,
Cal
LikeLike
Cal,
Did you grant permissions on your view to DYNGRP in SQL?
-Victoria
LikeLike
Thanks Victoria, that worked. I gave permissions to the sub-views as well. Does this mean I need to do this each time I create a new view?
LikeLike
Cal,
Yes, DYNGRP needs to be granted permissions to any new SQL object that you want to use in GP.
-Victoria
LikeLike
Hi Victoria
I was able upload my SQL View with in Smartlist Builder and the report looks good. However, I now need to add a few more rows to my SQL query and thus update the Smartlist that is now in GP10.0. Can the SQL view that was uploaded in the GP be modified?
LikeLike
Hi Erica,
Mariano Gomez has a blog post going through the steps of updating your SQL view as well as updating your SmartList: http://dynamicsgpblogster.blogspot.com/2009/01/changing-sql-server-views-for-smartlist.html.
-Victoria
LikeLike
Hi Victoria,
I’m learning more and have enjoyed you site. It is of great help.
I’m using Smartlist Builder and trying to link the GL00201 table with the GL11110 table to create an actual vs. budget GL Smartlist. The issue is if there is data only appears if data exists in both tables for a GL Account for a specific period.
Would this require a SQL view to do this, or is there anyway around this using Smartlist Builder.
Your help is much appreciated,
Gerry
LikeLike
Hi Gerry,
When you’re linking the tables, are you using left join on the ACTINDX? If so, and it’s still not working, then you will most likely need to create a view in SQL first, then use that in SmartList Builder.
-Victoria
LikeLike
I admire the work you did and posted in the website. You saved me several times. 🙂
Sorry if you have answered this before:
Where can I find the list of all smart builber report names with folder nams in the tables structure
Thanks,
LikeLike
Thanks Sameer,
SmartList Builder SmartLists are in table SLB10000.
-Victoria
LikeLike
Hi Victoria,
Do you have a list of all the common tables used on Extender; which one stores the Extender definition and which store the actual data?
I find that the Import/Export function for extender only covers limited type, e.g. Forms, Windows etc but not other type such as View, Import, Menu etc.
I had multiple databases created in a server and require to duplicte the Extender definition done from 1 master database to the rest of the databases. Since the import/export function does not covers all, I had resorted to using SQL integration services to copy files to the other databases. I would like to copy only the definition files and not the data files.
Appreciate your kind advise.
May
Thanks
LikeLike
Hi May,
I don’t have a list of Extender tables published. I would look at all the tables starting with EXT4 – those are the setup tables.
-Victoria
LikeLike
Thanks a lot for putting up this.
LikeLike
Victoria – GP9 Sp3
I have a smartlist that was created using some views. We have a number of test companies and it seems that one of the views was linked by using one of the test companies in view selection, instead of live. How can I change this to point to live as opposed to the test company?
As long as the view exists in live, is it as simple as exporting, replacing the database name in the xml file ( In the section ‘SQL Database Name’) and then re-importing?
Issues that occur because of this are:
If updating field names, have to replicate in test company as opposed to just live;
If adding fields, again, have to do in test as opposed to live;
If we removed the test company for any reason what repurcussions would there be on the smartlist.
Help is always appreciated.
Stu
LikeLike
Stu,
It’s a little difficult to advise on this without seeing the exact setup of this as there are so many components that all need to work together. In general what I typically recommend is that all SmartLists are created with the Use Company Database checkbox selected – that way they will work in all companies and you don’t have to go crazy when you restore a current copy of live database over the test database.
You could try making sure your view exists in the live company, granting security access to the live company view in SLB and then modifying your SmartList to have Use Company Database selected. This didn’t use to work very well in older versions of SLB, but I believe it should work in 9.0 SP3. If not, you could also try your method, but I am not sure that would work, I have not done that on the same server, only when ‘moving’ a SmartList from one server to another.
-Victoria
LikeLike
Hi Victoria
Take a look at the URL of my blog where I have posted an article on Smartlist Security.
http://cvakumar.com/msdynamics/2008/12/23/smartlist-builder-objects-using-sql-tables-and-views/
This was created after I had this discussion with Mariano on his blog article Smartlist Builder Security for SQL Server Views.
You can add this URL to your list as well. 🙂
Regards
Siva
LikeLike
Siva,
Thanks! Link is added. 🙂
-Victoria
LikeLike