【问题标题】:How to make formula field for salesforce field?如何为销售人员字段制作公式字段?
【发布时间】:2021-04-18 02:50:27
【问题描述】:

我正在尝试为 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

【问题讨论】:

  • 能否提供更多细节?您面临哪些问题?如果字段编辑器提示错误,请将其添加到帖子中。
  • @RubenDG 我正在使用 Salesforce crm。我为帐户对象创建了新的公式字段,这是用于制作公式字段的条件

标签: if-statement salesforce crm


【解决方案1】:

小径总是一个好的开始。我建议Use Formula FieldsAdvanced 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', '') 
            ) 
        ) 
    ) 
)

【讨论】:

  • 感谢您的回答@RubenDG
猜你喜欢
  • 1970-01-01
  • 2022-06-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-06
  • 1970-01-01
  • 1970-01-01
  • 2013-01-30
相关资源
最近更新 更多