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

How to add Custom Objects to an App after creation of the objects?
Hi,
I am following the book "Developement with the Force.com platform" by JasonOuelette.
When creating the Custom Objects, I did not check the box to be visible in a tab, and so I could not add this object to the Custom App I was creating. Now I have a created fields and relationships in the custom object. How do I add this Object to the Custom App?
thanks
Svidya
Getting to 100 percent code coverage on my trailhead module “Write Negative Tests Unit”
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'); } }


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.




Greetings!
You can monitor your org’s API usage and limits, you can use these resources:
The API Usage section of the System Overview page in Setup.
The API Requests, Last 24 Hours item in the Organization Detail section of the System Overview page in Setup.
The API Request Limit per Month usage-based entitlement, which shows you your org’s API calls aggregated over 30 days. This can be found on the Company Information page in Setup.
Information returned in the Sforce-Limit-Info response header for REST APIs.
Information returned in the response body (in <type>API REQUESTS</type>) for SOAP APIs.
The /limits call in the Lightning Platform REST API.
You can get temporary increase on API limits for 2 weeks.Please refer this article (https://help.salesforce.com/articleView?id=000315571&type=1&mode=1) for more information.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri

Can we add States to the Existing Country using Metadata Api Am trying to get all Countries(AddressSettings) Using Metadata APi and wants add some new states to the one of the existing countries using Metadataservice
Am trying to get all Countries(AddressSettings) Using Metadata APi and wants add some new states to the one of the existing countries using Metadataservice .but its showing Invalid iso code ARA for state Allier in country France.




Greetings!
Unfortunately,you can't add/create the new States or Country values using Metadata API as suggested here (https://help.salesforce.com/apex/HTViewHelpDoc?id=admin_state_country_picklists_api.htm#:~:text=You%20can%20use%20the%20Metadata,picklists%20in%20your%20sandbox%20org.).
However,you can only edit the existing States/countries as suggested in the above document.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri

Are there any common ID's on ListEmail class and EmailStatus class?
My task is to get the emailstatuses of list emails sent through a campaign. I know that ListEmail class can get the CampaignID. But now I need to get the Email Statuses of those emails. Is that possible? I would be able to do it by the ownerid of the listemail or by the campaignid. Are there any common fields between listemail and emailstatus?



Can checkboxes appear as "Yes" or "No" rather than "true" or "false" on a VF Page?
Hi All,
I have (with a great deal of help from this forum) managed to put together a VF Page which renders a custom object record as a PDF - excellent start.
All the PDF displays, is a pretty basic form of all the fields from the record - so we can then email the PDF to people.
Some of these custom object fields, however, are Checkboxes, and on my PDFs the values for said Checkboxes display as "true" or "false" depending on what was input - which I completely agree makes sense.
However, the people I am making this PDF form for do not think all lower-case "true" or "false" look very pretty - so have requested that I amend this to read "Yes" for true and "No" for false.
At the moment, the only way I can think of doing this is to create a custom object formula field for each Checkbox I have, which is an IF statement to display either "Yes" or "No" - but with a LOT of checkboxes on the form this would be incredibly time consuming - and I would have thought there must be some form of VisualForce jiggery-pokery which could change the appearance of checkbox values on the VF Page - can anyone help?
Quick snippet of the code for the page as follows:
<apex:page renderAs="pdf" StandardController="Adverse_Incident__c" showHeader="false"> <html> <head> <style> @page{ margin:0.25in; } .Label{ font-weight:bold; font-size:10px; font-family:"arial" "sans-serif"; } .Output{ font-weight:regular; font-size:10px; font-family:Arial Unicode MS; } .colStyle{ width:25%; } </style> </head> <apex:outputText style="font-style:bold; font-weight:bold; font-size:14px; font-family:sans-serif" value="Incident Information"/> <apex:PanelGrid columnClasses="colStyle" columns="4" border="1" frame="box" rules="all" width="100%" cellpadding="1px"> <apex:outputlabel styleClass="Label" value="Person Reporting Incident"/> <apex:outputText styleClass="Output" value="{!Adverse_Incident__c.Person_Reporting_Incident__c}"/> <apex:outputlabel styleClass="Label" value="Incident ID"/> <apex:outputText styleClass="Output" value="{!Adverse_Incident__c.Name}"/> </apex:PanelGrid> <apex:outputText style="font-style:bold; font-weight:bold; font-size:2px; font-family:sans-serif; color:white" value="."/> <p></p> <apex:outputText style="font-style:bold; font-weight:bold; font-size:14px; font-family:sans-serif" value="Facility Information"/> <apex:PanelGrid columnClasses="colStyle" columns="4" border="1" frame="box" width="100%" cellpadding="1px"> <apex:outputlabel styleClass="Label" value="Hospital Name"/> <apex:outputText styleClass="Output" value="{!Adverse_Incident__c.Hospital_Name__c}"/> <apex:outputlabel styleClass="Label" value="Street Address"/> <apex:outputText styleClass="Output" value="{!Adverse_Incident__c.Street_Address__c}"/> <apex:outputlabel styleClass="Label" value="Account Number"/>
Any help would be greatly appreciated. Many thanks,
Andy



Hello,
I do not see any fields in your snippet that lend themselves to check boxes, so i will not go into specifics, but in general you should be able to do something along the lines of:
<apex:outputText value = "{!IF(my_checkbox_field__c, Yes, No)} />
I have not tested it, so you may have to add =true in there, but I would think not.

How to pass single quote in Odata 4.0 query
I wrote an OData query and it worked until I added a Not Contains filter
String exclude = 'Variance';
and%20not%20contains(shortDescription,'+ exclude +')Resulting query is:
not%20contains(shortDescription,Variance)My question is how do I get single quotes around the variable.
Thank you,
Eric


I created a variable which contains the single quotes like this:
String exclude1 = '\'Variance\'';
Then in the Odata 4.0 query I added the variable like this:
%20not%20contains(shortDescription,'+ exclude1 +')

platform developer 2 certificate did not arrive
I have complete both requirements of PD 2 certificate, MCQ and Trailhead Badges. I have also linked my Webassessor account with trailhead account. It has been almost one week and I am still waiting for my certificate. I have raised mutiple cases for this but no response. My questions are :
1) Is it common for certificate to arrive late or is it just my case, please let me if anyone of you faced similar situation.
2) Is there any way to reach certificate team apart from guided help on the website.
Also any guess why does it take so long to award this certificate, once you have completed all the requirements. For example in case of proctored exam the certificate is awarded immediately.
Best Regards,
Rahul

