如何为销售人员字段制作公式字段?
How to make formula field for salesforce field?
我正在尝试为 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
小道总是一个好的开始。我建议 Use Formula Fields and Advanced Formulas.
关于 Formula Operators and Functions 的文档页面也可能有用。
请记住,您必须使用字段 API 名称,而不是标签,因此它是 Company__c
。
如果 Company__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__c
是您应该使用 ISPICKVAL(picklist_field, literal_value)
的选项列表字段,那么公式将是:
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', '')
)
)
)
)
我正在尝试为 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
小道总是一个好的开始。我建议 Use Formula Fields and Advanced Formulas.
关于 Formula Operators and Functions 的文档页面也可能有用。
请记住,您必须使用字段 API 名称,而不是标签,因此它是 Company__c
。
如果 Company__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__c
是您应该使用 ISPICKVAL(picklist_field, literal_value)
的选项列表字段,那么公式将是:
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', '')
)
)
)
)