I have written a formula field of data type DATETIME and return type text

IF((ISPICKVAL(Status, 'Completed')),NOW(),'')

but error occurred states

Error: Incorrect parameter type for function 'IF()'. Expected DateTime, received Text


return type of your formula field is Text, that is why you have to return Text types in both results: true and false of IF formula. Add TEXT formula for returned NOW()

IF(ISPICKVAL(Status, 'Completed'), TEXT(NOW()), null)

returned result of TEXT(NOW()) is in GMT time

| improve this answer | |
  • I tried it too but got Error: Formula result is data type (DateTime), incompatible with expected data type (Text). – Swathi Feb 4 '19 at 13:31
  • @Swathi I have updated my answer, try it. – Oleksandr Berehovskyi Feb 4 '19 at 13:35
  • Get rid of the extra parentheses. They seem to be screwing you up too. I think you close your IF early. – Adrian Larson Feb 4 '19 at 13:37
  • Thanks! it worked but the time is getting wrong. Not showing current time – Swathi Feb 4 '19 at 13:40
  • @Swathi it is showing correct GMT – Oleksandr Berehovskyi Feb 4 '19 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.