You need to sign in to do that
Don't have an account?
Maurizio Berti
Trailhead exercise with formulas
Exercise:
"Your company sells cylindrical hyperbaric chambers. You need a formula field that calculates the volume of a cylinder for you, rounded to the nearest whole number, given its radius and height. Use the existing mathematical formula for the volume of a cylinder, V = πr2h, where r is the radius of the cylinder, h is the height, and π is the constant Pi. Note: Although this formula field might best be created on a custom object, for simplicity, we’ll create this formula on the Opportunity object.
Create 2 custom fields of type Number on the Opportunity object: ‘radius’ with a resulting API name of ‘radius__c’ and ‘height’ with a resulting API name of ‘height__c’.
The formula should be named ‘Cylinder Volume’, with the resulting API name ‘Cylinder_Volume__c‘ and should be created on the Opportunity object.
The formula should reference the custom fields ‘radius__c‘ and ‘height__c‘.
The formula should use 3.14159 as an approximation of Pi."
The error: "Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]"
I created 2 custom fields named radius and height, plus a custome field named Cylinder Volume into Opportunities Object. The formula I inseted into Cylinder Volume field is "ROUND(3.14159* radius__c * EXP(2) * height__c,0)".
If I test it, inserting in the opportunity form the radius and height values, It works correctly but when I try to pass the challenge I receive the message above. I don't know why it refer to Discount_Percent__C fields.
Please Help me!!!
"Your company sells cylindrical hyperbaric chambers. You need a formula field that calculates the volume of a cylinder for you, rounded to the nearest whole number, given its radius and height. Use the existing mathematical formula for the volume of a cylinder, V = πr2h, where r is the radius of the cylinder, h is the height, and π is the constant Pi. Note: Although this formula field might best be created on a custom object, for simplicity, we’ll create this formula on the Opportunity object.
Create 2 custom fields of type Number on the Opportunity object: ‘radius’ with a resulting API name of ‘radius__c’ and ‘height’ with a resulting API name of ‘height__c’.
The formula should be named ‘Cylinder Volume’, with the resulting API name ‘Cylinder_Volume__c‘ and should be created on the Opportunity object.
The formula should reference the custom fields ‘radius__c‘ and ‘height__c‘.
The formula should use 3.14159 as an approximation of Pi."
The error: "Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]"
I created 2 custom fields named radius and height, plus a custome field named Cylinder Volume into Opportunities Object. The formula I inseted into Cylinder Volume field is "ROUND(3.14159* radius__c * EXP(2) * height__c,0)".
If I test it, inserting in the opportunity form the radius and height values, It works correctly but when I try to pass the challenge I receive the message above. I don't know why it refer to Discount_Percent__C fields.
Please Help me!!!
1) https://developer.salesforce.com/forums/?id=906F0000000MIqmIAG
Make sure you are returning 0 for the decimal places. or
It looks like you have a required field already on the Opportunity object that is preventing the test from running successfully. Any way you could remove or make that field not required? Or possibly use a brand new developer org as a last resort.
https://developer.salesforce.com/forums/?id=906F0000000MIy7IAG
Let us know if this will help you
I just had the same problem for about 20 minutes. Go into your custom Discount Percent field (Discount_Percent__c) and uncheck the box that says, "Always require a value in this field in order to save a record". That should take care of that particular error message for you.
Good luck!
Eli
Thanks Eli!