Surbhi Sharma
IndividualForum Replies Created
-
Surbhi
MemberSeptember 8, 2016 at 2:12 pm in reply to: We are using an email template to send emails but Can we send that Email as cc and bcc. Is there a way to get around this?Hi Pranav,
If you are using workflow email alerts to send emails, then you can set email as CC from email alert. If you are sending from code, then you can use setBccAddresses(bccAddresses) and setCcAddresses(ccAddresses) from SingleEmailMessage Methods.
Thanks
-
Surbhi
MemberSeptember 8, 2016 at 1:52 pm in reply to: How can I get 'Recent Items' object Ids in Salesforce Apex (soql) is it possible?Hi Tanu,
Below is the SOQL sample query:
SELECT Id, Name FROM RecentlyViewed WHERE Type IN ('Account', 'Contact') ORDER BY LastViewedDate DESC
Thanks
-
Surbhi
MemberSeptember 8, 2016 at 8:34 am in reply to: Post Install Script in Salesforce for deleting custom object dataHi Bhavesh,
In the for loop, where you are deleting the record, you are performing DML operation inside the for loop and we can perform only limited DML operation in a thread.
Instead of deleting this in for loop, you can add the records to a list and then delete that list. But as you are querying the custom object data into a list, then there is also limit of querying into a list.
So, I would suggest using a batch class for this as it will handle really a huge amount of data. Please refer the below sample code for executing batch class from Post Install Script:
public without sharing class InstallationSystem implements Database.Batchable<SObject>, InstallHandler {
public void onInstall(InstallContext ic) {
// Initialize some data here
Database.executeBatch(this);
}
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator([some query]);
}
public void execute(Database.BatchableContext bc, Sobject[] records) {
}
public void finish(Database.BatchableContext bc) {
}
}I hope this will help you.
Please let me know if you have any query.
Thanks
-
Surbhi
MemberSeptember 7, 2016 at 6:18 am in reply to: In Salesforce, how can I tell the day of the week on a date?Hi Mohit,
You can try the below code:
Datetime dt = DateTime.newInstance(Date.today(), Time.newInstance(0, 0, 0, 0));
String dayOfWeek=dt.format('EEEE');
System.debug('Day : ' + dayOfWeek);Thanks
-
Surbhi
MemberSeptember 6, 2016 at 1:35 pm in reply to: How can we schedule a class to run every 30 min in Salesforce?Hi Mohit,
You can try below code:
system.schedule('Scheduled hourly job ', '0 0 0/1 1/1 * ? *', new NameOfBatchClassScheduler());
system.schedule('Scheduled hourly job', '0 30 0/1 1/1 * ? *', new NameOfBatchClassScheduler());The first will schedule class for i.e. 10:00 , 11: 00,...etc. and the second will for i.e. 10:30, 11:30,.. etc.
Thanks
-
Surbhi
MemberSeptember 6, 2016 at 1:26 pm in reply to: How can we disable the command button after first click?Hi Mohit,
You can use a JavaScript function for disabling the custom button. This function will run with "onclick" event of the button.
Thanks
-
Surbhi
MemberAugust 31, 2016 at 5:00 pm in reply to: How can I store/manage username and password of multiple salesforce orgs?Hi Pranav,
An extension, which I used for this purpose, is Force.com LOGINS Options. You can use it.
Thanks
-
Surbhi
MemberAugust 30, 2016 at 5:41 pm in reply to: Is there any way to get the id's of only inserted accounts not the updated accounts id? How this can be done through apex?Hi Pranav,
Please refer below code:
Account acct = new Account(Name='SFDC Account');
insert acct;system.debug("Inserted Account Id = "+acct.Id);
As much I get from your question, this will give you id of inserted account. Please let me know if you have any query.
Thanks
-
Surbhi
MemberAugust 30, 2016 at 5:36 pm in reply to: Is it possible to call a single batch job from multiple schedule apex?Hi Tanu,
This won't cause you any problems. The execution context will be different each time the batch job is fired.
Thanks
-
Surbhi
MemberAugust 30, 2016 at 1:45 pm in reply to: How can be a future annotation be used in a trigger? Is that trigger works in synchronous manner or asynchronous manner?Hi Pranav,
You just have to add @future in the trigger. This annotation is executed asynchronously when Salesforce has available resources. It is mainly used if in case, there are some calculation on an object, which is to be done after insert but no matter with the user operation. Then this can be done asynchronously with this future annotation. It can also be used to calls to external web services.
Thanks
-
Surbhi
MemberAugust 30, 2016 at 12:44 pm in reply to: How to create custom fields of standard or custom object through apex code?Hi Tanu,
You can refer to Metadata API document. Also please have a look on below code:
CustomObject co = new CustomObject();
co.setFullName(objectName+"__c");
co.setDeploymentStatus(DeploymentStatus.Deployed);
co.setDescription("Created by the WSC using the Metadata API");
co.setLabel(displayName);
co.setPluralLabel(displayName+"s");
co.setSharingModel(SharingModel.ReadWrite);
co.setEnableActivities(true);// create the text id field
CustomField field = new CustomField();
field.setType(FieldType.Text);
field.setDescription("The custom object identifier field");
field.setLabel(displayName);
field.setFullName(objectName+"__c");
// add the field to the custom object
co.setNameField(field);AsyncResult[] ars = metadataConnection.create(new CustomObject[] { co });
Thanks
-
Surbhi
MemberAugust 26, 2016 at 3:46 pm in reply to: How can we do build test class for the pagereference method?Hi Mohit,
You can refer to below code:
@isTest
private class testMyController{private static testMethod void testAutoRun() {
test.startTest();
PageReference pageRef = Page.yourPageName;
Account acc = new Account(Name='Abce');
insert acc;
Opportunity testOppty = new Opportunity();
testOppty.name='testOppty';
testOppty.AccountId=acc.id;
testOppty.StageName='Open';
testOppty.CloseDate=System.today();
insert testOppty;
Test.setCurrentPage(pageRef);
pageRef.getParameters().put('id',testOppty.id);
ApexPages.StandardController sc = new ApexPages.standardController(testOppty);
Myclass controller = new Myclass(sc);
System.assertNotEquals(null,controller.autoRun());test.stopTest();
}}
Thanks
-
Surbhi
MemberAugust 26, 2016 at 3:05 pm in reply to: What is the difference between ?id= and &id= in url field?Hi Pranav,
When you have to provide multiple parameters in the url, then you use & for separating the parameters. Otherwise use ?id= .
Thanks
-
Surbhi
MemberAugust 26, 2016 at 2:29 pm in reply to: How can we compare the multiple record fetch from soql query to each other?Hi Mohit,
You can use aggregate functions here. Use field in Group By for criteria of comparison.
Thanks
-
Surbhi
MemberAugust 26, 2016 at 2:23 pm in reply to: How to create a new field automatically in related contact when a checkbox is checked on account page?Hi Tanu,
You can achieve this using trigger and for creating new field from apex, you have to use SOAP version of the API (Metadata API).
Thanks
-
Surbhi
MemberAugust 26, 2016 at 2:19 pm in reply to: How can I concatenate two fields into a custom Salesforce field?Hi Pranav,
You can create a formula field that will display the concatenated value.
The formula field would be of type text and would have formula similar to
FieldName1+ ' ' +FieldName2
Thanks
-
Surbhi
MemberJune 30, 2016 at 2:33 pm in reply to: How can we restrict user to login only through federated SSO?Hi Naman,
Please follow the below approach:
Setup > Domain Management > My Domain
1. Enable MyDomain.
2. Follow the instructions to set it up and deploy to users.
3. Set "Require login from <mydomain>" to True.Browse to: Setup > Security Controls > Single Sign-On Settings
4. Set "Identity Provider Login URL" to the URL users should be forced to log in.
5. Set "Entity Id" to the <mydomain> value.* Note: The above process may take up to 48 hours for domain name propagation.
Thanks
-
That's Great !
Thanks
-
Surbhi
MemberJune 24, 2016 at 2:30 pm in reply to: What is the difference between list custom setting and hierarchy custom setting?Hi Prabhat,
Thanks for providing this information. Can you please provide some examples of using hierarchy custom settings in apex ?
Thanks in advance
-
Surbhi
MemberJune 23, 2016 at 2:11 pm in reply to: Is it possible to add a text or button to Salesforce1 header?Hi Danna,
I think you can try using CSS for this
Thanks
-
Hi Prakhar,
I tried this in my developer org and what I found is: In the left hand side section in lightning experience consists of tabs , not apps. So, for accessing apps, you have to click on the App Launcher, then you can see you apps. On clicking on any of app, will show all the tabs included in that app.
Thanks
-
Hi Himanshu,
Dynamic Apex can only be access-able for the components with which the code is packaged. To provide access to standard objects not included in the package, the developer must set the API Access.
Thanks
-
Surbhi
MemberJune 22, 2016 at 2:11 pm in reply to: How to open links in Lightning-Experience Setup in other browser-tabs and browser-windows?Hi Himanshu,
I am also looking for this. Can anyone please provide any information regarding this?
Thanks
-
Surbhi
MemberJune 21, 2016 at 2:37 pm in reply to: Is it possible to combine a native binary with a Lightning component?Hi Karen,
I think it is not possible as per my research but will let you know if find any progress regarding this.
Thanks
-
Hi Himanshu,
I haven't found any solution for this. But I am still researching for this and will let you know if got anything.
Thanks