Interesting fact about Values () collection:

By | March 23, 2009

Let’s consider the case of creating new opportunity as an example.

Consider that you want to set value of oppo_description field based on oppo_type field i.e. say you want to set description field to “Hello World” if oppo_type is set to parts.

Now normally what comes in our head to incorporate this is something like, we will write the below given code on CreateScript of oppo_Description field.

lc_type = (Values(‘oppo_type’))
if (lc_type == ‘Parts’)
{
DefaultValue=”Hello World”
}
Errorstr= lc_type

Usually there is nothing wrong with this code as far as the logic is concerned, but the thing is you can use Values() collection only if the record already exists i.e. you can use them on summary screens but cannot on New Entry screens. So for the above requirement we can write a below code in CreateScript box of Opportunity Detail Screen.