Avnish Yadav
IndividualForum Replies Created
-
Avnish Yadav
MemberAugust 22, 2018 at 1:06 pm in reply to: How can you force triggers to follow the security rules setup in your Salesforce org?Hi Prachi,
By using a handler class that has 'with sharing' in the header.
Thanks.
-
Avnish Yadav
MemberAugust 22, 2018 at 1:04 pm in reply to: What is the best way to store credentials that should never be seen in Salesforce?Hi Prachi,
Best way to store credentials that should NEVER be seen- Create a managed package and use protected Custom Settings.
Thanks.
-
Avnish Yadav
MemberAugust 21, 2018 at 12:45 pm in reply to: Explain the uses of lightning:formattedNumber in Salesforce.Hi Anjali,
Displays formatted numbers for decimals, currency, and percentages.
Example:-
<aura:component>
<p><lightning:formattedNumber value="1234.5678"/></p>
<p><lightning:formattedNumber value="1234.5678" maximumFractionDigits="2"/></p>
<p><lightning:formattedNumber value="12.34" style="decimal" minimumIntegerDigits="5"/></p>
<p><lightning:formattedNumber value="12.34" style="decimal" minimumFractionDigits="5"/></p>
<p><lightning:formattedNumber value="12.34" style="decimal" minimumSignificantDigits="5"/></p>
<p><lightning:formattedNumber value="123456789.123456789" minimumFractionDigits="9"/></p>
</aura:component>Output:-
1,234.568
1,234.57
00,012.34
12.34000
12.340
123,456,78991
Thanks.
-
Avnish Yadav
MemberAugust 21, 2018 at 7:36 am in reply to: How to call a schedulable apex from batch class in Salesforce?Hi Anurag,
You can implement both Database.Batchable and Schedulable in the same class like this:
global class ScheduleAndBatch implements Database.Batchable<sObject>, Schedulable {
global Database.QueryLocator start(Database.BatchableContext BC) {
}
global void execute(Database.BatchableContext BC, List<sObject> lstSobects) {}
global void finish(Database.BatchableContext BC) {}
global void execute(SchedulableContext sc) {
Type t = Type.forName('ScheduleAndBatch');
Database.Batchable< sObject > batchClass = ((Database.Batchable< sObject >) t.newInstance());
Database.executeBatch(batchClass, this.scope);
}
}Thanks.
-
Avnish Yadav
MemberAugust 21, 2018 at 6:12 am in reply to: how to use progress bar on lightning component?Hi Prachi,
A progress bar component communicates to the user the progress of a particular process.
Using Lightning component tag:-
<lightning:progressBar value="50" size="large" />
Using SLDS tag:-
<div class="slds-progress-bar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25" role="progressbar">
<span class="slds-progress-bar__value" style="width: 25%;">
<span class="slds-assistive-text">Progress: 25%</span>
</span>
</div>Thanks.
-
Avnish Yadav
MemberAugust 21, 2018 at 6:04 am in reply to: How to get record Id from Lightning record edit form on record insert?Hello Prachi,
Using the onsuccess event, you have access to the response object which contains, amongst other things, the id of the record that was recently created:
({
handleSuccess : function(component, event, helper) {
var payload = event.getParams().response;
console.log(JSON.stringify(payload));
}
})For information:- Read here
Thanks.
-
Avnish Yadav
MemberAugust 20, 2018 at 6:52 am in reply to: What is the SOQL query to get all accounts related to a contact?Hi Delango.
Here is sample code:-
List<Account> acc=[Select Id,Name from Account];
for(Account a:acc){
List<Contact> con=[Select accountId, LastName from contact where AccountId=:a.id];Integer TotalAnnualRevenue = 0;
for(Contact c:con){
TotalAnnualRevenue = TotalAnnualRevenue+c.AnnualRevenue
System.debug('Total revenue'+ TotalAnnualRevenue);
}}
Hope this will help you.
Thanks.
-
Avnish Yadav
MemberAugust 17, 2018 at 11:28 am in reply to: How to insert a record in Salesforce using Javascript?Hi Parul,
These are the steps to insert data using Javascript:
- Connecting to the AJAX Toolkit (By using login methods or getting Session_ID).
- Embedding the API methods in JavaScript.
- Processing the results.
Example -
var item = new sforce.SOBject('CustomObject__c');
item.Name = 'Hello World';
item.CustomField__c = new Date();
sforce.connection.insert([item],{onSuccess:alert, onFailure:alert});For more info:- Read here
Thanks.
-
Avnish Yadav
MemberAugust 17, 2018 at 5:33 am in reply to: Are cross filters supported in Joined Reports?Hello Chanchal,
Sorry, you can't add a cross filter in the joined report.
Thanks.
-
Avnish Yadav
MemberAugust 16, 2018 at 1:31 pm in reply to: What is Accordion in Salesforce lightning component?Hi Prachi,
lightning:accordion component groups related content in a single container. Only one accordion section is expanded at a time. When you select a section, it’s expanded or collapsed. Each section can hold one or more Lightning components.
Thanks.
-
Avnish Yadav
MemberAugust 16, 2018 at 1:27 pm in reply to: What is a Cron trigger in Salesforce Apex?Hi Anurag,
CronTrigger-
Contains schedule information for a scheduled job. CronTrigger is similar to a cron job on UNIX systems. This object is available in API version 17.0 and later.Usage - Use this object to query scheduled jobs in your organization.
Thanks.
-
Avnish Yadav
MemberAugust 16, 2018 at 6:48 am in reply to: What happen if child have two master records and one is deleted?Thanks, Prachi.
-
Avnish Yadav
MemberAugust 16, 2018 at 6:30 am in reply to: What is the difference between Data Import Wizard and Data Loader for importing data in Salesforce?Hi Anjali,
Import Wizard :
Is designed for less-technical users and smaller, simple imports of up to 50,000 records.
Can only import data of Account, Contact, Leads, Solution, and Custom Object.
For more information, go to Help & Training | Importing Data | Using the Import Wizards.
Data Loader :
For complex imports of any size.
Can upload more than 50000 records.
Can import and export data.
Can import data of any object except User.
Thanks.
-
Avnish Yadav
MemberAugust 16, 2018 at 6:28 am in reply to: What is the governor limit of sendEmail() to sent bulk email?Hi Parul,
You can send only 10 emails per transaction, which is governer limit of Salesforce.
For more information: -http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound.htm
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 12:25 pm in reply to: Explain the various dashboard components in Salesforce?Various Dashboard Components are:-
- Chart - Use a chart when you want to show data graphically. You can choose from a variety of chart types.
- Gauge - Use a gauge when you have a single value that you want to show within a range of custom values. For example, to create a dashboard that measures where your current closed opportunity amounts fall within a range of values, set the Minimum Value, Breakpoint #1 Value, Breakpoint #2 Value, and Maximum Value for the gauge. The ranges that you set can indicate poor, acceptable, and good performance. Set appropriate colors for each of these ranges to visually indicate progress. To create a gauge with only two ranges, leave Breakpoint #2 Value blank.Select Show Percentage or Show Total to display those values on the gauge. Values exceeding the maximum are shown as greater than 100%.
- Metric - Use a metric when you have one key value to display. For example, if you have a report showing the total amount for all opportunities in the Closed, Commit, and Base Case stages in the current month, you can name that value and use it as a revenue target for the month displayed on the dashboard.
- Table - Use a table to show a set of report data in column form. For example, to see the top 20 opportunities by amount, set Maximum Values Displayed to 20, click Customize Table and select opportunity name, amount, and other columns to display, choose the sort order, and set conditional highlighting. Available columns include all chart groupings and report summary fields, as well as the second-level grouping defined in the report.
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 11:41 am in reply to: Is there a way to subscribe to push topic channel using Salesforce rest api?Hello Rajesh,
Yes, you can create a PushTopic via the REST API.
For example:-
curl https://na1.salesforce.com/services/data/v32.0/sobjects/PushTopic/
-H "Authorization: Bearer token -H "Content-Type: application/json"
-d "@newpushtopic.json"where my newpustopic.json is:-
{
"Name" : "Account",
"Query" : "SELECT Id FROM Account",
"ApiVersion" : 32.0,
"NotifyForOperationCreate" : true,
"NotifyForOperationUpdate" : true,
"NotifyForOperationUndelete" : true,
"NotifyForOperationDelete" : true,
"NotifyForFields" : "All",
}For more infomation, read here.
Hope this will help you.
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 11:25 am in reply to: How do we assign a roll-up summary field value to a variable in Salesforce?Hello Anurag,
You can create a roll-up summary field to display a value in a master record based on the values of fields in a detailed record. The detail record must be related to the master through a master-detail relationship. For example, You can perform different types of calculations with a roll-up summary field. You can count the number of detail records related to a master record. Or, you can calculate the sum, minimum value, or maximum value of a field in the detail records.
For more information:- Read here.
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 11:05 am in reply to: Can we pass whole of the object as a parameter in apex class from the java script controller?Hello Anurag,
Yes, you can pass the whole Object as a parameter in apex class from the javascript controller. Here are the simple steps to do this:-
- Call the apex class method in javascript by using action =component.set("c.nameOfMethod");
- Then pass the parameter using action.setParams("variableNameInMethod": variableNameInJavascriptController);
- Execute the action in javascript.
Hope this will help you.
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 10:31 am in reply to: What is the difference between WhoId and WhatId in the Data Model of Task?Thanks Prachi!
-
Avnish Yadav
MemberAugust 14, 2018 at 10:17 am in reply to: How to show a list in Salesforce lightning component?Hello Anurag,
To show a list in Lightning Component, kindly read this trail:-
https://trailhead.salesforce.com/en/projects/slds-lightning-components-workshop/steps/slds-lc-4
Thanks.
-
Avnish Yadav
MemberAugust 14, 2018 at 8:27 am in reply to: How to create Formula Field on Opportunity in Salesforce?Hello Elizabeth,
My solution is:-
IF(License_Period_months__c = 12, Amount, IF(License_Period_months__c = 24, Amount * 2 * .15, IF(License_Period_months__c = 36, Amount * 3 * .30, 0) ) )
Thanks.
-
Avnish Yadav
MemberAugust 10, 2018 at 1:53 pm in reply to: How can you edit your record from within the lightning:dataTable itself?Hello Shradha,
#Summer18 release was a power-packed release and has a lot to offer. One of the features introduced is lightning is the editable lightning data table.
Not sure how you can do this, no worries, this post is all about this. Follow this post and create your own editable lightning data table.
http://sfdcfacts.com/lightning/editable-lightningdatatable-summer18-feature/
Thanks.
-
Avnish Yadav
MemberAugust 10, 2018 at 6:50 am in reply to: How can we track the status of the current running batch job?Hello Chanchal,
We can track the status of the running batch job by using:-
List<AsyncApexJob> myrunningjob = [Select Id, Status, ApexClass.Name From AsyncApexJob where ApexClassId =: yourclassid order by CreatedDate DESC limit 1];
System.debug('@@@@@ running job status is: @@@'+ myrunningjob[0].status);Thanks.
-
Avnish Yadav
MemberAugust 10, 2018 at 6:48 am in reply to: Why are Visualforce pages served from a different domain?Hello Anurag,
If we see carefully, all our Visualforce pages are served like “c.YOURSERVER.visual.force.com/apex/YOURPAGENAME” ,
And because of this most of time, we run into Same-Origin Policy error in Javascript if we try to access parent page from Iframe. Following reason is explained by one of the evangelists of Salesforce:“The move to separate domains has one very specific purpose: leverage the browser security model (same domain policy) to protect our customers and the salesforce.com service from cross-site scripting and cross-site request forgery attacks.
Moving to the serving pages from separate domains is a critical component of our ongoing commitment to ensure the highest level of security and availability for everyone.
In the world where everything is served from the same domain any custom page that you visit had full access to any other page in your org and also any page served from salesforce.com itself. This included potentially malicious code that was installed as part of a force.com package.”
Thanks.
-
Avnish Yadav
MemberAugust 9, 2018 at 9:04 am in reply to: What is the use of apex:detail component in Salesforce?Thanks.