Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 28, 2018 at 5:35 pm in reply to: What does commit object contains in Salesforce?A “commit” points to a single tree, marking it as what the project looked like at a certain point in time. It contains meta-information about that point in time, such as a timestamp, the author of the changes since the last commit, a pointer to the previous commit(s), etc.
-
Parul
MemberSeptember 28, 2018 at 5:35 pm in reply to: What are the reasons for data loss in Salesforce?Adding some points:
There are 5 main causes of data loss in Salesforce:
1. Accidental or malicious deletion can occur when a user inadvertently or intentionally deletes one or more records. An individual record can easily be deleted by clicking on the delete button located on an object page. Multiple records can be deleted at one time with the mass delete utility
2. Bad code can make incorrect changes to many records. Developers plan and test their code to avoid mistakes but program errors still happen. Not every actual scenario is always covered so code can sometimes have unexpected results. These changes can be very difficult to identify and even harder to fix.
3. Data import gone wrong will have a far-reaching impact. Tools like the data import wizard and data loader allow users to update records in a single operation. Unfortunately an incorrect mapping can yield bad values in a large number of records.
4. SOQL mistake can happen in an instant. The developer console query editor can be used to execute queries and the wrong syntax can create a serious problem. An update query is designed to potentially impact large number of records so a backup should always be run prior to any mass update.
5. Problems with an integration could inadvertently update the wrong records. There are some very powerful integration tools for Salesforce that can update hundreds, thousands or even millions of records through automated processing. Without a current backup, an integration error of this magnitude could be impossible to recover from.Thanks
-
Parul
MemberSeptember 28, 2018 at 5:32 pm in reply to: What are the reasons for data loss in Salesforce?Data loss may cause due to following reasons:
Changing data and date-timeAltering to percent,number and currency from other data typesChanging from multi-select picklist, checkbox, auto number to other typesAltering to multi-select picklist from any type except picklistChanging to auto-number except from textChanging from text-area to e-mail, phone, URL and text
-
Parul
MemberSeptember 28, 2018 at 5:28 pm in reply to: Explain how to transform JSON text to a JavaScript object in Salesforce?JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string
-
Parul
MemberSeptember 28, 2018 at 5:27 pm in reply to: Mention what is the rule for JSON syntax rules? Give an example of JSON object in Salesforce?JSON
Pro:Simple syntax, which results in less “markup” overhead compared to XML.
Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.
JSON Schema for description and datatype and structure validation
JsonPath for extracting information in deeply nested structures
Con:Simple syntax, only a handful of different data types are supported.
XML
Pro:Generalized markup; it is possible to create “dialects” for any kind of purpose
XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
XSLT for transformation into different output formats
XPath/XQuery for extracting information in deeply nested structures
built in support for namespaces -
Parul
MemberSeptember 28, 2018 at 5:26 pm in reply to: Why must one use JSON over XML in Salesforce?JSON
Pro:Simple syntax, which results in less “markup” overhead compared to XML.
Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.
JSON Schema for description and datatype and structure validation
JsonPath for extracting information in deeply nested structures
Con:Simple syntax, only a handful of different data types are supported.
XML
Pro:Generalized markup; it is possible to create “dialects” for any kind of purpose
XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
XSLT for transformation into different output formats
XPath/XQuery for extracting information in deeply nested structures
built in support for namespaces -
Parul
MemberSeptember 28, 2018 at 5:25 pm in reply to: What is the use of THIS CSS class in Salesforce?Style your components with CSS.
Add CSS to a component bundle by clicking the STYLE button in the Developer Console sidebar.
.THIS {
background-color: grey;
}
<aura:component>
<div class="white">
Hello, HTML!
</div><h2>Check out the style in this list.</h2>
<ul>
<li class="red">I'm red.</li>
</ul>
</aura:component> -
Parul
MemberSeptember 28, 2018 at 5:24 pm in reply to: What is @testVisible used for while testing an Apex class in Salesforce?@TestVisible Annotation.
This annotation enables a more permissive access level for running tests only. TestVisible annotation allow test methods to access private or protected members of another class outside the test class. These members include methods, member variables, and inner classes.This example shows how to annotate a private class member variable and private method with TestVisible.
public class TestVisibleExample {
@TestVisible private static Integer recordNumber = 1;
@TestVisible private static void updateRecord(String name) {
}
}This is the test class that uses the previous class. It contains the test method that accesses the annotated member variable and method.
@isTest
private class TestVisibleExampleTest {
@isTest static void test1() {
// Access private variable annotated with TestVisible
Integer i = TestVisibleExample.recordNumber;
System.assertEquals(1, i);// Access private method annotated with TestVisible
TestVisibleExample.updateRecord(‘RecordName’);
// Perform some verification
}
} -
Parul
MemberSeptember 28, 2018 at 5:23 pm in reply to: How to handle error records in Salesforce Batch apex?Yes, you can certainly send an email to the user; in fact, this is my preferred method to avoid spamming users. You can do this by way of the Database.Stateful.
public class MyBatchable implements Database.Batchable<SObject>, Database.Stateful {
Exception[] errors = new Exception[0];
public Iterable<SObject> start(...) {
...
}
public void execute(...) {
try {
...
} catch(Exception e) {
errors.add(e);
}
}
public void finish(...) {
if(!errors.isEmpty()) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject('Errors occurred during batch process.');
mail.setTargetObjectId(UserInfo.getUserId());
mail.setSaveAsActivity(false);
mail.setPlainTextBody(buildBodyFor(errors));
Messaging.sendEmail(new Messaging.Email[] { mail });
}
}
}
You might also include a way to send emails if too many errors have stacked up, or limit yourself to some number of exceptions (say, the first 50 or 100). Keep in mind that you do have a limited amount of memory available, so if you're concerned about having a large number of errors, consider logging them to the database and then querying them back in your finish method. -
Parul
MemberSeptember 28, 2018 at 5:22 pm in reply to: How and when can we use Trigger.newMap in a Salesforce Validation Trigger?Trigger.newMap just allows you to target specific records by Id should you not need to process everything. It returns a map which is unordered. Trigger.newMap is a map represented as map<Id, Custom_obj__c>.
-
Parul
MemberSeptember 28, 2018 at 5:20 pm in reply to: What are the various types of Data Extensions in Salesforce Marketing Cloud ?Viewing and Working with your Data Extensions:
To view your data extensions, go to SUBSCRIBERS>>DATA EXTENSIONS.
From the list view of your data extensions you can utilize the below shortcuts:
Import – Upload contacts to your list
Filter – Shortcut to build a filtered data extension off your list
Split – Create a data extension containing a random set of contacts from your list
Export – Download your list
Send – Open a wizard to select an email to send to the list -
Parul
MemberSeptember 28, 2018 at 5:19 pm in reply to: What is Good Open Rate in Salesforce Marketing Cloud?Varies significantly by industry. When evaluating your email campaigns, track your open rate against your industry’s average to get the most accurate comparison.
-
Parul
MemberSeptember 28, 2018 at 5:18 pm in reply to: What is the use of the aura:method tag in Salesforce Lightning?This enables you to directly call a method in a component's client-side controller instead of firing and handling a component event. Using <aura:method> simplifies the code needed for a parent component to call a method on a child component that it contains. The <aura:method> tag has these system attributes.
-
Parul
MemberSeptember 28, 2018 at 5:17 pm in reply to: How to iterate map in Salesforce Lightning Component?<aura:component controller="MyMapClass">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="myMap" type="Map" />
{!v.myMap.key1} <br/>
{!v.myMap.key2}
</aura:component>
({
doInit: function(component, event, helper) {var action = component.get('c.getMyMap');
action.setCallback(this,function(response){
alert(JSON.stringify(response.getReturnValue()));
component.set('v.myMap',response.getReturnValue());
});
$A.enqueueAction(action);
}
})
public class MyMapClass {
@AuraEnabled
public static map<String,String> getMyMap(){
Map<String,String> Mymap = new Map<String,String>();
Mymap.put('key1','apple');
Mymap.put('key2','mango');
return Mymap;
}
}
here is a simple example to use map in lightning component and use @AuraEnabled in you apex class method
component -
Parul
MemberSeptember 28, 2018 at 5:16 pm in reply to: How to use map in Salesforce lightning component?<aura:component controller="MyMapClass">
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="myMap" type="Map" />
{!v.myMap.key1} <br/>
{!v.myMap.key2}
</aura:component>
({
doInit: function(component, event, helper) {var action = component.get('c.getMyMap');
action.setCallback(this,function(response){
alert(JSON.stringify(response.getReturnValue()));
component.set('v.myMap',response.getReturnValue());
});
$A.enqueueAction(action);
}
})
public class MyMapClass {
@AuraEnabled
public static map<String,String> getMyMap(){
Map<String,String> Mymap = new Map<String,String>();
Mymap.put('key1','apple');
Mymap.put('key2','mango');
return Mymap;
}
}
here is a simple example to use map in lightning component and use @AuraEnabled in you apex class method
componentHope it helps
-
Parul
MemberSeptember 28, 2018 at 5:15 pm in reply to: How to find all required fields of sobject in Salesforce?There is a way to programmatically learn about metadata of your datamodel with in Apex.
Schema Describe calls provides the ability to programitically describe the information about the current org schema such as list of top level objects including custom objects and their fields.Map<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
We can also use schemaDescribe() to create tree structure of all the objects and fields in the schema browser, to do this we need to use the codemapMap<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
Returns map of all Sobjects names or Keys to sObject tokens or values for the standard and custom objects defined in the organization.
-
Parul
MemberSeptember 28, 2018 at 5:15 pm in reply to: How to get all the required fields of sObject dynamically?There is a way to programmatically learn about metadata of your datamodel with in Apex.
Schema Describe calls provides the ability to programitically describe the information about the current org schema such as list of top level objects including custom objects and their fields.Map<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
We can also use schemaDescribe() to create tree structure of all the objects and fields in the schema browser, to do this we need to use the codemapMap<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
Returns map of all Sobjects names or Keys to sObject tokens or values for the standard and custom objects defined in the organization.
-
Parul
MemberSeptember 28, 2018 at 5:13 pm in reply to: How to get all the required fields of sObject dynamically in Salesforce?There is a way to programmatically learn about metadata of your datamodel with in Apex.
Schema Describe calls provides the ability to programitically describe the information about the current org schema such as list of top level objects including custom objects and their fields.Map<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
We can also use schemaDescribe() to create tree structure of all the objects and fields in the schema browser, to do this we need to use the codemapMap<String,Schema.SobjectType> gd = Schema.getGlobalDescribe();
Returns map of all Sobjects names or Keys to sObject tokens or values for the standard and custom objects defined in the organization.
-
Parul
MemberSeptember 28, 2018 at 5:11 pm in reply to: How to rename 'Checkbox' column in Salesforce Lightning 'datatable' component?The CSS code is provided below:
.THIS .slds-th__action_form span {
display: none;
}
-
Parul
MemberSeptember 28, 2018 at 5:11 pm in reply to: How can you access Salesforce visualforce components values into a JavaScript?<apex:page id="thePage">
<!-- A simple function for changing the font. -->
<script>
function changeFont(input, textid) {
if(input.checked) {
document.getElementById(textid).style.fontWeight = "bold";
}
else {
document.getElementById(textid).style.fontWeight = "normal";
}
}
</script><!-- This outputPanel calls the function, passing in the
checkbox itself, and the DOM ID of the target component. -->
<apex:outputPanel layout="block">
<label for="checkbox">Click this box to change text font:</label>
<input id="checkbox" type="checkbox"
onclick="changeFont(this,'{!$Component.thePanel}');"/>
</apex:outputPanel><!-- This outputPanel is the target, and contains
text that will be changed. -->
<apex:outputPanel id="thePanel" layout="block">
Change my font weight!
</apex:outputPanel>
</apex:page> -
Parul
MemberSeptember 28, 2018 at 5:09 pm in reply to: When should you use lookup instead of a master-detail relationship in Salesforce?The key difference is master-detail has a direct dependency between the objects:
You cannot have a detail record without a master.
The detail record inherits sharing rules from the master.
You cannot update the relationship to the master in a master-detail relationship.
The number of master-detail relationships you can use are limited.
You cannot set profile object permissions for a detail record
Master-detail relationships are automatically included in report record types -
Parul
MemberSeptember 28, 2018 at 5:08 pm in reply to: Difference between action function, action support and action poller in Salesforce?apex:ActionFunction: This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
<apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”></apex:actionFunction>
apex:ActionSupport: This component adds Ajax request to any other Visualforce component. Example: Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.
<apex:outputpanel id=”counter”>
<apex:outputText value=”Click Me!: {!count}”/>
<apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
</apex:outputpanel>actionRegion: An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an ajax request is generated.
Thanks
-
Parul
MemberSeptember 28, 2018 at 5:06 pm in reply to: Can we modify records directly in Salesforce trigger.new?I think we can't modify the records directly in trigger.new
-
Custom report types in salesforce allows us to build framework in the report wizard
-
When you click on report it run automatically