PRANAV
IndividualForum Replies Created
-
PRANAV
MemberSeptember 16, 2016 at 7:20 am in reply to: How to write test class for a class containing reports and dashboards in Salesforce?Hi Tanu,
You can write your test class as you normally did however this is one of the few places were you have to use the seeAllData=true annotation. IsTest(SeeAllData=true) to open up data access to records in your organization. I will advise that you use this sparingly and make sure that your tests only rely on the data in those reports and not any other objects in your environment.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 16, 2016 at 5:51 am in reply to: How to disable mouse scroll-wheel scaling with Google Maps API in Salesforce?Hi Tanu,
In version 3 of the Google Maps API you can simply set the scrollwheel option to false within the MapOptions properties:
scrollwheel
Type: boolean
If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 15, 2016 at 6:53 am in reply to: How does the Salesforce apex have anything like anonymous inner class?Hi Mohit,
Apex does have inner classes, up to one level deep, and there is no support for anonymous inner classes.
The closest you're going to be able to do is make private inner classes and use those in methods, which half defeats the point. You can use wrapper class under any apex class.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 15, 2016 at 6:39 am in reply to: Is it possible to count how many times an email template was used in Salesforce?Hi Tanu,
Yes , You can find this in particular email template in Times Used field.
NOTE: The field Times Used is not updated when a template is used during an automated process such as the running of an assignment rule to push cases or leads to a users queue.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 15, 2016 at 6:36 am in reply to: How to check code coverage in Salesforce org class page not in developer console?Hi Mohit,
Basically I want to know the line by line code coverage(red and blue lines) as shown in developer console in org class page. Hope now its clear. Please give suggestion.
Thanks
-
PRANAV
MemberSeptember 14, 2016 at 6:19 am in reply to: How can we have one to one relationship between two object in salesforce?Hi Mohit,
You can do this by following these steps:
- Create two objects Manager and Department.
- Then create a Master-Detail relationship between the Department and manager.
- Create a rollup summary field countManager (count) in department.
- Create a validation rule in department object on countManager field. Throw an error "department can be managed by only one manager"when the countManager is greater that 1.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 13, 2016 at 8:18 am in reply to: Docusign Salesforce Integration - picklist field to be associated on Docusign templateHi Prakhar,
You can do this by Merge Fields.
Merge fields are DocuSign custom tags that are integrated with Salesforce objects. When a
custom tag with merge field settings is added to a document, the Salesforce data is imported
into the tag. In addition to pulling data from Salesforce, merge fields can update data in
Salesforce when the information is changed by a signer (this only happens if the Writeback
option is enabled for the Merge Field).Flow these steps to create Merge Field:
- From the force.com apps drop-down list, select DocuSign for Salesforce.
- Click the DocuSign Admin tab.
- Click the DocuSign tab. The DocuSign web application opens in a new browser window.
- From the DocuSign application, click your profile image at the top of the application and
select Preferences.
The DocuSign Account Preferences page is displayed. - In the Navigation Panel on the left side, under the Member Options section, click Custom
Tags. The list of your Merge Fields, custom tags and shared custom tags is shown - Click Add. The Custom Tags page appears
- Select the Relate to Salesforce check box. The Salesforce Object lists appear below the
check box. In the top list, select the Salesforce Object that documents will be sent from and then select the field associated with the tag. - Select the Writeback check box to automatically update the Salesforce data when the data is changed by a signer.
- Type a name for the custom tag in the Label field and review the tag Type.
- Click Save to save the custom tag. The custom tag is ready for use as a Merge Field.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 13, 2016 at 5:33 am in reply to: How can we get the data or acknowledgement in Salesforce after the batch apex process complete?Hi Mohit,
You can get your information in the finish method. You can send some email or something like that.
global void finish(Database.BatchableContext BC){
// Get the ID of the AsyncApexJob representing this batch job
// from Database.BatchableContext.
// Query the AsyncApexJob object to retrieve the current job's information.
AsyncApexJob a = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed,
TotalJobItems, CreatedBy.Email
FROM AsyncApexJob WHERE Id =
:BC.getJobId()];
// Send an email to the Apex job's submitter notifying of job completion.
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {a.CreatedBy.Email};
mail.setToAddresses(toAddresses);
mail.setSubject('Apex Sharing Recalculation ' + a.Status);
mail.setPlainTextBody
('The batch Apex job processed ' + a.TotalJobItems +
' batches with '+ a.NumberOfErrors + ' failures.');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 9, 2016 at 5:49 am in reply to: Detect when a record is being cloned in Salesforce trigger?Hi Tanu,
One approach would be to create a new field, say field__c, which gets populated by a workflow (or trigger, depending on your preference for the order of execution) when blank with the salesforce id of the record. For new records this field will match the standard salesforce id, for cloned records they won't. There are a number of variations on when and how and what to populate the field with, but the key is to give yourself your own hook to differentiate new and cloned records.
Second approach would be , you can override the standard clone button with a custom page that clears the values for a subset of fields using url hacking.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 9, 2016 at 5:25 am in reply to: What kind of formula is used for geolocation distance calculation in salesforce?Hi Mohit,
Distance is calculated as a straight line—as the bird flies—regardless of geography and topography between the two points. In reality Salesforce uses the Haversine formula to calculate the great-circle distance between two points.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 8, 2016 at 5:59 am in reply to: How to remove focus from first input field in Salesforce?Hi Tanu,
You can try this
<script>function setFocusOnLoad() {}</script>
Hope this will work for you.
Thanks
-
PRANAV
MemberSeptember 8, 2016 at 5:48 am in reply to: How can I convert the Set of Id's so that I can use this set into the Dynamic SOQL query that I want to use it with IN Comparison.Hi Mohit,
Bind variables actually work in dynamic SOQL:
Map<Id,Account> accts = new Map<Id,Account>([select Id from Account]);
Set<Id> accountIds = accts.keySet();
String q = 'select id from Contact where AccountId in :accountIds';
List<Contact> cts = Database.query(q);You can try the above code as an example.
Note that you can't embed method calls (e.g. AccountId in :accts.keySet() would fail) when binding in this way.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 7, 2016 at 11:58 am in reply to: How to access profile permissions via Salesforce API?Hi Tanu,
If you want to find the CRUD permissions of a profile you can use this code:
SELECT Id, SObjectType, PermissionsRead, PermissionsCreate
FROM ObjectPermissions
WHERE parentid in (select id from permissionset where
PermissionSet.Profile.Name = 'System Administrator')Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 6, 2016 at 6:25 am in reply to: Is it is possible to force to store information even if the trigger throws an exception?Hi Tanu,
There is a way to prevent a DML operation from succeeding without causing the whole apex transaction to be rolled back (like @future, emails, DML, etc.): the sObject.addError method. If you call this method on every sObject in your trigger it will prevent them all from being committed to the database, however any other DML operations you perform (that of course, do not cause errors in their own triggers) will be committed successfully.
If you're looking to log to a custom object this is your best bet; catch the exception, mark everything in Trigger.new with addError, then commit your log sObject.
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 6, 2016 at 5:18 am in reply to: How to use images in email template in salesforce?Hi Tanu,
You can include images or logos on your HTML and Visualforce email templates.
When creating custom HTML or Visualforce templates, simply include img tags that reference the image.
For example, for HTML:
<img src="https://yourInstance.salesforce.com/servlet/servlet.ImageServer?
id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=1270576568000" alt="Company Logo"
height="64" width="64"/>Visualforce example:
<apex:image id="Logo" value="https://yourInstance.salesforce.com/servlet/servlet.ImageServer?
id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=127057656800"
height="64" width="64"/>Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 5, 2016 at 6:31 am in reply to: How can we generate the random string in Salesforce?Hi Mohit,
Try this code
public class generateRandomString {
public static String generateRandomString(Integer len) {
final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
String randStr = '';
while (randStr.length() < len) {
Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
randStr += chars.substring(idx, idx+1);
}
return randStr;
}
}Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 5, 2016 at 6:05 am in reply to: How can we add confirmation dialog on the command button in visualforce page?Hi Mohit,
I have done is to wrap the return in an if statement and call it only if the condition is correct. The code below will call return if the confirmation is false.
<apex:commandButton action="{!cancel}" value="Delete" onclick="if(!confirm('Are you sure?')){return false};"/>
Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 2, 2016 at 5:54 am in reply to: What is difference between the getvalue() and getinstance method in custom settings?Hi Mohit,
- Both returns same Object when used for list custom setting. I personally prefer the getInstance() method as it makes more sense to me. You can access a record by using the value in the Name column (you cannot use the ID or other columns).
Foundation_Countries__c myCS1 = Foundation_Countries__c.getValues('United States');
String myCCVal = myCS1.Country_code__c;
Foundation_Countries__c myCS2 = Foundation_Countries__c.getInstance('United States');
String myCCInst = myCS2.Country_code__c;
system.assertEquals(myCCinst, myCCVal);The above example confirms that both return same .
- getInstance() and getValues() do not always return the same object for hierarchical custom settings (although they do for list custom settings).
getInstance() gets you the merged values for all hierarchy levels above and including its argument (so if the user with id myUserId has a null value for a field, getInstance(myUserId) can inherit a value from the user's profile or the org-wide defaults).
getValues() gets you the record as specified for its argument (so if the user with id myUserId has a null value for a field, getValues(userId) will always have a null value for the field).Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 1, 2016 at 6:05 am in reply to: Can I upload two or more CSV files simultaneously with the help of some APIs or services or apps?Hi Mohit,
I don't think this could be done using the standard functionality, So you could try using a app (Like EasyUpload Attachments (Free) , Cloud Drop , etc ) for the same.
Apart from this I beleive Data Loader could also be used to upload multiple attachments.
NOTE: To upload attachments:
Confirm that the CSV file you intend to use for attachment importing contains the following required columns (each column represents a Salesforce field):
ParentId - the Salesforce ID of the parent record.
Name - the name of the attachment file, such as myattachment.jpg.
Body - the absolute path to the attachment on your local drive.Hope this helps you.
Thanks
-
PRANAV
MemberSeptember 1, 2016 at 5:56 am in reply to: How can we implement a lightning component in a webpage?Hi Tanu,
First, You can add Lightning component to Visualforce Page. Then , Assign Visualforce pages to the Force.com Site to make a webpage.
You only have to use a few lines of Visualforce markup to get up and running with Lightning Components for Visualforce.
<apex:page>
<apex:includeLightning /><div id="lightning" />
<script>
$Lightning.use("c:lcvfTest", function() {
$Lightning.createComponent("ui:button",
{ label : "Press Me!" },
"lightning",
function(cmp) {
// do some stuff
});
});
</script>
</apex:page>Hope this helps you.
Thanks
-
PRANAV
MemberAugust 31, 2016 at 11:31 am in reply to: How can we send a request for reapproval of a process after some point time?Hi Mohit,
Yes , you can request for re approval of an approval process after some interval of time to same user in approval history in sobject page layout .
You can also select a recall action in your approval process for another action .
Hope this helps you.
Thanks
-
PRANAV
MemberAugust 31, 2016 at 8:21 am in reply to: How can be able to update the field on the basis of selection of value from a picklist value in an object?Hi Mohit,
You can done this by various methods like:
- You have to create a second picklist which has some choices like choice 1, choice 2 and then make it dependant on the selection picklist so that if in selection picklist option 1 is selected, choice 1 is the only option.
if(ispickval(field name, "option 1"), " choice 1","None"
- Setup>Create>Workflow >Workflow Rule
The Rule Criteria should be set as:
Lead Stage EQUALS (Then put your stage)
Add the workflow action (New Field Update) > Set it to update the date field you want populated > Use formula to set new value > Set the formula: TODAY()
Hope this helps you.
Thanks
-
PRANAV
MemberAugust 31, 2016 at 7:46 am in reply to: How can we use images in Visualforce generated PDFs which are not static resources?Hi Tanu,
The trick is that any external URLs you want Salesforce to make a HTTP(s) call to need to be defined under Setup > Security Controls > Remote Site Settings. Make sure the protocol (HTTP vs HTTPS) matches the image link!
Hope this helps you.
Thanks
-
PRANAV
MemberAugust 30, 2016 at 1:08 pm in reply to: Docusign Salesforce Integration - how to get Integrator Key?Hi Prakhar,
Follow these steps:
- Log on to your demo account.
- In the DocuSign Console menu bar, click Preferences. The Account Preferences page appears.
- Scroll down and under Account Administration click API.
- Create a new key:
Below the Active Integrator Keys table, type a Key Description.
Click Request Key adjacent to the bolded key information. The key is added to the Active Integrator Keys table. - Add the Integrator Key to your code for use as described below in Integrator Key Usage and in the Authentication section. The API page also has examples of how to use an integrator key. You can test your integrator key in the demo environment.
- When you are ready to certify your code for the production account, return to the API page and review the Integration and Certification Steps. Click the DocuSign Developer Center link and find the link to start the DocuSign Certification process. A message with an access code is sent to your listed email address. Follow the instructions to access the envelope and fill out the information.
- After starting the DocuSign Certification process, you will need to request migration of your Integrator Key to the Production environment. In the Active Integrator Keys table, find the key you are using in your application. Click the Request Migration to Production link adjacent to that Integrator Key.
Hope this helps you.
Thanks
-
PRANAV
MemberAugust 30, 2016 at 12:53 pm in reply to: How can we send a sms to the contact number if any changes occurs in some specified fields?Hi Tanu ,
Yes , you can send sms to the contact number by writing a Trigger on contact updation with the help of various apps (like Messaging made easy, send notifications or messages – voice, text, email – IoT ; CallHub – Automated SMS and Voice Messages ; etc) in appexchange (some are free and some are paid apps) the sms function calls.
Hope this helps you.
Thanks