In the SalesLogix 7.2 Customer Portal, you might have the need to get or set values from the user’s contact record. While the user is actually a contact, in the portal, the SLXUserService is still used to get the logged in user. However, you’ll need to translate it to an WebPortalUserService to be able retrieve the IContact reference to work with the underlying contact record.
Using the following code, you can retrieve the contact record for the logged in customer (in the customer portal):
using Sage.SalesLogix.Security; // for SLXUserService using Sage.Platform.Security; // for IUserService using Sage.Platform.Application; //for ApplicationContext using Sage.SalesLogix.Web; // for WebPortalUserService using Sage.Entity.Interfaces; //for IContact //... SLXUserService service = ApplicationContext.Current.Services.Get<IUserService>(true) as SLXUserService; if (service is WebPortalUserService) { WebPortalUserService portalservice = (WebPortalUserService)service; IContact contact = portalservice.GetPortalUser().Contact; // now do what is needed with the contact string whatever = contact.Something; }
Once you have the contact, you can do whatever is needed to read or write values to it.



