Answer of this question I am sure is going to be a surprise for some of you.
The Question is as following.
Can we do a SetFieldValue on a Calculated Field?
Please answer the above poll before going afer the answer part.
Answer of the question is: YES
I know some of you will straight away say this is ridiculous and dismiss the answer as I would have done few days ago.
But the answer is not a straight YES. You can do a set field value provided you fulfil some conditions.
Conditions under which you can use SetFieldValue on a calculated field are as following.
- There should be a Pick Map defined on that calculated field.
- There should be a picklist defined on that calculated field
Then a SetFieldValue results in picking of the value which you are trying to set in case if the value doesn’t exist in that picklist then you will get an error.
I hope this post must have resulted in learning something new for you.