Hi Guys, If I have two objects that are not directly related, how can I create a trigger that pulls a string from one into the other. In the attached diagram, I want to pull the broker code into the application object (either with a formula field, or trigger). In other words, the formula will be saying 'give me the broker code from the broker credentials object where lender is application.lender and broker is application.broker.
If you create related field BrokerCode on Lender object you can than use that field's value to populate text field on Application object.
Hope that will help.
Hi Pavel,
This can't be done, because there is Many credentials for each lender. Similarly, it can't be done on the broker object either, since there is many credentials per broker (one for each lender).
To get the broker code, you need to be able to select the row from the credentials table where the lender is equal to the lender for the application AND the broker is equal to the broker for the application.
The broker credentials table would contain data like this:
ANZ Matt 542125
CBA Matt 548899
ANZ Linda 447788
CBA Linda 558774
Than you can try out Query API, which can be used in formulas (including triggers):
rbv_api.selectValue(query);
SELECT BrokerCode FROM BrokerCerdentials WHERE Lender=... AND Broker=...
{!id}inside query to make it useful.