Monday, July 20, 2009

How to dynamically retrieve a company's name in Dynamics GP

So I had to build reports for a company and then make it generic so we could resell it to anybody. Well a big problem we had was how to get the company's name on the report without asking them for it. Well here's the trick:

SELECT DYNAMICS..Sy01500.CMPNYNAM FROM DYNAMICS..Sy01500
WHERE Dynamics..Sy01500.INTERID = (SELECT db_name())

This works because Dynamics stores the company's database name, which you can reference to get to the company's formal name.

No comments:

Post a Comment

There was an error in this gadget