高度な数式【高度な数式を使用してレベルアップ】

[Trailhead関係　個別の課題別 に戻る](https://qiita.com/Keiji_otsubo/items/56eb7a90bb72138ece1f)


+ [Level Up with Advanced Formulas](https://qiita.com/Keiji_otsubo/items/9447184cc49ab2212593)

# Use Basic Logic in Checkbox Formulas

何もしないで検証ボタンをクリック

:::note alert
We can’t find a validation rule named 'Close_Date_Alert'.
:::

```
AND(
NOT(IsClosed),
CloseDate < TODAY()
)
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/e88383e8-2f11-8f11-bdfb-2f8a3e873345.png)


# 1

```
IF( Contribution_Percentage__c <= 0.10, "Low", 
IF( Contribution_Percentage__c > 0.10 && Contribution_Percentage__c < 0.40, "Medium", "High"
))
```

**We submitted an opportunity and expected the Contribution Level to be Low, but it wasn't. Check your formula in the 'Contribution Level' field.**

[Level up with advanced formula](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000IQfTv)

Thanks for all the support. Issues resolved by changing the following: LOW to Low MEDIUM to Medium HIGH to High Appreciate

# Use Text Formulas

+ 何もしないで確認ボタンを押した時

**We can’t find the 'Lead_Quality_Helper__c' field in the Lead object.**

+ Lead Quality Helperだけを作った場合 または間違った数式にした場合

**We can’t find the 'Lead_Quality__c' field in the Lead object.**

+ Lead Quality Helperの数式を間違ったままにして、Lead Qualityを作成した場合

**We created a new lead with a value for company, but not email, phone, title, or industry. We expected it to have the '1 star' image but it didn't. If you use a CASE() function, make sure it’s positioned outside the IMAGE() function.**

+ Lead Quality Helperの数式を正しいものにして、わざとLead Qualityの数式を変えた場合

なんかこのエラーメッセージは逆ではないですかね？　多分バグだろう。

**We created a new lead with a value for company, but not email, phone, title, or industry. We expected it to have the '1 star' image but it didn't. Consider using this structure to build your formula: IF(ISBLANK(Email), 0, 1) + IF(ISBLANK(Phone), 0, 1), and so on.**

For the Lead Quality Helper to work:  

```
IF(ISBLANK(Email), 0, 1) + 
IF(ISBLANK(Phone), 0, 1) + 
IF(ISBLANK(Company), 0, 1) + 
IF(ISBLANK(Title), 0, 1) + 
IF(ISBLANK(TEXT(Industry))), 0 ,1)  
```

For the Lead Quality to use the values correctly from the helper, the IMAGE needs to be inside the CASE instead of the example in the lecture: 

```
CASE(Lead_Quality_Helper__c, 
0, IMAGE("/img/samples/stars_000.gif","0 stars"), 
1, IMAGE("/img/samples/stars_100.gif", "1 star"), 
2, IMAGE("/img/samples/stars_200.gif", "2 stars"), 
3, IMAGE("/img/samples/stars_300.gif", "3 stars"), 
4, IMAGE("/img/samples/stars_400.gif", "4 stars"), 
5, IMAGE("/img/samples/stars_500.gif", "5 stars"), 
"Unknown")
```

+ [We created a new lead with a value for company, but not email, phone, title, or industry. We expected it to have the '1 star' image but it didn't. If you use a CASE() function, make sure it’s positioned outside the IMAGE() function.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007GIKK5)

+ [Advanced Formulas > Use Text Formulas](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000HDlCgSAL)
上記設定を行ってもエラーになる場合は、以前のチャレンジの設定が残っているためだと考えられます。
Countryフィールドの検証ルールが必要です。次に、必須フィールドではなく国をオプションにする方法を見つけました。

+ [We created a new lead with a value for company, but not email, phone, title, or industry. We expected it to have the '1 star' image but it didn't. If you use a CASE() function, make sure it’s positioned outside the IMAGE() function.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007GIKK5)

:::note
I had the same message, even though my formula was written correctly.

It turned out that on the Lead object I had some validation rule from some previous task, which forced the email or phone fields to be populated, and I guess that's where Check Challenge crashed. I deleted it and then the challenge has been completed.
:::


+ [We created a new lead with a value for company, but not email, phone, title, or industry. We expected it to have the '1 star' image but it didn't. If you use a CASE() function, make sure it’s](https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000FXoza)

+ [Hi I have encountered with following error on #Use Text Formulas Module. Please help me resolve it...](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007URRMc)

:::note
I believe there is no issue with my formulae. This is how I fixed. Thank you

Deactivate VALIDATION RULE for the LEAD object, if so just uncheck the ACTIVE checkbox and try the challenge.
:::


# 回答例

+ [高度な数式　【テキスト数式の使用】が分からない](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000HDcRUSA1)

# 何故か成功しない

+ [【解決】The ‘Cylinder_Volume__c’ field in the Opportunity object doesn't have a valid formula error on advanced formula module](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000K0eXG)

:::note
I think the formula is fine.
It might be a good idea to try using a new playground.

https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000J8PGj
:::

+ [The ‘Cylinder_Volume__c’ field in the Opportunity object doesn't have a valid formula. ](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000J8PGj)
+ [The ‘Cylinder_Volume__c’ field in the Opportunity object doesn't have a valid formula.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000K1ETW)


# We expected the validation rule to prevent creating an opportunity with yesterday as the CloseDate, but it didn’t. Make sure the validation rule fires when CloseDate is before today.

+ [Validation Rule error during trailhead module](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000O9njQ)

:::note
I deleted the "discount percentage" field in the "opportunity" object and finally it worked after 2 days... 

I had the same issue and I changed the Discount Percent field to be not required and then it worked fine.  

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000E99zOSAR
:::


# We created an opportunity with radius and height values. We expected the 'Cylinder_Volume__c' field to show the correct cylinder volume, but it didn’t. Make sure that your formula uses the correct calculation for the volume of a cylinder, and that radius x radius is enclosed in parentheses.

+ [I have issue on Opportunity object where all Challengers got fail pass even If I did it correct ? Please help me fix my playground..](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007UQIR4)

:::note
You can try this as stated below:

go to: object manager > opportunity > fileds and relationships > discount percent > click on Edit and then remove the "REQUIRED" checkbox under general options, 

Formula Used in the Cylinder__Volume field is: ROUND((radius__c * radius__c) * height__c,0)* 3.14159

and Finally You will be able to complete the challenge.

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A9CfsSAF
:::