Yogesh Sharma
IndividualForum Replies Created
-
Yogesh
MemberAugust 12, 2019 at 2:37 pm in reply to: Is there any difference between the @isTest and @testSetup notation in Salesforce test class?@isTest
Use the @isTest annotation to define classes and methods that only contain code used for testing your application.
One Test class can have Multiple @isTest methods
@testSetup
Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.
One Test class can have only one @testSetup methods
-
Hello nikita,
If you create a "Developer" or "Developer Pro" sandbox, it will have no data.
Metadata, however, will be copied - so the developer will have the same custom objects and fields, workflow rules, etc, that you have on production. -
Hello,
Put the below code in the controller action method that is being called on click of command button
public class myControllerExtension {
public myControllerExtension(ApexPages.StandardSetController controller) { }
public PageReference OpenPage() {
PageReference pr = new PageReference('/apex/Your_Second_Page_Name');
pr.setRedirect(true);
return pr;
}
} -
This event is automatically fired when an app or component is initialized, prior to rendering.
Component-
<aura:component>
<aura:handler name=”init” value=”{!this}” action=”{!c.doInit}”/>
</aura:component>
jsController-
({
doInit: function(cmp) {
// Set the attribute value.
// You could also fire an event here instead.
alert(‘test’);
}
}) -
Yogesh
MemberAugust 9, 2019 at 2:53 pm in reply to: When do we use custom controller in Salesforce with extension class?Well I was able to find the below two reasons to use Extensions. In fact Controllers & Extensions are for same purpose which I understood.
1. Suppose there exists a VF page which has a custom controller called on it, and it is well tested and currently in use by the end users, if you want to add additional functionality on this VF page, you better don't disturb the existing program which would hit your business big time in case if anything goes wrong, rather write an extension and use it on VF Page.2. We can't call multiple custom controllers on a VF Page, but we can call second controller while we have the first controller on VF page, and however you need to define your second controller as Extension rather as controller.
-
Yogesh
MemberAugust 9, 2019 at 2:50 pm in reply to: What is mock test class in Salesforce and is it important?To deploy or package Apex, 75% of your code must have test coverage. By default, test methods don’t support HTTP callouts, so tests that perform callouts fail. Enable HTTP callout testing by instructing Apex to generate mock responses in tests, using Test.setMock.
example :-
public class CalloutClass {
public static HttpResponse getInfoFromExternalService() {
HttpRequest req = new HttpRequest();
req.setEndpoint('http://example.com/example/test');
req.setMethod('GET');
Http h = new Http();
HttpResponse res = h.send(req);
return res;
}
} -
The Salesforce Lightning Design System (SLDS) component library is actively developed to enable Salesforce developers to create a uniform look and feel across all Salesforce-related applications while adhering to CSS best practices and conventions.
-
Yogesh
MemberAugust 9, 2019 at 11:55 am in reply to: What is the use of Apex Continuation object in Salesforce?on Continuation object in Apex – Asynchronous callouts for long running request – Live Demo
We may run into scenario in Salesforce project, where we need call external web service but no need to wait for response. Response from external web service can be processed asynchronously and once processed it can be presented in Visualforce page.so we can accomplish this by using Continuation object as well.
-
Yogesh
MemberAugust 9, 2019 at 11:47 am in reply to: How can I link two Visualforce pages in Salesforce?Hello laveena, it might help you
Vf code
<apex:commandButton action="{!Move}" value="Next VF page"/>
controller code:
public PageReference Move()
{
PageReference Page = new PageReference('/apex/vfname');
Page.setRedirect(true);
return Page;
} -
Yogesh
MemberAugust 6, 2019 at 11:37 am in reply to: How to make all user in the system to read-only in emergency case in Salesforce?As far as I know ,there is no other option except changing the profile information or profile what you mentioned because a permission set is always additive in nature so it cannot be used to limit/narrow down permissions.