You need to sign in to do that
Don't have an account?

Challenge Not yet complete... here's what's wrong: We can't find a page with the name 'SolarBot Status Page With Chart'.
I've been working on this superbadge, near the end I got to this part:
Ada also tells you that the SolarBot Status Averages report needs some tweaks. First, the Support team wants to see trends over time, so they want the report to show data by week instead of by day. Second, they want a graph for this report called Weekly Panel Temperature and kWh that shows average panel temperature and average kilowatt hours as lines over time. Third, they want to see this graph on each SolarBot record page. Create the page and call it SolarBot Status Page With Chart. Include only information about the individual SolarBot in the chart.
What kind of page should I go for? I created a Lightning Record Page, a page layout, and it is not detecting any kind of page
Thanks in advance
Ada also tells you that the SolarBot Status Averages report needs some tweaks. First, the Support team wants to see trends over time, so they want the report to show data by week instead of by day. Second, they want a graph for this report called Weekly Panel Temperature and kWh that shows average panel temperature and average kilowatt hours as lines over time. Third, they want to see this graph on each SolarBot record page. Create the page and call it SolarBot Status Page With Chart. Include only information about the individual SolarBot in the chart.
What kind of page should I go for? I created a Lightning Record Page, a page layout, and it is not detecting any kind of page
Thanks in advance

How to write Validation for URL ?
Hello Salesforce Experts,
Anyone please let me know how to write valition rule for URL ?
Else someone please provide regular expression string for URL ?
Thanks,



A small syntax change.
The following rule worked for me.
if(REGEX(URLfield__c,"^((http|https)://)??(www[.])??([a-zA-Z0-9]|-)+?([.][a-zA-Z0-9(-|/|=|?)??]+?)+?$"),false,true)
Hope this helps.
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.

Challenge Not yet complete... here's what's wrong: The solution for extending access does not have the correct name.
Create and assign the solution providing Shinje access to the Language Preference field. for this what I have to do given to Shinje Tashi user




Please note that Questions about how to pass Trailhead challenges are not on topic, because these challenges are intended to be independent demonstrations of your abilities.
Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.
Please close the thread by selected as Best Answer so that we can keep our community clean
Thanks,
Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.
Please close the thread by selected as Best Answer so that we can keep our community clean
Thanks,
Getting to 100 percent code coverage on my trailhead module “Write Negative Tests Unit”
I seem to be stuck on this trailhead module or write negative tests unit, while I have 93 percent code coverage, I can't seem to get the code coverage to hit 100 percent at the "returnValue" piece doesn't seem to hit.
My code is as follows.
Calculator Class
And my test class as follows
My code is as follows.
Calculator Class
public class Calculator { public class CalculatorException extends Exception{} public static Integer addition(Integer a, Integer b){ return a + b; } public static Integer subtraction(Integer a, Integer b){ return a - b; } public static Integer multiply(Integer a, Integer b){ if(b==0 || a==0){ throw new CalculatorException('It doesn\'t make sense to multiply by zero'); } return a * b; } public static Decimal divide(Integer numerator, Integer denominator){ if(denominator == 0){ throw new CalculatorException('you still can\'t divide by zero'); } Decimal returnValue = numerator / denominator; if(returnValue < 0){ throw new CalculatorException('Division returned a negative value.' + returnValue); } return returnValue; } }
And my test class as follows
@isTest public class Calculator_Tests { @isTest public static void addition() { Calculator.addition(1, 0); } @isTest public static void subtraction() { Calculator.subtraction(1, 0); } @isTest public static void divide_throws_exception_for_division_by_zero() { Boolean caught = false; try { Calculator.divide(1, 0); } catch (Calculator.CalculatorException e) { System.assertEquals('you still can\'t divide by zero', e.getMessage(), 'caught the right exception'); caught = true; } System.assert(caught, 'threw expected exception'); } @isTest public static void divide_throws_exception_for_division_by_two() { Boolean caught = true; try { Calculator.divide(1, 2); } catch (Calculator.CalculatorException e) { System.assertEquals('you still can\'t divide by zero', e.getMessage(), 'caught the right exception'); caught = true; } System.assert(caught, 'threw expected exception'); } @isTest public static void multiply_by_one() { Boolean caught = false; try { Calculator.multiply(1, 0); } catch (Calculator.CalculatorException e) { System.assertEquals('It doesn\'t make sense to multiply by zero', e.getMessage(), 'caught the right exception'); caught = true; } System.assert(caught, 'threw expected exception'); } @isTest public static void multiply_by_two() { Boolean caught = true; try { Calculator.multiply(1, 2); } catch (Calculator.CalculatorException e) { System.assertEquals('It doesn\'t make sense to multiply by zero', e.getMessage(), 'caught the right exception'); caught = true; } System.assert(caught, 'threw expected exception'); } }


