How do I convert "Account" in to
<Account>
or "Object Name" into
<Object with matching name>
I'm attempting to parse a string and replace values in a string with object properties.
This is similar to what we do with form letters we send out, you know the Dear [Customer Name], thank you for purchasing [Some Item]. In this case the fields in the letter aren't setup by me and I need a means of converting what is in the text block into an object property.
Currently I'm using a code in the string {value=x; id=y ;property=z} and running that through a switch case to convert it into an object. Then replacing the {} with the object properties.
for example "some random string {value=1; id=1; property=Name} continued random string"
I parse the string to locate {value=, on a hit it runs through a switch case, where on case 1: return Account(ID = 1). The I grab Account.Name
Once I have that I put it in a text box so the user can validate that it is correct before generating a final document to be sent out.
Is there a way to have {Object.Property} in the string then use reflection to convert that string value to the object value?
Get property value from string using reflection
I used the above in other instances, but that requires that I have the object.