If I understand what you need, the Rules module can be very useful in such tasks. All you have to do is create a condition according to the type of content you want and have an action that sets the value. Setting a value can be done using static Token values ββor even PHP code.
Here is a screencast with the basics of the rules.
source share