Hello, we are looking to find a way to add new fields to saved searches without having to go in and change the source code. Let me describe what we are thinking.
Let's say we have a routine that gets saved search fields and inserts them into a database for EDI transmission, or export to a data warehouse. So traditionally this will get coded like this:
CustomerClass cust = new CustomerClass();
cust.NsCompanyName = customer.basic.altName[0].searchValue;
cust.CustomerNsInternalID = customer.basic.internalId[0].searchValue.internalId;
cust.NsCustomerCode = "X"; // just a constant
What we are thinking is to store the property names and values in a database table and maintain the fields to look for there (again, do not have to alter the source code). The property names would go in like this:
| Field Name to Map | NS Property and Value |
| NsCompanyName | altName |
| CustomerNsInternalID | internalID |
The only way to accomplish this appears to use reflection. But getting errors when I do it like this:
Type t = customer.basic.GetType();
Object field = t.GetProperty("altName").GetValue(customer, null); // altName will be replaced with the result from the database table.A lot of the documentation on Google point to the above being pretty-much correct (I've also tried other derivatives). Surely the API can support this. So I thought I would try this forum to see if:
1) Help to get this to work
2) Any other ideas?