How come a division returned a negative value with positive numbers? I don't think that is the right Scenario.
Infact you can change that not accepting the negative value like this
and add another test method
I hope this will help.
Infact you can change that not accepting the negative value like this
public static Decimal divide(Integer numerator, Integer denominator){ if(denominator == 0){ throw new CalculatorException('you still can\'t divide by zero'); } if(numerator < 0 || denominator < 0) throw new CalculatorException('negative value(s) not allowed.'); Decimal returnValue = numerator / denominator; return returnValue; }
and add another test method
@isTest public static void divide_throws_exception_for_negative_number() { Boolean caught = true; try { Calculator.divide(-1, 2); } catch (Calculator.CalculatorException e) { System.assertEquals('negative value(s) not allowed.',e.getMessage()); caught = true; } System.assert(caught, 'threw expected exception'); }
I hope this will help.

what is the difference between user with 'identity' license and user with 'salesforce' license?
Hiii Everyone,
When we create a user we can create with different licenses. There is salesforce license and there is also a 'Identity' license. Now the thing is that I just want a user that can access my visualforce pages, custom objects and want to perform DML operations with all permissions. Can I create it with identity user license?
I just want to save my salesforce license users, so that i can use them in future...
Thanks in advance... :)
When we create a user we can create with different licenses. There is salesforce license and there is also a 'Identity' license. Now the thing is that I just want a user that can access my visualforce pages, custom objects and want to perform DML operations with all permissions. Can I create it with identity user license?
I just want to save my salesforce license users, so that i can use them in future...
Thanks in advance... :)




Hi Rohit Bhamdare,
Please refer below salesforce help document to know detailed information on salesforce license type.
https://help.salesforce.com/articleView?id=users_license_types_available.htm&type=0&language=en_US
For Identity Implementation guide refer below link.
https://resources.docs.salesforce.com/204/latest/en-us/sfdc/pdf/salesforce_identity_implementation_guide.pdf
Hope this helps you!
Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya
Please refer below salesforce help document to know detailed information on salesforce license type.
https://help.salesforce.com/articleView?id=users_license_types_available.htm&type=0&language=en_US
For Identity Implementation guide refer below link.
https://resources.docs.salesforce.com/204/latest/en-us/sfdc/pdf/salesforce_identity_implementation_guide.pdf
Hope this helps you!
Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya

How to remove comma from Number field
Hi,
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz

