Saddam Hussain
IndividualForum Replies Created
-
Saddam
MemberOctober 9, 2019 at 5:41 am in reply to: What is the difference between managed package and unmanaged package in salesforce?Hi,
What is UnManaged Package?
– Unmanaged package is used to distribute open source applications to provide developers with with basic functionality.
– We can edit unmanged package components after installing the unmanaged package in a salesforce organization.
– The developer who created unmanged package has no control on installed components, can’t edit & can’t upgrade.What is Managed Package?
– Managed package is used to distribute and sell application to customers. By using the App exchange developers can sell and mange user baser based licences to the managed package application.
– Managed packages are fully upgradable.
– To ensure seamless upgrades, certain destructive changes, like removing objects or fields, can not be performed. -
Saddam
MemberOctober 9, 2019 at 5:39 am in reply to: Which chart types used to display summary values from two different levels of grouping in reports?Hi,
you can use Stacked bar chart and Groupled line chart
-
Saddam
MemberOctober 3, 2019 at 6:13 pm in reply to: What is the use of force:createRecord in lightning components ?Hi,
This event opens a page to create a record for the specified entityApiName, for example, "Account", or "myNamespace__MyObject__c".
To display the record create page for an object, set the object name on the entityApiName attribute and fire the event. recordTypeId is optional and, if provided, specifies the record type for the created object. defaultFieldValues is optional and, if provided, specifies values to use to prepopulate the create record form.
This example displays the record create panel for contacts.
createRecord : function (component, event, helper) {
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Contact"
});
createRecordEvent.fire();
} -
Saddam
MemberOctober 3, 2019 at 6:09 pm in reply to: What is the use of force:editRecord in lightning component?Hi,
This event opens a page to edit the record specified by recordId.
To display the record edit page for an object, set the object name on the recordId attribute and fire the event. This example displays the record edit page for a contact that’s specified by recordId.
This example displays the record create panel for contacts.
editRecord : function(component, event, helper) {
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": component.get("v.contact.Id")
});
editRecordEvent.fire();
} -
Saddam
MemberOctober 3, 2019 at 6:06 pm in reply to: What is the use of force:showToast in lightning components ?Hi,
A toast displays a message below the header at the top of a view. The message is specified by the messageattribute.
force:showToast is not available on login pages.
This example displays a toast message "Success! The record has been updated successfully."
showToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
"title": "Success!",
"message": "The record has been updated successfully."
});
toastEvent.fire();
} -
Saddam
MemberOctober 1, 2019 at 6:13 am in reply to: What are the uses of Renderer and Document in the Saleforce lightning component?Hi,
Document
A description, sample code, and one or multiple references to example components.
Renderer
Rendering and Rerendering lifecycles contain four basic methods to render the component. These methods are :
1). render()
2). rerender()
3). afterRender()
4). unrender() -
Saddam
MemberOctober 1, 2019 at 6:10 am in reply to: How to get picklist values dynamically in lightning component in salesforce?Hi,
you can use this code for getting dynamic picklist value
Class
=====
public class fetchPicklistOptsController {
@AuraEnabled
public static List < String > getselectOptions(sObject objObject, string fld) {
system.debug('objObject --->' + objObject);
system.debug('fld --->' + fld);
List < String > allOpts = new list < String > ();
// Get the object type of the SObject.
Schema.sObjectType objType = objObject.getSObjectType();// Describe the SObject using its object type.
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();// Get a map of fields for the SObject
map < String, Schema.SObjectField > fieldMap = objDescribe.fields.getMap();// Get the list of picklist values for this field.
list < Schema.PicklistEntry > values =
fieldMap.get(fld).getDescribe().getPickListValues();// Add these values to the selectoption list.
for (Schema.PicklistEntry a: values) {
allOpts.add(a.getValue());
}
system.debug('allOpts ---->' + allOpts);
allOpts.sort();
return allOpts;
}
}Component
============
<aura:component controller="fetchPicklistOptsController">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="objInfo" type="account" default="{sobjectType : 'Account'}" /><div class="slds-form-element">
<label class="slds-form-element__label" for="select-01">Select Label</label>
<div class="slds-select_container">
<ui:inputSelect aura:id="accIndustry" class="slds-select" change="{!c.onPicklistChange}"/>
</div>
</div>
</aura:component>Controller
========
({
doInit: function(component, event, helper) {
helper.fetchPickListVal(component, 'Industry', 'accIndustry');
},
onPicklistChange: function(component, event, helper) {
// get the value of select option
alert(event.getSource().get("v.value"));
},
})
Helper======
({
fetchPickListVal: function(component, fieldName, elementId) {
var action = component.get("c.getselectOptions");
action.setParams({
"objObject": component.get("v.objInfo"),
"fld": fieldName
});
var opts = [];
action.setCallback(this, function(response) {
if (response.getState() == "SUCCESS") {
var allValues = response.getReturnValue();if (allValues != undefined && allValues.length > 0) {
opts.push({
class: "optionClass",
label: "--- None ---",
value: ""
});
}
for (var i = 0; i < allValues.length; i++) {
opts.push({
class: "optionClass",
label: allValues[i],
value: allValues[i]
});
}
component.find(elementId).set("v.options", opts);
}
});
$A.enqueueAction(action);
},
}) -
Saddam
MemberOctober 1, 2019 at 5:57 am in reply to: How many types of Salesforce licenses are there?Hi,
Here’s the summary of Salesforce user license types:
Salesforce
Full access to standard CRM, custom apps, and AppExchange apps.
Salesforce Platform
Custom apps & core objects (Accounts, Contacts, etc) only; no CRM (no Opportunities or Forecasts).
Force.com – One App
One custom app & read-only for accounts and Contacts; no CRM.
Knowledge Only User
Salesforce Knowledge app only.
Chatter Free
Access to Chatter for people in your company without a Salesforce license. No additional cost.
Chatter External
Allows your customers to use Chatter groups. No additional cost.
Chatter Only (aka Chatter Plus)
Access to Chatter for people in your company without a Salesforce license PLUS access to accounts & contacts. Additional cost.
Guest User
Create a public website for your organization using Force.com Sites.
Gold Partner
Partner portal access.
Authenticated Website
A type of high volume customer portal license used with Force.com Sites. A modest fee allows for certain number of logins per month to your portal / website.
High Volume Customer Portal
Unlimited logins to your Service Cloud Portal to access customer support information.
Customer Portal Manager Standard
Contacts can log into your Customer Portal to manage customer support.
Customer Portal Manager Custom
Contacts can log into your Customer Portal to manage customer support (with more access than Customer Portal Manager Standard). -
Saddam
MemberSeptember 30, 2019 at 5:59 am in reply to: What is the use of @track in lightning web component?Hi,
To track a private property’s value and rerender a component when it changes, decorate the property with @track. Tracked properties are also called private reactive properties.
You can use a tracked property directly in a template. You can also use a tracked property indirectly in a getter of a property that’s used in a template.
-
Saddam
MemberSeptember 30, 2019 at 5:55 am in reply to: How to consume external WSDL file in salesforce?Hi,
Step 1 : Add the site to remote site settings.
Step 2 : Consume the WSDL.
Step 3 : Generated Apex classes from WSDL
Salesforce provides a WSDL (Web Service Description Language) files. They are called "Enterprise WSDL" and "Partner WSDL". A WSDL is an XML-document which contains a standardized description on how to communicate using a web service (the Salesforce API is exposed as a web service). The WSDL is used by developers to aid in the creation of Salesforce integration pieces. A typical process involves using the Development Environment (eg, Eclipse for Java, or Visual Studio for .Net) to consume the WSDL, and generate classes which are then referenced in the integration.
Enterprise WSDL:
This WSDL document is for customers who want to build an integration with their Salesforce organization only. It is strongly typed, which means that it contains objects and fields with specific data types, such as integer and string. Customers who use the enterprise WSDL document must download and re-consume it whenever their organization makes a change to its custom objects or fields or whenever they want to use a different version of the API. For the reasons outlined above, the Enterprise WSDL is intended primarily for Customers.
Partner WSDL:
This WSDL document is for customers, partners, and ISVs who want to build an integration that can work across multiple Salesforce organizations, regardless of their custom objects or fields. It is loosely typed, which means that you work with name-value pairs of field names and values instead of specific data types. The partner WSDL document only needs to be downloaded and consumed once per version of the API.
-
Hi,
you should be able to do it one of two ways (assuming that the account you are using for development has the proper API access).
1) Add your developer machines public IP address to the whitelist. This is something that any administrator should be able to do by going to setup -> security controls -> network access and adding a new trusted IP
2) Logging in with password & token, if your system is not on the trusted IP range you should be able to combine the users password and it's security token together and providing that as the "password" to any SOAP login calls.For more info on the "API Enabled" permssion, see here: http://www.salesforce.com/developer/docs/api/Content/sforce_api_concepts_security.htm
-
Hi,
To create scratch org, first of all, you need to Enable Dev Hub
After you enabled the dev hub org in your org, the next step is to create the default scratch org. Go to command palette in visual studio code and find “sfdx: create a default Scratch Org…“. Select the command.
-
Saddam
MemberSeptember 27, 2019 at 5:53 am in reply to: How can I access a custom label in Salesforce visualforce page?Hi,
you can use this syntax to access the custom label in visualforce
{!$Label.Name of custom label}
-
Saddam
MemberSeptember 27, 2019 at 5:49 am in reply to: How can we mass delete reports in Salesforce?Hi,
In Setup, under Data Management > Mass Delete Records, select Mass Delete Reports and configure a filter to find reports that need to be deleted. Reports that you delete go into the recycle bin. They aren’t permanently deleted until you clear your recycle bin.
Note: You can’t mass-delete reports that are scheduled or are used in dashboards
-
Saddam
MemberSeptember 25, 2019 at 7:04 am in reply to: What is the difference between lightning:recordForm and force:recordData in lightning component ? -
Saddam
MemberSeptember 25, 2019 at 7:01 am in reply to: What is the use of lightning:messages in salesforce lightning component?Hi,
you can use this component inside lightning:recordEditForm to display message either is success or error
-
Saddam
MemberSeptember 25, 2019 at 6:55 am in reply to: Is it possible to restrict permission for users using permission set?Hi,
No you can't restrict permission, permission sets extend users' functional access without changing their profiles.
A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles
-
Saddam
MemberSeptember 24, 2019 at 6:27 am in reply to: What is the difference between Dependent lookup Field and Controlling/Dependent picklist Field?Hi,
They are the same thing. The Controlling field is the 'parent' that controls which values are available in the 'dependent' picklist.
-
Saddam
MemberSeptember 24, 2019 at 6:25 am in reply to: What is the difference between 15 digit and 18 digit id in Salesforce?Hi,
One thing to note is that Salesforce IDs are case sensitive when they are 15 digit and insensitive when they are 18 digit. This means you must take into account upper and lower cases when you export the data from the system for the case sensitive data elements. If your using tools like vlookup in Excel to do comparison from various sources of data, be careful as Excel can incorrectly map the data since it is not case sensitive on the 15 digit id.
The last three digits in the ID is a checksum. A calculation to assure that the first 15 pieces of the ID are accurate for the object its being written into.
So following that analogy just mentioned.
15 digit case-sensitive version
15 digit ID is what will be received from within the user interface
18 digit case-insensitive and best used for manipulating data outside Salesforce
18 digit id is referenced through in the API and other 3rd party tools.
If you would like to convert the current user interface id to 18 digits this can be done by using a formula very simple formula. I have seen a couple of versions of the formula but this is the one that worked best for me in my career.
All you need to do is add a new formula field, text 18 characters with “CASESAFEID(ID)”
Salesforce has a knowledge base article on this topic which gives clear instructions on how to use it.
-
Saddam
MemberSeptember 24, 2019 at 6:23 am in reply to: Why do we need to write test classes in salesforce?Hi,
Test class in salesforce
Testing is an important part of SDLC. So, before deploying our code to production environment, Salesforce requires at least 75% of your code to be covered by our test classes whic. Salesforce has done that to make sure that our code doesn’t break in any situation in Production. Today we’ll see how we write the test class with example in Salesforce.Some points regarding the test classes in Salesforce, which you have to know for sure:
At least 75% of your Apex code must be covered by unit tests, and all of those tests must complete successfully. But this should not be our focus. We should aim for 100% code coverage, which ensures that you cover each positive and negative use case of your code to cover and test each and every branch of your code.
Calls to System.debug are not counted as part of Apex code coverage.
Test methods and test classes are not counted as part of Apex code limit. So, no worries about writing long test class with more methods just to make sure that all your code branches are covered.
Every trigger you are trying to deploy should have at least 1% coverage, but yes overall coverage of your production org after getting your code deployed should be 75%, otherwise Salesforce won’t let you deploy your code.
Class can be deployed on 0% coverage as well, but as I told in last point, that overall coverage of your production org after getting your code deployed should be 75%, otherwise Salesforce won’t let you deploy your code.The key points while writing a test class are:
You have to start your class with @isTest annotation, then only Salesforce will consider this class as test class.
Keep your class as Private, and the best practice is to name your test class as your original Class or trigger Name + ‘Test’.
Methods of your test class have to be static, void and testMethod keyword has to be used.
Prepare your test data which needs to be existing before your actual test runs. There are multiple techniques of creating test data now a days, for example, setup method, static resources etc. For more details about @testsetup method check below link @testSetup method in apex test class
Use Test.startTest() and Test.stopTest() to make sure that the actual testing of your code happens with the fresh set of governer limits. These methods help you to reset your governor limits just before your actual code of testing get executed.
Once your test code runs between Test.startTest() and Test.stopTest(), you must use assert statements to test whether your actual code is executing correctly and giving the results as expected. In our case, we are test whether book’s price has been set to 90 or not. If this assert statement returns false, then your test class will fail, and will let you know, that something is not correct in your code, and you need to fix your original code.
Because we are testing a simple trigger, we could not show the testing using negative use cases, but in an ideal world, you should write multiple methods in your test class, few should test your positive use cases, and other should test your negative test cases. -
Saddam
MemberSeptember 20, 2019 at 11:12 am in reply to: What is the Data Type of LastModifiedDate Field in the Opportunity Statndered Object of Salesforce?Hi,
Date and time
-
Hi,
Base class of Cache.OrgPartition and Cache.SessionPartition. Use the subclasses to manage the cache partition for org caches and session caches.
Contains methods to manage cache values in the org cache of a specific partition. Unlike the session cache, the org cache is not tied to any session. It’s available to the organization across requests and to all users.
-
Saddam
MemberSeptember 20, 2019 at 10:28 am in reply to: how to covert object dataType into decimal dataType.Hi,
you can use this
public static void NewcountyUpdate(List<id> countyIds){
List<New_Company__c> newval = new List<New_Company__c>();
for (AggregateResult ar : [select count(Id) totalCount, Company_Realign__c countyId From Contact where Company_Realign__c = :countyIds GROUP BY Company_Realign__c ] ){
newval.add(new New_Company__c(
Id = (Id) ar.get('countyId'),//This One
Alumni_contact_count__c = (Decimal) ar.get('totalCount')
));
}
update newval;
} -
Saddam
MemberSeptember 19, 2019 at 6:54 am in reply to: Is it possible to download a vf page by clicking custom button in salesforce?Hi,
You can just append ‘ renderAs=”pdf” ‘ to you <apex:page> tag.
-
Saddam
MemberSeptember 19, 2019 at 6:53 am in reply to: What is apex batch chain class in salesforce?Hi,
Only in the batch class finish method, We can call another batch class. that process is called batch chaining in salesforce.