Gourav Verma
IndividualForum Replies Created
-
Gourav
MemberMay 31, 2016 at 3:26 pm in reply to: Pre-populating fields at record creation in Salesforce Lightning ExperienceYou can use Custom buttons and links that define their content source as URL in Lightning Experience and the Salesforce1 mobile app.
-
Gourav
MemberMay 31, 2016 at 3:22 pm in reply to: Is there any way to validate XML against XSD file in Apex?You have to try to write your own validator for XML validation with custom filters as per your need.
-
Gourav
MemberMay 31, 2016 at 3:12 pm in reply to: Is Duplicate Management detecting duplicate records inside a bulk dml transaction?There are two rules to use in this type of scenarios provided by Salesforce:-
- Duplicate Rule
- Matching Rule
-
Gourav
MemberMay 31, 2016 at 1:21 pm in reply to: Is there any way to catch changes to a user's e-mail signature?Try this code (Modify) to your need
trigger UserTrigger on User (before insert, before update) {
for (User u : Trigger.new) {
System.debug('UserTrigger fired for user ' + u.FirstName + ' ' + u.LastName);
u.SignatureReference__c = u.Signature;
}
}It will run when any user update his/her email signature.
-
Hi Nitish,
Try writing batch Class -which will run Monday morning and Count record where CreatedDate = LAST_WEEK
Hope this will work!
-
Gourav
MemberMay 30, 2016 at 12:01 pm in reply to: How can we differentiate among customer portal, partner portal and community in salesforce?Salesforce portals and communities empower your customers and partners by providing a social forum directly related to your internal business processes so that they can connect with the right information and the right people at the right moments.
Depending on when your organization began using Salesforce, portals may no longer be relevant because they aren’t available for new organizations. Perhaps you’re still holding tight to your organization’s customer portal because it’s what you’ve always known. What you need to know moving forward is that communities are effectively upgraded portals, rebranded as communities.
With a number of features carrying over and a wealth of new enhancements, Salesforce communities allow your organization to pursue your business goals in the following ways:
Business integration: Integrate your business processes with your community to allow customers and employees to collaborate on the same records in the same space.
Social feed: Follow the records you care about most and work together with subject matter experts to resolve customer issues and close deals.
Branding and customization: Customize your communities to align with company branding and messaging. Create a community that will promote your brand and give your customers and employees a seamless experience.
Mobile: Access communities from any of your devices.
Social intelligence: Receive recommendations and content tailored for your interests and business needs within your communities.
Security and scalability: Know that your data and user information is safe with the Salesforce platform because the community is an extension of your internal organization.
Self-service: Empower your customers to help themselves to take the load off your support staff and allow them to focus on your most complex customer issues. -
Hope this will help to share records using Apex:-
public class JobSharing {
public static boolean manualShareRead(Id recordId, Id userOrGroupId){
// Create new sharing object for the custom object Job.
Job__Share jobShr = new Job__Share();// Set the ID of record being shared.
jobShr.ParentId = recordId;// Set the ID of user or group being granted access.
jobShr.UserOrGroupId = userOrGroupId;// Set the access level.
jobShr.AccessLevel = 'Read';// Set rowCause to 'manual' for manual sharing.
// This line can be omitted as 'manual' is the default value for sharing objects.
jobShr.RowCause = Schema.Job__Share.RowCause.Manual;// Insert the sharing record and capture the save result.
// The false parameter allows for partial processing if multiple records passed
// into the operation.
Database.SaveResult sr = Database.insert(jobShr,false);// Process the save results.
if(sr.isSuccess()){
// Indicates success
return true;
}
else {
// Get first save result error.
Database.Error err = sr.getErrors()[0];// Check if the error is related to trival access level.
// Access level must be more permissive than the object's default.
// These sharing records are not required and thus an insert exception is acceptable.
if(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION &&
err.getMessage().contains('AccessLevel')){
// Indicates success.
return true;
}
else{
// Indicates failure.
return false;
}
}
}}
To delete records try this:-
global class deleteSubscribers implements Database.Batchable<sObject>{
global final String Query;
global deleteSubscribers(String q){
Query=q;
}global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}global void execute(Database.BatchableContext BC,List<Subscriber__c> scope){
delete scope;
}global void finish(Database.BatchableContext BC){}
} -
Please follow this link for more information:- https://help.salesforce.com/HTViewHelpDoc?id=collab_enable.htm&language=en_US
-
Gourav
MemberMay 30, 2016 at 11:51 am in reply to: How can I use map to store record from dynamic query?Yes, We have to store map.KeySet or map.values() in either list/set and then use that set and list over there. Because , we can use variable and collection in dynamic SOQL and map.keySet() / map.values() are the method of collection type(map).
-
Please follow this link for more information:- https://support.desk.com/customer/portal/articles/749107-integrating-desk-com-and-salesforce
-
Not a catch per say (IIRC you cannot catch it, especially if Catch Exception did not work) but will solve the problem of regex to complex, use a custom iterator:
Class
public with sharing class Utility_RowIterator implements Iterator<String>, Iterable<String>
{
private String m_Data;
private Integer m_index = 0;
private String m_rowDelimiter = '\n';public Utility_RowIterator(String fileData)
{
m_Data = fileData;
}
public Utility_RowIterator(String fileData, String rowDelimiter)
{
m_Data = fileData;
m_rowDelimiter = rowDelimiter;
}public Boolean hasNext()
{
return m_index < m_Data.length() ? true : false;
}
public String next()
{
Integer key = m_Data.indexOf(m_rowDelimiter, m_index);if (key == -1)
key = m_Data.length();String row = m_Data.subString(m_index, key);
m_index = key + 1;
return row;
}
public Iterator<String> Iterator()
{
return this;
}
}Code
Utility_RowIterator r = New Utility_RowIterator(csv,'\n'); //Replace \n with whatever delineates your row
String firstRow;
if(r.hasNext()) firstRow = r.next(); -
Gourav
MemberMay 30, 2016 at 11:45 am in reply to: How to get the chatter update of case creation from Desk.com to Salesforce org?Hope this will help you. Please follow the link.
-
You can use a standard report type of 'Leads with converted lead information'.
Add a filter of Converted = true
This will give you all your converted leads, the contact, opportunity, and account they are related to, and the lead Id as well
-
you can try doing as below:
Apex :
public Boolean showRecords{get;set;}<br>public List<CustomObject__c> cust {get;set;}<br>//In constructor<br>showRecords =false;<br>public void fetchRecords(){
cust = [Select Field1__c, Field2__c from CustomObject__c limit 1000];// you need to place a limit of 1000 as VF supports max of 1000 recors to be displayed<br>showRecords = true;<br>}VFP:
<apex:pageblock><br><apex:commandButton value="List Records" action="{!fetchRecords}" rerender="pbTable"/>
<apex:pageblocktable value="{!cust}" var="a" id="pbTable" rendered="{!showRecords}">
<apex:column value="{!a.Field1__c}"/>
<apex:column value="{!a.Field2__c}"/>
</apex:pageblocktable >
</apex:pageblock> -
Gourav
MemberMay 30, 2016 at 11:34 am in reply to: API - Is there any API that allows me to check if a Username is in use?No need for an API. Just use synchronous Apex code instead.
Simply create and insert a User in a try and check for the right exception in the catch and always rollback the insert in the finally.
This class should do the job.
public class UserService {
public static Boolean existsName(String fullUserName) {
Boolean result = false;User user = new User();
user.FirstName = 'any';
user.LastName = 'any';
user.Alias = 'any';
user.EMail = '[email protected]';
user.Username = fullUserName;
user.CommunityNickname = fullUserName;
user.LocaleSidKey = 'en_US';
user.LanguageLocaleKey = 'en_US';
user.EmailEncodingKey = 'UTF-8';
user.TimeZoneSidKey = 'America/Los_Angeles';
user.ProfileId = [SELECT Id, Name FROM Profile WHERE Name='Standard User' limit 1].Id;Savepoint sp = Database.setSavepoint();
try {
insert user;
}
catch(DmlException ex) {
if(ex.getDmlStatusCode(0) == StatusCode.DUPLICATE_USERNAME) {
result = true;
}
}
finally {
Database.rollback(sp);
}return result;
}
} -
Look to this link to understand what is salesforce shield:- https://www.salesforce.com/blog/2015/07/introducing-salesforce-shield.html
-
Gourav
MemberMay 27, 2016 at 11:54 am in reply to: How are wsdl2apex generated private member variables referenced?They aren't. They're for generating the SOAP messages associated with the calls. You don't need to worry about them, as the APEX runtime simply uses them to create the SOAP envelope and add the proper schema to the XML in the SOAP message in each call.
-
Gourav
MemberMay 27, 2016 at 11:53 am in reply to: Apex Rest service - heap size issue while uploading attachmentWith Summer '14 release, file size limits for attachments were increased to 25MB, so you should be fine:
-
Gourav
MemberMay 27, 2016 at 11:48 am in reply to: How is Chatter different from social media tools?Chatter uses a lot of the same paradigms that you see on sites like Facebook and Twitter, however, Chatter is completely secure and completely private. At the heart of Chatter is a feed with all of the things you choose to follow, like people, groups, accounts, and opportunities. You are in control. Chatter is not an app for monitoring other social media sites, like Twitter or LinkedIn.
-
Gourav
MemberMay 27, 2016 at 11:46 am in reply to: Can I set up Chatter for just a few of my users to try it out?No, You can't set up chatter for few users. Because Chatter is an org-level switch, you have to turn it on for everyone or for no one. Chatter is much better with everyone using it to share knowledge, expertise, and content.
-
Gourav
MemberMay 27, 2016 at 11:37 am in reply to: How to get the Label of a Formula field dynamically?HI Piyush,
If your goal is to show the label via a visualforce page so you don't have static values per each API field, use the following example within the visualforce page to correctly display the label even if it changes on the administrative side:
{!$ObjectType.Campaign.fields.Name.label}
{!$ObjectType.Campaign.fields.CustomFieldAPIName__c.label} -
Gourav
MemberMay 25, 2016 at 1:14 pm in reply to: What's the best way to migrate attachments from one SF Org to another?There are 2 tools that I know, which help you to migrate attachments from one org to another
- File Exporter
- Moving Attachments
We can't use Dataloader to csv doesn't work because of the binary Body, Dataloader to db seems to have problems with heap sizes and API limits.
-
In the top right of your Salesforce org there is a Help (Help & Training) link. In the pop-up there is a My Cases tab. There you can submit a new Case with type bug.
-
Gourav
MemberMay 25, 2016 at 12:58 pm in reply to: Can the Context User on an Email Service be an API-Only User?It can be an API only profile, but you also need to check that it has the correct accesss to any objects that the class uses.
e.g. If it requires access to a specific object, in that case you would need to make sure the user's profile also has the correct CRUD permission on that object.
-
Gourav
MemberMay 25, 2016 at 12:55 pm in reply to: How to send Visualforce Email using a template from a Salesforce Trigger?In order to use VF Email templates, you have to send an email to a Lead, Contact, or User via setTargetObjectId with the associated merge fields.
I don't believe you can freeform an email address.
Also be aware sending single emails you max out at 10 emails per request, so you'll have to make sure that your trigger doesn't send anymore than 10 emails.
If it does, you'll need to use 'Bulk email' which doesn't allow templates either.