Page 2 of 2

Re: Select Database Questions

Posted: Mon Jul 20, 2020 5:49 pm
by bandorganman
Hi, In creating an order, how do I enter multiple contacts of the same type? For example:

o.Contacts.ContactType = "Attorney";
o.Contacts.Name = ms.ATTYNAME;

Now I want to enter a second attorney without overwriting the first. How do I do this? Same for buyers, sellers, banks etc.

Re: Select Database Questions

Posted: Mon Jul 20, 2020 9:13 pm
by BobRichards
If the contact is already part of the order, you can get it from from the order and modify it's properties. In this case I'm modifying the first existing Settlement Agent.

Code: Select all

// Modify existing Settlement Agent (must exist!)
IList agents = (IList)order.GetProperty("SettlementAgents");
IOrderItem agent = (IOrderItem)agents[0];
agent.SetProperty("Name", "The Settlement Agency");
// Modify any other properties.
You can create a new contact by getting an empty one from the order and set it's properties - we'll create another Settlement Agent. It is very important that you add new items to the appropriate collection ("Contacts" in these examples) before setting any properties. Default internal order rules may not run if this is not done.

Code: Select all

// Create a new Settlement Agent and provide all properties.
IList contacts = (IList)order.GetProperty("Contacts");
IOrderItem newSA = order.CreateNew("SettlementAgent");
// Always add new contact to Contacts before writing to properties (not to SettlementAgents, etc)!
contacts.Add(newSA);
// Now set properties.
newSA.SetProperty("Name", "The Settlement Agency 2");
Another way to create a new contact is to create the base type then use a lookup table to populate the previously saved information. This is excellent for often used and company contacts. All you have to is set the LookupCode property.

Code: Select all

// Create a new Settlement Agent and populate is with Lookup Table information.
IOrderItem lookupSA = order.CreateNew("SettlementAgent");
// Always add new contact to Contacts before writing to properties (not to SettlementAgents, etc)!
contacts.Add(lookupSA);
// Now set properties.
lookupSA.SetProperty("LookupCode", "ATA-70-02");
Finally, you can get a list of all contact types that can be created by searching on "ContactType" in the SoftPro Select SDK Documentation installed in your system. You can create all types EXCEPT "AllBuyers" and "AllSellers".

Re: Select Database Questions

Posted: Mon Jul 20, 2020 9:23 pm
by BobRichards
Also, please create a new topic when you are addressing different questions. It makes it easier to search on in the "Search..." box when others look for help.

Thanks! :D

Re: Select Database Questions

Posted: Tue Jul 21, 2020 9:30 am
by bandorganman
Thanks, Bob! I will start a new post in the future.