salesforce自定义字段用例

时间:2015-09-10 03:16:48

标签: salesforce custom-field-type

在Salesforce中,我想在Contact中创建一个名为“Chapter”的自定义字段,该字段引用其他2个字段(State和Country'自动填充自身。类似于SQL中的案例

e.g。

‘Chapter' = 
    CASE
       When country = 'Aus' and state in ('NSW', 'ACT') then 'NSW / ACT` 
       When country = 'Aus' and state in ('VIC', 'TAS') then 'VIC / TAS`
       When country = 'Aus' and state in ('SA', 'NT') then 'SA / NT`
       When country = 'Aus' and state in ('WA, 'QLD') then 'WA/QLD'
       When country = 'NZ' then 'NZ'
       When country not in ('Aus', NZ) then 'INT'
    END

我假设我在创建字段时使用公式数据类型但是我似乎无法编写公式。

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。这是一个使用IF公式的自定义字段

F(Country = "Aus" && State = "NSW" , "NSW/ACT", 
IF(Country = "Aus" && State = "ACT" , "NSW/ACT", 
IF(Country = "Aus" && State = "TAS" , "VIC/TAS", 
IF(Country = "Aus" && State = "VIC" , "VIC/TAS", 
IF(Country = "Aus" && State = "SA" , "SA/NT", 
IF(Country = "Aus" && State = "NT" , "SA/NT", 
IF(Country = "Aus" && State = "WA" , "WA", 
IF(Country = "Aus" && State = "QLD" , "QLD", 
IF(Country = "NZ" , "NZ", 
IF(Country <> "New Zealand" && Country <> "Aus" , "INT", 
""))))))))))