Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Super Contributor
Posts: 20
Registered: ‎10-10-2012
Accepted Solution

Populating selected contact's address at the Activity Schedule notes

While working on a request I am trying to populate the address of the contact, selected in the activity screen whenever “atAppointment” activity is being created.

 

Any pointers on how to go this ?

 

Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: Populating selected contact's address at the Activity Schedule notes

1. Add the control's to hold the address data.

2. On the Load of the form run a C# code snippet to get an iQuery\iRepository return of the Contact's primary address (I googled SalesLogix Web iQuery code to figure out how to get the data back from the database. Populate the control's.

3. On a contact change, run the same C# code snippet as #2.

RJ Samp
Copper Super Contributor
Posts: 20
Registered: ‎10-10-2012

Re: Populating selected contact's address at the Activity Schedule notes

Thanks for suggestions @RJSamp, I ended up something similiar at the on form bound to append addresses.

 

if (Activity.Type == ActivityType.atAppointment )
{

string notes = Notes.Text;
if (!ContactId.Text.IsNullOrWhiteSpace())
{
int addStart = notes.IndexOf("^^^ Address (Below space Reserved for Contact Address only please add notes above) ^^^");

if (addStart >=0 ) Notes.Text = notes.Substring(0, addStart);

try
{
RepositoryHelper<Sage.Entity.Interfaces.IAddress> repository = EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAddress>();
Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
criteria.Add(repository.EF.Eq("EntityId", Activity.ContactId));

IAddress address = criteria.List<Sage.Entity.Interfaces.IAddress>()[0];
Notes.Text += "\n \n ^^^ Address (Below space Reserved for Contact Address only please add notes above) ^^^" + Environment.NewLine;
Notes.Text += Environment.NewLine + address.FullAddress;
Notes.Text += "\n \n ##### End Notes - Information below this line will be deleted after Save #####";
}
catch { }
}
}