If statement 如何为salesforce字段创建公式字段?

If statement 如何为salesforce字段创建公式字段?,if-statement,salesforce,crm,If Statement,Salesforce,Crm,我正在尝试为salesforce字段创建公式字段。条件如下所示 if Company = "WIL" And (ShippingCountry = "United States" Or "USA") then "US" elseif Company = "WST" And (ShippingCountry = "United States" Or "US&quo

我正在尝试为salesforce字段创建公式字段。条件如下所示

if Company = "WIL" And (ShippingCountry = "United States" Or "USA") then
   "US"
elseif Company = "WST" And (ShippingCountry = "United States" Or "US") then
   "USA"
elseif ShippingCountry <> "" then
   ShippingCountry
elseif Company = "WIL" then
   "US"
elseif Company = "WST" then
   "USA"
else
   ""
end if
如果Company=“WIL”和(ShippingCountry=“美国”或“美国”),则
“美国”
elseif Company=“WST”和(ShippingCountry=“美国”或“美国”),然后
“美国”
如果是“国家”的话
船运国
elseif Company=“WIL”则
“美国”
elseif Company=“WST”则
“美国”
其他的
""
如果结束

火车头总是一个好的开始。我建议和。
关于的文档页面可能也很有用

请记住,您必须使用字段API名称,而不是标签,因此它是
Company\uuu c

如果
公司\uuuu c
不是选择列表字段:

IF( AND(Company__c = 'WIL', OR(ShippingCountry = 'United States', ShippingCountry = 'USA')),
    'US',
    IF( AND(Company__c = 'WST', OR(ShippingCountry = 'United States', ShippingCountry = 'US')),
        'USA',
        IF( NOT( ISBLANK(ShippingCountry) ),
            ShippingCountry,
            IF( Company__c = 'WIL',
                'US',
                IF(Company__c = 'WST', 'USA', '') 
            ) 
        ) 
    ) 
)
如果
Company\uu c
是一个选择列表字段,则应使用
ISPICKVAL(选择列表字段,文字值)
,因此公式为:

IF( AND( ISPICKVAL(Company__c, 'WIL'), OR(ShippingCountry = 'United States', ShippingCountry = 'USA')),
    'US',
    IF( AND(ISPICKVAL(Company__c, 'WST'), OR(ShippingCountry = 'United States', ShippingCountry = 'US')),
        'USA',
        IF( NOT( ISBLANK(ShippingCountry) ),
            ShippingCountry,
            IF( ISPICKVAL(Company__c, 'WIL'),
                'US',
                IF( ISPICKVAL(Company__c, 'WST'), 'USA', '') 
            ) 
        ) 
    ) 
)

你能提供更多的细节吗?你面临什么问题?如果字段编辑器提示错误,请将其添加到帖子中。@RubenDG我正在使用Salesforce crm。我正在为帐户对象创建新的公式字段,这是用于生成公式字段的条件谢谢您的回答@RubenDG