Forum Replies Created

Page 1 of 8
  • 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

  • Hi Tanu,

    Below is the SOQL sample query:

    SELECT Id, Name FROM RecentlyViewed WHERE Type IN ('Account', 'Contact') ORDER BY LastViewedDate DESC

    Thanks

  • Surbhi

    Member
    September 8, 2016 at 8:34 am in reply to: Post Install Script in Salesforce for deleting custom object data

    Hi 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

    Member
    September 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

    Member
    September 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

    Member
    September 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

  • Hi Pranav,

    An extension, which I used for this purpose, is Force.com LOGINS Options. You can use it.

    Thanks

  • 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

  • Hi Tanu,

    This won't cause you any problems. The execution context will be different each time the batch job is fired.

    Thanks

  • 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

  • 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

    Member
    August 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

    Member
    August 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

  • Hi Mohit,

    You can use aggregate functions here. Use field in Group By for criteria of comparison.

    Thanks

  • 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

    Member
    August 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

    Member
    June 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

  • Surbhi

    Member
    June 27, 2016 at 1:04 pm in reply to: Add image/screen-shot in answers

    That's Great !

    Thanks

  • Hi Prabhat,

    Thanks for providing this information. Can you please provide some examples of using hierarchy custom settings in apex ?

    Thanks in advance

  • Surbhi

    Member
    June 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

  • Surbhi

    Member
    June 23, 2016 at 2:09 pm in reply to: How to show App in Salesforce1?

    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

  • Surbhi

    Member
    June 22, 2016 at 2:14 pm in reply to: How to include dynamic apex in managed package?

    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

  • Hi Himanshu,

    I am also looking for this. Can anyone please provide any information regarding this?

    Thanks

  • Hi Karen,

    I think it is not possible as per my research but will let you know if find any progress regarding this.

    Thanks

  • Surbhi

    Member
    June 21, 2016 at 2:32 pm in reply to: How to watermark a file in Salesforce?

    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

Page 1 of 8