如何確認一個field是不是空值
在Formula方面:
請使用ISBLANK 而不要用ISNULL
- ISBLANK可以處理ISNULL適用的所有情況
- 但ISNULL對於Text和Multi-select picklist不適用(這兩者永遠都不會是null)
在Apex Class/Apex Trigger方面:
- isBlank(inputString)
Returns true if the specified String is white space, empty (''), or null; otherwise, returns false. - isEmpty(inputString)
Returns true if the specified String is empty ('') or null; otherwise, returns false. - isNotBlank(inputString)
Returns true if the specified String is not whitespace, not empty (''), and not null; otherwise, returns false. - isNotEmpty(inputString)
Returns true if the specified String is not empty ('') and not null; otherwise, returns false.
簡單來說,blank有包含空白字元的情況。如果該字串裡只有一堆空格,則isBlank會是TRUE,但對isEmpty來說是FALSE。
留言
張貼留言