Profile Management

Discussions related to order tracking development with the ProForm module.

Moderator: Phil Barton

Post Reply
danny.little
Posts: 21
Joined: Fri May 14, 2010 10:18 am

Profile Management

Post by danny.little »

How do I get the Owning Profile of an order. I can get the guid and the path but i need the whole profile to get Cost Center and information from the Profile itself. I have done the following and keep getting NULL reference.

Code: Select all

ProfileManagement pm = GetService<ProfileManagement>();
Thanks
Danny Little
Pradeepa
Posts: 37
Joined: Fri Oct 03, 2008 1:22 pm

Re: Profile Management

Post by Pradeepa »

Can you try this?

ProfileManagement pm = SelectServer.GetService<ProfileManagement>();
IProfile profile = pm.FindProfile(profilePath);

Thanks,
Pradeepa.
Pradeepa Chandramohan
Software Engineer
SoftPro
danny.little
Posts: 21
Joined: Fri May 14, 2010 10:18 am

Re: Profile Management

Post by danny.little »

Pradeepa wrote:Can you try this?

ProfileManagement pm = SelectServer.GetService<ProfileManagement>();
IProfile profile = pm.FindProfile(profilePath);

Thanks,
Pradeepa.
SelectServer is a class, and has no GetService method. Am I missing a reference. I am in a MyPackage created from Visual Studio 2008.
Thanks
Danny Little
danny.little
Posts: 21
Joined: Fri May 14, 2010 10:18 am

Re: Profile Management

Post by danny.little »

Found a resolution by seeing another thread. If anyone else is having this issue. I do not understand what the difference is instead of passing the typeof? As stated above this is in a Package. Beats me, but found resolution.

Code: Select all

            IOrder order = GetActiveOrder();
            SoftPro.Select.Client.SelectServer sps = GetService(typeof(SoftPro.Select.Client.SelectServer)) as SoftPro.Select.Client.SelectServer;
            ProfileManagement pm = sps.GetService(typeof(ProfileManagement)) as ProfileManagement;
            IProfile profile = pm.FindProfile(order.OwningProfilePath);
Thanks
Danny Little
Mark McKenna

Re: Profile Management

Post by Mark McKenna »

Hi Danny,

There is no real difference between the generic and non-generic versions of GetService. Internally, the generic version merely routes to the non-generic version and casts the type appropriately for you.

If you look closely at your two code snippets, there is an important distinction that explains why the last attempt worked. The package provides access to a registered SelectServer service object, not a ProfileManagement object. Through the SelectServer object, then, you can get to the ProfileManagement service object which was registered with it.

Hope that helps.
Post Reply