Community
Showing results for 
Search instead for 
Do you mean 
Reply

returning a list of Users in a new form.

Copper Contributor
Posts: 61
Country: United_Kingdom

returning a list of Users in a new form.

[ Edited ]

Hi,

 

I'm trying to return a list of users FullName in one of my own forms. Here's the code I'm using

 

ContactList oContacts;

oContacts = application.ActFramework.Contacts.GetContactsUsers(null);
foreach (Act.Framework.Contacts.Contact oContact in oContacts)
{
MessageBox.Show(oContact.FullName);
}

 

When I put this code in the AfterLogin event it works perfectly fine. However, If I attempt to execute after opening my form (from a custom menu item) I get an "object reference not set" error.

 

Debugging shows the oContact.FullName is returning null but I can't see why.

 

Does anyone have a solution?

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: returning a list of Users in a new form.

The fullname value can be NULL because no value was ever entered into that record. Same is true for other fields on the contact record. You need to check for NULL before using it.

 

Hope this helps

-- Jim Durkin