Hi Shahab,
Create a new custom field, where type is "formula" and the formula return type is "text".
In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is MyNumber_c then your formula would be: TEXT( MyNumber_c )
Your users will enter values into the existing number field, but you can use the formula field (which doesn't display thousands separators)
And don't forget to mark this answer as best, if answer this helps you :-)
--
Regards,
Grazitti Team
Web: www.grazitti.com
Create a new custom field, where type is "formula" and the formula return type is "text".
In the formula, use the TEXT() function, and pass the existing number field value into this formula. For example, if your number field is MyNumber_c then your formula would be: TEXT( MyNumber_c )
Your users will enter values into the existing number field, but you can use the formula field (which doesn't display thousands separators)
And don't forget to mark this answer as best, if answer this helps you :-)
--
Regards,
Grazitti Team
Web: www.grazitti.com

Don't allow users to personalize nav bar
I want to disable personalize nav bar options for users.

Hi Durgesh,
Please check the Below Options or check the Doc from the Below Link
Kindly Mark this as a Best Answer if you Find this Useful!
Thanks
DineshKumar Gopalakrishnan
Please check the Below Options or check the Doc from the Below Link
- If you don’t want your users to personalize the navigation bar for a specific app, disable personalization. From Setup in Lightning Experience, go to the App Manager. For the desired app, select App Options. Select Disable end user personalization of nav items in this app.
- If you don’t want your users to personalize the navigation bar for any app, disable personalization. From Setup, enter User Interface in the Quick Find box, then select User Interface. Select Disable Navigation Bar Personalization in Lightning Experience. Salesforce recommends disabling navigation personalization by app instead of for the entire org.
Kindly Mark this as a Best Answer if you Find this Useful!
Thanks
DineshKumar Gopalakrishnan

what is MasterLabel in salesforce
Hi Team,
Can you help me in understand what is a masterLabel in saleforce i am having a custom metadata (Support_Tier__mdt)
$CustomMetadata.Support_Tier__mdt.Bronze.MasterLabel.
I am creating a filed on account object i am trying to defalut value as Bronze but didn't undertand the usage of MasterLabel
Thanks,
Vijay.
Can you help me in understand what is a masterLabel in saleforce i am having a custom metadata (Support_Tier__mdt)
$CustomMetadata.Support_Tier__mdt.Bronze.MasterLabel.
I am creating a filed on account object i am trying to defalut value as Bronze but didn't undertand the usage of MasterLabel
Thanks,
Vijay.

Hi Vijay,
Greetings!
MasterLabel will represent the lead status picklist field value while converting a lead to opp or acc or contact. just run this query in the dev console you will get the Id, lead status picklist values.
If you find this helpful mark it as the best answer.
Regards,
Malika Pathak
Greetings!
MasterLabel will represent the lead status picklist field value while converting a lead to opp or acc or contact. just run this query in the dev console you will get the Id, lead status picklist values.
SELECT Id, MasterLabel FROM LeadStatus
If you find this helpful mark it as the best answer.
Regards,
Malika Pathak

{Get; Set;} test method hello i write a test method for a controller.but i get only 71% code coverage. i am facing problem to write the test method for get set method.please help me here is my code
hello
i write a test method for a controller.but i get only 71% code coverage.
i am facing problem to write the test method for get set method.please help me
here is my code:
public class eiException extends exception{
public String code{get; set;}
public String text{get; set;}
public String severity{get; set;}
public String category{get; set;}
public String subcategory{get; set;}
public String dataState{get; set;}
public Boolean retryAllowed{get; set;}
public String additionalInformation{get; set;}
public eiException(Dom.XmlNode node){
dom.XmlNode p;
p=node.getChildElement('code', eiEnvelope.namespace);
if(p != null){code = p.getText();}
p=node.getChildElement('text', eiEnvelope.namespace);
if(p != null){text = p.getText();}
p=node.getChildElement('severity', eiEnvelope.namespace);
if(p != null){severity = p.getText();}
p=node.getChildElement('category', eiEnvelope.namespace);
if(p != null){category = p.getText();}
p=node.getChildElement('subcategory', eiEnvelope.namespace);
if(p != null){subcategory = p.getText();}
p=node.getChildElement('dataState', eiEnvelope.namespace);
if(p != null){dataState = p.getText();}
p=node.getChildElement('retryAllowed', eiEnvelope.namespace);
if(p != null){retryAllowed = p.getText().equalsIgnoreCase('true');}
p=node.getChildElement('additionalInformation', eiEnvelope.namespace);
if(p != null){additionalInformation = p.getText();}
}
public static testmethod void testeiException() {
DOM.Document doc = new DOM.Document();
dom.XmlNode envelope= doc.createRootElement('Envelope',null,null);
dom.XmlNode body= envelope.addChildElement('code', null, null);
eiException eiEx = new eiException(body);
}
}
i write a test method for a controller.but i get only 71% code coverage.
i am facing problem to write the test method for get set method.please help me
here is my code:
public class eiException extends exception{
public String code{get; set;}
public String text{get; set;}
public String severity{get; set;}
public String category{get; set;}
public String subcategory{get; set;}
public String dataState{get; set;}
public Boolean retryAllowed{get; set;}
public String additionalInformation{get; set;}
public eiException(Dom.XmlNode node){
dom.XmlNode p;
p=node.getChildElement('code', eiEnvelope.namespace);
if(p != null){code = p.getText();}
p=node.getChildElement('text', eiEnvelope.namespace);
if(p != null){text = p.getText();}
p=node.getChildElement('severity', eiEnvelope.namespace);
if(p != null){severity = p.getText();}
p=node.getChildElement('category', eiEnvelope.namespace);
if(p != null){category = p.getText();}
p=node.getChildElement('subcategory', eiEnvelope.namespace);
if(p != null){subcategory = p.getText();}
p=node.getChildElement('dataState', eiEnvelope.namespace);
if(p != null){dataState = p.getText();}
p=node.getChildElement('retryAllowed', eiEnvelope.namespace);
if(p != null){retryAllowed = p.getText().equalsIgnoreCase('true');}
p=node.getChildElement('additionalInformation', eiEnvelope.namespace);
if(p != null){additionalInformation = p.getText();}
}
public static testmethod void testeiException() {
DOM.Document doc = new DOM.Document();
dom.XmlNode envelope= doc.createRootElement('Envelope',null,null);
dom.XmlNode body= envelope.addChildElement('code', null, null);
eiException eiEx = new eiException(body);
}
}


To achieve more test coverage for your eiException class, you need to add test methods to cover the getter and setter methods. Here is an example of how you can test these methods:
@isTest
static void testGettersAndSetters() {
eiException ex = new eiException();
ex.code = '123';
ex.text = 'Test Exception';
ex.severity = 'Error';
ex.category = 'General';
ex.subcategory = 'Unknown';
ex.dataState = 'Invalid';
ex.retryAllowed = true;
ex.additionalInformation = 'Additional info';
System.assertEquals('123', ex.code);
System.assertEquals('Test Exception', ex.text);
System.assertEquals('Error', ex.severity);
System.assertEquals('General', ex.category);
System.assertEquals('Unknown', ex.subcategory);
System.assertEquals('Invalid', ex.dataState);
System.assertEquals(true, ex.retryAllowed);
System.assertEquals('Additional info', ex.additionalInformation);
}
This test method creates an instance of the eiException class and sets values for all the properties using the getter and setter methods. Then it uses the System.assertEquals method to verify that the values are set correctly.
Note that you may need to update your eiException constructor to include an empty constructor to initialize the properties before the setter methods are called. You can do this by adding the following code:
public eiException() {
// Initialize properties
code = '';
text = '';
severity = '';
category = '';
subcategory = '';
dataState = '';
retryAllowed = false;
additionalInformation = '';
}
If you find this answer helpful, please mark it as the best answer.

How do you use a date in apex
I am writing a trigger where I am bringing in a Date/Field field from case. It has a letter in it 2023-02-10T16:15:35.000+0000 and when I try to subtract it with "DateTime.now()" I get an error "Date/time expressions must use Integer or Double or Decimal ".
This is my code
trigger CaseTrigger on Case (before update) {
for(Case cases: Trigger.new){
if(cases.stopped_time__c != null){
cases.Total_amount_of_time_in_Hours__c= (DateTime.now()-cases.stopped_time__c );
}
}
}
This is my code
trigger CaseTrigger on Case (before update) {
for(Case cases: Trigger.new){
if(cases.stopped_time__c != null){
cases.Total_amount_of_time_in_Hours__c= (DateTime.now()-cases.stopped_time__c );
}
}
}


Hello Ratheven,
cases.Total_amount_of_time_in_Hours__c= (DateTime.now().getTime()-cases.ClosedDate.getTime() )/(1000.0 * 60.0 * 60.0);
In this code, we use the getTime method to convert the DateTime objects to the number of milliseconds, and then divide that number by the number of milliseconds in an hour to get the total number of hours.
I hope this will help.
Thanks
cases.Total_amount_of_time_in_Hours__c= (DateTime.now().getTime()-cases.ClosedDate.getTime() )/(1000.0 * 60.0 * 60.0);
In this code, we use the getTime method to convert the DateTime objects to the number of milliseconds, and then divide that number by the number of milliseconds in an hour to get the total number of hours.
I hope this will help.
Thanks
Please make sure on right side you are entering the label name for the chart, selecting the report "SolarBot Status Averages" and adding filter SolarBotID so that chart displays the record details only based on context.
If you do not select anything, it will set to the default one (The pie chart one).
Just adding report chart to the page layout not working for this challenge.