Saurabh Gupta
IndividualForum Replies Created
-
Saurabh
MemberJune 24, 2019 at 10:56 am in reply to: Need help on 'Fire approval' process on Lead merge?Hi,
Can you please provide the information of the Approval Process that you have created on Lead ?
Thanks.
-
Saurabh
MemberFebruary 12, 2018 at 8:26 am in reply to: Why Salesforce batch apex class and methods using global keyword?Hello Ankit
A Database.Batchable class has to be a top-level class (not an inner class) but can now be public.
When Database.Batchable was first available, implementors had no choice but to use the globalaccess modifier. For people creating managed packages, this had the very unfortunate consequence of making any Database.Batchable part of the managed package's API whether you wanted it to be or not. global makes a class usable by code outside of a managed package; public makes a class usable by any class within the managed package or within a non-packaged set of source code.
This error has been corrected so that you now have the choice of making the Database.Batchable public or global and public is the right choice most of the time. Unfortunately I don't think the documentation has been updated.
private not global or public is the right access modifier for fields most of the time. Sometimes final is helpful in communicating intent to the reader and/or enforcing its constraint. But a more important point about fields in a Database.Batachable implementation class is that state is not maintained in fields between invocations of the methods unless the implementation class is also marked as Database.Stateful.
Hope it helps
Thanks
-
Saurabh
MemberJanuary 9, 2018 at 1:50 pm in reply to: What are the differences between Workflows and Process Builder in Salesforce?Hi Suryadeep
You can use the Process Builder to perform these actions :
Update any related record
Use a quick action to create a record, update a record, or log a call
Launch a flow
Send an email
Post to Chatter
Submit for approval
Call apex methodsWorkflow does only 4 actions:
Create Task
Update Field
Email Alert
Outbound MessageInstead You can do everything you can do with workflows using process builder.
With process builder, you can also update all child records starting from the parent record, which is not possible with workflows (only vice versa is possible using cross object field updates).
Only thing you can't do with process builder that you can do with Workflow is sending Outbound message without code.However workaround of this limitation by calling apex code from a process.
Hope it may help you.
-
Saurabh
MemberMay 31, 2017 at 10:07 am in reply to: How to implement jquery function in Lightning Component?Hi Suraj
Sorry for this I posted answer of your other question which is:- Difference Between LocalComponentId and GlobalComponentId in Salesforce Lightning.
-
Saurabh
MemberMay 31, 2017 at 10:03 am in reply to: Difference Between LocalComponentId and GlobalComponentId in Salesforce Lightning?Hi Suraj
A local ID is an ID that is only scoped to the component. A local ID is often unique but it’s not required to be unique.
Create a local ID by using the aura:id attribute. For example:
Find the button component by calling cmp.find(“button1”) in your client-side controller, where cmp is a reference to the component containing the button.
find() returns different types depending on the result.
If the local ID is unique, find() returns the component.
If there are multiple components with the same local ID, find() returns an array of the components.
If there is no matching local ID, find() returns undefined.
To find the local ID for a component in JavaScript, use cmp.getLocalId()Globalid
Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A global ID (1) is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.
for more info:https://developer.salesforce.com/docs/atlas.en-us.206.0.lightning.meta/lightning/components_ids.htm
Hope it may help
-
Saurabh
MemberMay 31, 2017 at 10:00 am in reply to: How to implement jquery function in Lightning Component?Hi Suraj
A local ID is an ID that is only scoped to the component. A local ID is often unique but it’s not required to be unique.
Create a local ID by using the aura:id attribute. For example:
Find the button component by calling cmp.find("button1") in your client-side controller, where cmp is a reference to the component containing the button.
find() returns different types depending on the result.
If the local ID is unique, find() returns the component.
If there are multiple components with the same local ID, find() returns an array of the components.
If there is no matching local ID, find() returns undefined.
To find the local ID for a component in JavaScript, use cmp.getLocalId()Globalid
Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A global ID (1) is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.
For more info:https://developer.salesforce.com/docs/atlas.en-us.206.0.lightning.meta/lightning/components_ids.htm
Hope it may helps
-
Saurabh
MemberMay 31, 2017 at 6:40 am in reply to: I have an opportunity formula text field that is either "Yes" or "No", and I want to create a roll-up account field that specifies if there is at least one oppoHi Suraj
Do you have access to workflows in your edition? Perhaps the WFR could update the value in a field when it matches the criteria (ex: "1"). Since the field would be an actual value and not a formula, you could then use that field in the roll up?Would this work
Let me know if this helps
-
Saurabh
MemberMay 31, 2017 at 6:33 am in reply to: How can I delete Streaming API Push Topics in salesforce?Hi Suraj
Open Developer Console by clicking your name up top-right:
Go to Debug > Execute Anonymous:
Then select your PushTopic(s) by name and delete them:
List<PushTopic> pts = [SELECT Id FROM PushTopic WHERE Name = 'Channel'];
Database.delete(pts);Hope it may help
-
Hi Suraj
You can refer to:http://www.jitendrazaa.com/blog/salesforce/json-output-in-visualforce/
also to this:https://salesforce.stackexchange.com/questions/136710/rest-json-response-to-vf-page
Hope it may help
-
Saurabh
MemberMay 29, 2017 at 11:11 am in reply to: What is the purpose of using generateDigest method of Crypto Class?Hi Suraj
generateDigest(algorithmName, input)
Computes a secure, one-way hash digest based on the supplied input string and algorithm name.
Signature
public static Blob generateDigest(String algorithmName, Blob input)
Parameters
algorithmName
Type: String
Valid values for algorithmName are:MD5
SHA1
SHA-256
SHA-512
input
Type: Blob
Return Value
Type: Blob
Example
Blob targetBlob = Blob.valueOf('ExampleMD5String');
Blob hash = Crypto.generateDigest('MD5', targetBlob);Hope it may help
-
Saurabh
MemberMay 22, 2017 at 2:54 pm in reply to: What is Inbound Message and Outbound Message in Salesforce?Hi Suraj
Basic Difference.
Inbound Message
Inbound is basically when some other tool hits your instance(wsdl) with a payload and you process it and acknowledge it. EG, if an incident gets created in a third party tool then an incident gets created in a service now . Here we accept the request and process it.
Outbound Message
When we hit any other tool then its outbound. EG exactly opposite to the above eg, when an incident gets created in Service now, a similar incident should get created on the other tool. Here we prepare the payload and hit the other tool's wsdl.
Hope it may help
-
Saurabh
MemberMay 22, 2017 at 2:49 pm in reply to: How To Assign Permission Set For Multiple Users Through Salesforce Data Loader?Hi Manpreet
Below are the steps:-
>> Make sure you have 2 columns in the file (User id & Permission set id)
>> Open the Dataloader--Check the checkbox "Show all objects)--Select the Object as "Permission set assignment"
>> Columns in the Dataloader mapping:- User id=Assignee id & Permission set id=Permission set idNote:- Select the Insert action.
For more info:http://www.infallibletechie.com/2013/05/how-to-assign-permission-set-for.html
Hope it may help you:
-
Saurabh
MemberMay 22, 2017 at 2:45 pm in reply to: What is the difference between Queue and Public Group?Hi Suraj
Queue and groups are both are same ,which will hold group of users, But in working environment we can functionality we need to decide which will use in proper way,
Suppose in the case of Lead Assignment,
1 . Scenario like Each user should assigned to at least one lead and same number of leads.
That means user need to handle assigned lead individually and all users in organization should assigned with same number of leads, in this case we can define users in organization as Queue and assign them one by one and in same number using round robin lead assignment.In this case we can achieve above scenario.
2 . Suppose you need to Share some of the information in your organization among some users, in this we can define Group ,then we can share information or we assign some work to group.Here this is Group effort.
Hope it may help you
-
Saurabh
MemberMay 22, 2017 at 2:44 pm in reply to: How Can We Bypass Workflow Rules When Using The Salesforce Data Loader?Hi Manpreet
Deactivating triggers and validation rules may be a solution if you don't have to do that every day.
A best alternative is to include that in your business logic having an hidden checkbox you set to TRUE when you want to bypass the triggers, validation rules and workflow.
Then, you have to ckeck the value of this field for every component you want to allow the bypass.yyou can refer to this link
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009FRoIAM
hope it may help you
-
Saurabh
MemberMay 17, 2017 at 3:17 pm in reply to: How can you monitor future actions of time based workflow?Hi Suraj
You can refer tohttp://ledgeviewpartners.com/blog/salesforce-monitor-time-based-workflow-rules/
you can also refer to this:https://help.salesforce.com/articleView?id=workflow_queue.htm&type=0
Hope it may help
-
Hi Suraj
If you want to show a value dynamically based on a aura:attribute, generally we tend to use: {!v.attrib}
Eg: <ui:button label="{!v.attrib}" />
So if you do cmp.set('v.attrib','test'), then aura:framework automagically does an dirty checking and changes the value accordingly.(Two-way binding)
So the label of the <ui:button> is set to test, just think of this as special expression that directly point to the live reference of the attribute in the component(JS perspective), which is quiet similar to {{v.attrib}} expression in Angularjs which eventually does the same thing.
What if you want to show a value dynamically based on a aura:attribute but it needs to work only once,when it is rendered in the view initially.
So you should go with : {#v.attrib} expression, which might improve the performance if there large no.of such expression(where you don't need such bindings), because it won't be taken into account during dirty checking.AngularJS also has the same one-way binding stuff in its armour : {{::v.attrib}}
Hope it may help
-
Saurabh
MemberMay 15, 2017 at 11:53 am in reply to: Can i pass the set in apex:repeat in Salesforce?Hi Suraj
You can definitely use a Set in a repeat
In the Controller. The property and initializing it in the Constructor, for example's sake:
public with sharing class TestController {
public Set<String> aset { get; set; }public TestController () {
aset = new Set<String>{'a','b','c'};
}
}The Visualforce snippet:
<apex:repeat value="{!aset}" var="a">
<apex:outputText value="{!a}"/><br/>
</apex:repeat>Hope it may help
-
Saurabh
MemberMay 15, 2017 at 11:51 am in reply to: Inline editing in apex:pageBlockTable using inlineEdit modeHi Manpreet
You can do it by using tag <inlineeditsupport>
Here you can know more about ithttps://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inlineEditSupport.htm
Hope it may help you
-
Saurabh
MemberMay 15, 2017 at 11:30 am in reply to: In Salesforce, can i make callout after Dml insert or any dml operation?Hi Suraj
Sometimes a developer needs to create a record and then update it with information provided by a Web Service. However, a Web Service Callout may not occur after a DML statement within the same transaction. To achieve the required action, the transaction must be separated into two parts so that the DML transaction is completed before the Web Service Callout occurs.
Resolution
This workaround splits the transaction into two separate Ajax processes. The first inserts the record and the second performs the callout and is able to update the newly inserted record.
TestWsCallout.page
<apex:page controller="TestWsCallout" tabstyle="Account">
<apex:form >
<apex:actionFunction action="{!InsertRecord}" name="InsertRecord_JS" Rerender="statuses" status="Status1" oncomplete="CallWebService_JS();"/>
<apex:actionFunction action="{!CallWebService}" name="CallWebService_JS" status="Status2" reRender="statuses, msg"/>
<apex:outputPanel id="statuses">
<apex:actionStatus id="Status1" startText="...Inserting Record Into DB..." />
<apex:actionStatus id="Status2" startText="...Calling Web Service..." />
</apex:outputPanel>
<apex:outputPanel id="msg">
<apex:pageMessages />
</apex:outputPanel>
<div><input name="DoAction" class="btn" type="button" value="Do Action" onclick="InsertRecord_JS();return false;"/></div>
</apex:form>
</apex:page>TestWsCallout.cls
public class TestWsCallout{
Account myAccount;
public PageReference InsertRecord() {
myAccount = new Account(name = 'Test Account');
insert myAccount;
// Calling a Web Service here would throw an exception
return null;
}public PageReference CallWebService() {
// Execute a call to a Web Service
HttpRequest req = new HttpRequest();
req.setEndpoint('http://MyWebService12345678790.com?id=' + myAccount.Id);
req.setMethod('GET');
HttpResponse response = new Http().send(req);// Simulate an update
myAccount.Name = 'Test Account 2';
update myAccount;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'WebService Called on New Account: ' + myAccount.Name));
return null;
}
}Hope it may help
-
Saurabh
MemberMay 15, 2017 at 11:24 am in reply to: Which fields should we make Transient in Controller of a Visualforce Page?Hi Manpreet
Because the view state is data serialized and stored on your user’s client, it can affect your Visualforce page’s performance, and thus, your user’s experience. Not only can a large view state slow down your Visualforce page’s load time, it’s subject to a maximum view state size governor limit of 135K.
Fortunately, you can add the transient keyword to your properties to prevent them from being included in the view state, as shown here:
1
transient public List<Lead> allLeadsCreatedThisYear = [Select Name, Id From Lead Limit 50000];
Properties loaded with large collections in your controller not directly referenced by your Visualforce page are good candidates for the transient modifier. Consider whether you’ll need to recreate the property every time the page reloads, say, when a user invokes a method by clicking a button. Including the property in the view state eliminates the need for your controller to re-create it on every page load. You’ll have to decide whether it’s better for your application to have a larger view state or have more processing done on each page load.The Salesforce Winter ’14 Release is piloting (at the time of this writing) a new feature that allows a Visualforce page’s view state to be stored on the server rather than the client, eliminating the need to send the view state back and forth between the two. This feature resolves some of the issues raised in this section by reducing the amount of data transferred with each page request.
The new feature is especially useful for mobile apps. These apps run on devices that are more likely to have low bandwidth or high latency. Because the view state currently gets sent back and forth between the server and client, bandwidth and latency can affect the speed of this interaction. (See Chapter 14 for more details.) When the view state is only stored on Salesforce’s server, no back-and-forth is required, freeing up bandwidth for other functions.
Hope it may help
-
Saurabh
MemberMay 15, 2017 at 7:26 am in reply to: What is the use of Field indexed in Salesforce Objects?Hi Suraj
Improve performance with Custom indexes using Selective SOQL Queries
You can refer to-https://help.salesforce.com/articleView?id=000006007&language=en_US&type=1
Hope it may help you
-
Saurabh
MemberMay 15, 2017 at 7:23 am in reply to: Where to use before update and after update in Salesforce?Hi Suraj
You can find the info on this Apex documentation.
For Before update
Triggerevent -Event Can change fields usingtrigger.new
Allowed.
Triggerevent- Can update original object using an update DML operation
Not allowed. A runtime error is thrown.
Triggerevent-Can delete original object using a delete DML operation
Not allowed. A runtime error is thrown.
For After Update
Triggerevent -Event Can change fields usingtrigger.new
Not allowed. A runtime error is thrown, astrigger.new is already saved.
Triggerevent- Can update original object using an update DML operation
Allowed. Even though a bad script could cause an infinite recursion doing this incorrectly, the error would be found by the governor limits.
Triggerevent-Can delete original object using a delete DML operation
Allowed. The updates are saved before the object is deleted, so if the object is undeleted, the updatesbecome visible.
Hope it may help you
-
Saurabh
MemberMay 12, 2017 at 1:57 pm in reply to: How can i disable triggers, Validation Rules and workflow rules in salesforce org ?Hi Suraj
Custom settings are available from both Workflows and Triggers. If you create a "Hierarchy" custom setting object with a checkbox you can reference that checkbox to enable/disable the validation or code. The hierarchy design would allow you to set system wide defaults and then override individual users as needed. Its been pretty effective in a number of occasions.
Hope it may help you
-
Saurabh
MemberMay 12, 2017 at 1:54 pm in reply to: System.Exception: Too many SOQL queries: 101 [duplicate]Hi Suraj
To fix the issue related to "System.Exception: Too many SOQL queries: 101 [duplicate]", you'll need to change your code in such a way that the number of SOQL fired is less than 100. If you need to change the context then you can use @future annotation which will run the code asynchronously.
Here are some best practices that will stop the error messages and/or help you avoid hitting the Governors Limit:
1. Since Apex runs on a multi-tenant platform, the Apex runtime engine strictly enforces limits to ensure code doesn't monopolize shared resources. Learn about the Governors Limit.
2. Avoid SOQL queries that are inside FOR loops.
3. Check out the Salesforce Developer Blog where you can find Best Practices for Triggers.
4. Review best practices for Trigger and Bulk requests on our Force.com Apex Code Developer's Guide.
5. Be sure you're following the key coding principals for Apex Code in our Developer's Guide.
Important: Salesforce cannot disable the Governors Limit or raise it. Following the best practices above should ensure that you don't hit this limit in the future.Hope it may help you
-
Saurabh
MemberMay 12, 2017 at 1:52 pm in reply to: How can i call Apex Controller Method from HTML tag?Hi Suraj
So if you want to work with a "plain" HTML (for example to reduce the page view state size) you can use JavaScript Remoting controls or just attach an action function to your button:
<input type="button" name="submit" id="searchSubmit" onclick="doSomething();"/>
<apex:actionFunction name="doSomething" action="{!myApexMethod}" reRender="somePanel"/>
Hope it may help you