I am glad that the PD2 certificate arrived for you. If you intend to learn about CPQ here are the resources you could use.
- Salesforce CPQ Basics Trailhead Module (https://trailhead.salesforce.com/en/modules/sf_cpq)
- Moreover, the Salesforce Partner Community (http://partners.salesforce.com/)has some amazing resources that you could use.
- Join the Salesforce CPQ for Partners Chatter Group (https://partners.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000004g0QCAQ) to get access to experts and a demo package that you can install in your Developer Edition orgs and play around with.
- Moreover, Partner Training has a great module on Salesforce CPQ Administration Basics which gives you a deep dive in setting up CPQ and performing customizations around it in a step by step manner.
- You can also follow the @SalesforceCPQ twitter handle for updates and use hash tag #askforce or @asksalesforce for any help with issues if you are stuck.
- Once you are ready you can then take the Salesforce CPQ Specialist certification (http://certification.salesforce.com/cpqspecialist)to showcase proven CPQ expertise
Also, if your issue is now resolve, please close this thread.

Platform Developer 2 Certification
I am completed the Multiple choice questions for Platform Developer 2 as well as the super badges, can someone help me to understand how do I get the certificate.
Thanks

1) http://certification.salesforce.com/platformdeveloperII
2) http://certification.force.com/pkb/articles/Public_KB/Changes-to-Platform-Developer-II
Congrats - you’re on the path to earning PDII! What happens next? In order to grant you the PDII credential, we’ll need to link your Webassessor and Trailhead accounts. Here’s the process:
Step 1 - Link Your Accounts: Once you complete the requirements in Trailhead, we will send you an email with instructions on how to link your accounts. Click here (http://certification.force.com/pkb/articles/Public_KB/Link-Your-Trailhead-and-Webassessor-Accounts)for more details about this process.
Step 2 - We Grant You the Credential: Once you’ve successfully linked your accounts, and you’ve completed all requirements for PDII, we will grant you the credential within 1 week. You will receive an email notification with your certificate and logo which you can then proudly display!
Note: Your credential certified date will reflect the date your credential was issued in Webassessor.

I am facing this error in Platform developer 1 Spring 19 maintenance exam
Code is:-
@RestResource(urlMapping='/secureApexRest')
global with sharing class SecureApexRest {
@HttpGet
global static Contact doGet(){
Id recordId = RestContext.request.params.get('id');
Contact result;
if (recordId == null){
throw new FunctionalException('Id parameter is required');
}
if (Schema.SObjectType.Contact.isAccessible()
&& Schema.SObjectType.Contact.fields.Name.isAccessible()
&& Schema.SObjectType.Contact.fields.Secret_Key__c.isAccessible()){
List<Contact> results = [SELECT id FROM Contact WHERE Id = :recordId WITH SECURITY_ENFORCED];
if (!results.isEmpty()) {
result = results[0];
}
} else{
throw new SecurityException('You don\'t have access to all contact fields required to use this API');
}
return result;
}
public class FunctionalException extends Exception{}
public class SecurityException extends Exception{}
}
Kindly suggest me what exactly I need to change in the code.
Thanks inadvance.

https://success.salesforce.com/answers?id=9063A000000lSPsQAM
You dont have to provide access to any fields. If you read the challenge, you just have to edit the query to include the new WITH SECURITY_ENFORCED attribute, and remove other field level security checks.
You need to put the query in a try/catch statement, and catch the System.Query Exception.
Use this code
@RestResource(urlMapping='/secureApexRest') global with sharing class SecureApexRest { @HttpGet global static Contact doGet(){ Id recordId = RestContext.request.params.get('id'); Contact result; if (recordId == null){ throw new FunctionalException('Id parameter is required'); } List<Contact> results; try{ results = [SELECT id, Name, Secret_Key__c FROM Contact WHERE Id = :recordId WITH SECURITY_ENFORCED]; }catch(QueryException e){} if (!results.isEmpty()) { result = results[0]; } return result; } public class FunctionalException extends Exception{} public class SecurityException extends Exception{} }
It looks you havent create custom Tabs while defining custom objects first you need to create custom Tab for new objects Creating Tab Setup -->App Set up---> Create---> Tabs Click on new Tab [drop down shows all untabed objects ] select your object, set Tab style , click Next select profiles Save Adding To App Setup -->App Set up---> Create---> Apps Click on edit, edit available tab section Save Done Thanks, Bala