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.
Select Database Questions
Moderator: Phil Barton
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Select Database Questions
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.
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.
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.
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".
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.
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");
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");
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Select Database Questions
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!
Thanks!
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 68
- Joined: Tue Mar 03, 2020 5:23 pm
Re: Select Database Questions
Thanks, Bob! I will start a new post in the future.