PRANAV
IndividualForum Replies Created
-
PRANAV
MemberMarch 27, 2018 at 11:54 am in reply to: How to get the state and country name when we click on the map, using Leaflet JS in Salesforce?Hi Gourav,
The click function method is as below.
map.on('click', function(e){
$.ajax({ url:'http://maps.googleapis.com/maps/api/geocode/json?latlng='+e.latlng.lat+','+e.latlng.lng+'&sensor=true',
success: function(data){
var state = data.results[0].address_components[5].long_name;
var country = data.results[0].address_components[6].long_name;
var zip = data.results[0].address_components[7].long_name;
$('.leaflet-popup-content').text(state+' '+country+' '+zip);
console.log(data.results[0]);
}
});
popup.setLatLng(e.latlng).setContent('').openOn(map);
});Hope this helps you.
-
PRANAV
MemberMarch 26, 2018 at 1:15 pm in reply to: What are wrapper class? How to use when working with different objects on Visualforce page?Hi Ankit,
A wrapper or container class is a class, a data structure, or an abstract data type whose instances are collections of other objects.
In Apex and Visualforce this type of class can be extremely useful to achieve lot of business scenario.
Using Wrapper class for displaying records from two or three or more objects in a single table (based on the business logic).
Example: Sometimes we need to display data from different objects (not related to each other) in a table.
In the Visualforce community boards one of the most commonly asked questions is, "How can I display a table of records with a check box and then process only the records that are selected?" This is a perfect scenario where a wrapper class can be used.
For more you can search out "Wrapper Class" in the Salesforce Technical Library Documentation.
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 2:08 pm in reply to: When creating a test callout for POST method, Is it necessary to set values of setHeader, setBody?Hi Kapil,
Yes, you need to set the fake response via setBody with all the related fields and setHeader() act as key value pair that Sets the contents of the request header so that 75% of the code must have test coverage.
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 1:44 pm in reply to: How to create many to many relationships between two Salesforce Objects?Hi Kapil,
When modelling a many-to-many relationship, you use a junction object to connect the two objects you want to relate to each other.
Creating the many-to-many relationship consists of:
- Creating the junction object.
- Creating the two master-detail relationships.
- Customizing the related lists on the page layouts of the two master objects.
- Customizing reports to maximize the effectiveness of the many-to-many relationship.
For reference search salesforce documentation "Create a Many-to-Many Relationship".
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 1:42 pm in reply to: Is it possible to insert a Salesforce Parent-Child record in one DML operation?Hi Kapil,
You can use Database.SaveResult[] results = Database.insert(new SObject[] {acc, con});
For more you can refer to the "Creating Parent and Child Records in a Single Statement Using Foreign Keys" standard salesforce document.
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 11:40 am in reply to: How to write the Salesforce Trigger for a Custom Object's Attachment?Hi Archit,
To write a trigger on Attachment you have to use Eclipse. Open your Org in Eclipse then create a new trigger where you will get a picklist to select the Attachment Object. This is the only the way to write a trigger on Attachment. Below is the sample code of the trigger :
// Trigger to update the Attachment__c custom checkbox field in Custom Object(Custom_Obj__c) if it has any attachment.
trigger TiggerName on attachment (after insert)
{
List<Custom_Obj__c> co = [select id, Attachment__c from Custom_Obj__c where id =: Trigger.New[0].ParentId];
if(co.size()>0)
{
co[0].Attachment__c = true;
update co;
}
}
Hope this helps you.
Please let me know if this works out.
-
PRANAV
MemberMarch 23, 2018 at 11:14 am in reply to: How to get the userId of currently logged user in salesforce?Hi,
You can use userinfo class in apex to obtain the information related to logged in user.
You can get Id using userinfo.getUserId() and if userinfo class is not able to provide info use query to query those fields .
On VF you will need to use
<apex:outputText value="{!$User.Id}">
You are using outputfield and hence you are not able to save the codeEdit::
A sample getter setter User object type variable will be handy
public class MailExtension{
public user currentuser{get;set;}
public MailExtension(ApexPages.StandardController cont){
opp =(Opportunity) cont.getRecord();
currentuser=new User();
currentuser=[Select Id,Name,Email from User where Id=:userinfo.getuserId()];
}
}
A sample VF tag or mark up will be as follows<apex:outputfield value="{!currentuser.Id}"/>
<apex:outputfield value="{!currentuser.Email}"/>Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 11:10 am in reply to: How can a user reset or refresh all data, settings and apps on a developer account in Salesforce?Hi,
I did one trick to reset my free developer acc as I have 2 free developer account, in which one is fresh copy and another is fully loaded with metadata.
I deployed fresh copy from eclipse/force.com ide to fully loaded metadata instance, as a result, all the metadata is deleted from my other instance & now it has no classes, pages, triggers etc..But to deploy fresh copy to any other instance, we must required single file in fresh copy instance.
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 11:07 am in reply to: Can we add grandchild data in a single document with Salesforce Apex code using Webmerge?Hi
The above functionality really helps alot.
Can we also send the documents to the child and grandchild record via WebMerge? Please let me know.
-
PRANAV
MemberMarch 23, 2018 at 11:04 am in reply to: How can I create custom picklist on a Salesforce Visualforce Page?Hi Ankit,
VF Page
<apex:page tabStyle="Case" controller="customPicklist">
<apex:form >
<apex:pageBlock title="Custom PickList Demo" id="out">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}" rerender="out" status="actStatusId"/>
<apex:actionStatus id="actStatusId">
<apex:facet name="start">
<img src="/img/loading.gif" />
</apex:facet>
</apex:actionStatus>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Custom Picklist Using selectList and selectOptions">
<apex:selectList value="{!selectedCountry2}" multiselect="false" size="1">
<apex:selectOptions value="{!countriesOptions}"/>
</apex:selectList>
<apex:outputText value="{!selectedCountry2}" label="You have selected:"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock ></apex:pageBlock>
</apex:form>
</apex:page>-------------------------------------------------------------
Apex Controller Class
public with sharing class customPicklist {
public String selectedCountry2{get;set;}
public List<String> selectedCategories { get; set; }public List<SelectOption> getCountriesOptions() {
List<SelectOption> countryOptions = new List<SelectOption>();
countryOptions.add(new SelectOption('','-None-'));
countryOptions.add(new SelectOption('INDIA','India'));
countryOptions.add(new SelectOption('USA','USA'));
countryOptions.add(new SelectOption('United Kingdom','UK'));
countryOptions.add(new SelectOption('Germany','Germany'));
countryOptions.add(new SelectOption('Ireland','Ireland'));return countryOptions;
}public List<SelectOption> getCategories() {
List<SelectOption> categories = new List<SelectOption>();
for(Case c : [Select sahi__MultiSelectPicklist__c from Case limit 10])
categories.add(new SelectOption(c.sahi__MultiSelectPicklist__c, c.sahi__MultiSelectPicklist__c));
return categories;
}
public PageReference save(){
return null;
}}
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 10:55 am in reply to: If I am using workflow and trigger on the same Salesforce object, which one runs first?Hi Ankit,
When a record is saved with an insert, update, or upsert statement, the following events occur in order:
1. The original record is loaded from the database (or initialized for an insert statement)
2. The new record field values are loaded from the request and overwrite the old values
3. All before triggers execute
4. System validation occurs, such as verifying that all required fields have a non-null value, and running any user-defined validation rules
5. The record is saved to the database, but not yet committed
6. All after triggers execute
7. Assignment rules execute
8. Auto-response rules execute
9. Workflow rules execute
10. If there are workflow field updates, the record is updated again
11. If the record was updated with workflow field updates, before and after triggers fire one more time (and only one more time)
12. Escalation rules execute
13. All DML operations are committed to the database
14. Post-commit logic executes, such as sending emailThe above is the Order of Execution in Salesforce.
Hope this will help you more.
-
PRANAV
MemberMarch 23, 2018 at 10:52 am in reply to: How to send Community Welcome Email to a User through Salesforce Apex?Hi Neha,
You can try this using session id and create a url for the user and send back to the user to login https://<endpoint host>/secur/frontdoor.jsp?sid=<session id>"
OR
This particular feature is not very admin friendly (as you found out the hard way:). We chose to uncheck the "Send welcome email" box under Communities > Administration > Emails. We then created a workflow rule on the User object to send out the welcome email to new community users. The workflow rule fires on record creation only as has a criteria for "Profile EQUALS 'Your Community Profile Name(s)'".
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 10:48 am in reply to: Error in Conga Composer while using Conga ConductorHi Ankit,
Might be you need to purchase the license for "Conga Conductor" as your license might be expired.
Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 10:42 am in reply to: Is there any way to know Field's API name on a detail page in Salesforce?Hi Adarsh,
Yeah, 'Salesforce API Fieldnames’ chrome extension helps me too. It's a small and great extension to toggle between API field names and labels on salesforce detail pages.
-
PRANAV
MemberMarch 23, 2018 at 8:29 am in reply to: Is it possible to Deactivate a trigger from Apex in Salesforce? If yes, then how?Hi Ankit,
You could do this from Force.com IDE.
Find the trigger.meta.xml of respective trigger and make this change and deploy.
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>40.0</apiVersion>
<status>Inactive</status>
</ApexTrigger>Hope this helps you.
-
PRANAV
MemberMarch 23, 2018 at 8:15 am in reply to: What is the best suitable extension for Salesforce debug logs?Hi Neha,
You can try with "Salesforce Coding Utility" extension.
-
PRANAV
MemberMarch 22, 2018 at 10:59 am in reply to: How can i achieve a Validation Rule that should not fire for particular user in salesforce? -
PRANAV
MemberMarch 22, 2018 at 9:06 am in reply to: Which workflow rule will update field value if multiple workflow rules are updating the same field?Hi Saurabh,
In Workflow, there’s no way for you to determine which order your workflow rules run in. So there’s always a risk of one rule overwriting what another did.
But if you really want to find it out which workflow is finally changing your field. You can have 2 possible ways:
- Check the field update values of your workflow actions.
- Set the debug log level with workflow set as "finer".
But, yes its not possible to track the order of workflow execution.
Hope this helps you more.
-
PRANAV
MemberMarch 21, 2018 at 2:27 pm in reply to: How to retrieve protected custom settings records via SOQL Query in Salesforce?Hi Kapil,
No, protected Custom Settings aren't updateble from subscriber organization. It is updateble only from the same namespace.
Additionally: If Privacy for a custom setting is Protected and the custom setting is contained in a managed package, the subscribing organization cannot edit the values or access them using Apex.
Hope this helps you.
-
PRANAV
MemberMarch 21, 2018 at 2:16 pm in reply to: How to make a div block rendered on a particular event in Salesforce Lightning?Hi Kapil,
You can render the content inside the div by setting the attribute from javascript controller. As the standard functionality of Saleesforce Lightning, that if you set the attribute from JavaScript then it automatically rerender in the component.
OR
You can put your div tag inside the <aura:if> and set the boolean value from JavaScript. It will rerender automatically.
Hope this helps you.
-
PRANAV
MemberMarch 21, 2018 at 2:13 pm in reply to: How many custom tabs can be created in a salesforce dev org?Hi Kapil,
You can have 100 custom tabs for dev org. For more you can refer to the "Salesforce Developer Limits
Quick Reference". -
PRANAV
MemberMarch 21, 2018 at 2:03 pm in reply to: How to restrict a user from switching to classic from lightning and vice-versa in Salesforce?Hi Kapil,
The permission set is always used to extend the features beyond to profile level in salesforce. If user has permission on profile so you can't remove the access for that using permission set.
Here if you want to prevent user from move back to lightning to classic then go to Lightning >Switch Users to Lightning Experience > there you can Control which users automatically move to the new interface and which remain in Salesforce Classic.
Second, If you want to restrict the behaviour for a user ,then disable at profile and do not assign any permission set that provides access to the lightning experience while assign permission set to users needing the functionality
Hope this helps you.
-
PRANAV
MemberMarch 21, 2018 at 12:02 pm in reply to: Can i modify CreatedDate or LastModifiedDate of EmailMessage object on insert or update?Yes Ratnakar,
In my knowledge, there is no other way through which we can achieve above. But if you come through something by which this can be achieved, please let me know on the same thread. It would be really helpful.
-
PRANAV
MemberMarch 21, 2018 at 11:53 am in reply to: Edit to certain fields in Salesforce Process Builder?Hi Maria,
You can do this with the help of Validation Rule.
Suppose you have to edit "Account Name" OR "Account Number" only on 10th, 20th or 30th day of the month. So you will have to make a validation rule like the below image
Now similarly you can built the validation rule as per your scenario and make this happen.
Hope this helps you.
-
PRANAV
MemberMarch 21, 2018 at 11:15 am in reply to: How can we start preparing for Salesforce Service Cloud Certification?Hi Gaurav,
You have to practice Salesforce Admin on a Service Cloud implementation, to build and experiment with the various Service Cloud features to understand how they work together, what they are used for, and the times you would choose to use one feature instead of another.
You should have hands-on experience implementing Service Cloud solutions and have demonstrated the application of each of the features/functions below:
- INDUSTRY KNOWLEDGE
- IMPLEMENTATION STRATEGIES.
- SERVICE CLOUD SOLUTION DESIGN
- KNOWLEDGE MANAGEMENT
- INTERACTION CHANNELS
- CASE MANAGEMENT
- CONTACT CENTER ANALYTICS
- INTEGRATION AND DATA MANAGEMENT
For more you can go to the Salesforce Certification site {certification.salesforce.com/servicecloud} and study from their standard links and materials.