Forum Replies Created

Page 9 of 12
  • Hi suraj,

    You can use data loader .I know the it has a "Hard Delete" option and the records are not recoverable via the Recycle Bin.

    Thanks.

  • Hi suraj,

    I hope it will be helpful for you,

    Use the with sharing keywords when declaring a class to enforce the sharing rules that apply to the current user. For example:

    public with sharing class sharingClass
    {
    // Code here
    }

    Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example:

    public without sharing class noSharing
    {
    // Code here
    }
    If a class is not declared as either with or without sharing, the current sharing rules remain in effect. This means that if the class is called by a class that has sharing enforced, then sharing is enforced for the called class.

    Thanks.

  • Hi saurabh,

    You can try this Sample code:

    List<User> u = new List<User>();
    List<Id> ids = new List<Id>();
    String test = 'test';
    u = Database.Query('SELECT Id, Name FROM User WHERE Name =: test');
    System.debug('User details are ' + u);
    for(User usr : u)
    {
    System.resetPassword(usr.Id,true);
    }

     

    Thanks.

  • Manpreet

    Member
    April 21, 2017 at 12:49 pm in reply to: What if no Role is assigned to a User in salesforce?

    Hi saurabh,

    The main use of role comes when expanding the visibility of the records when OWD is set to Private.In that case you can assign roles to Users and can up/down their position in Role Hierarchy as per your requirement to make records visible.Further if both the uses are at the same level in Role Hierarchy, then you can use Sharing Rules to expand their visibility.

    Thanks.

  • Hi saurabh,

    apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
    <apex:actionFunction name="sendEmail" action="{!sendEmailFunction}">

    </apex:actionFunction>

    apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.

    <apex:outputpanel id="counter">
    <apex:outputText value="Click Me!: {!count}"/>
    <apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="counter" status="counterStatus"/>
    </apex:outputpanel>

    apex:ActionPoller : This is timer component which can send AJAX request on pre-defined interval. Minimum interval is 5 sec and default is 60 sec.
    <apex:actionPoller action="{!incrementCounter}" rerender="counter" status="counterStatus" interval="50" />

     

    Similarities:

    Both action support and function can be used to call a controller method using an AJAX request.

    Differences:
    1. Action function can call the controller method from java script.
    2. Action support adds AJAX support to another visualforce component and then call the controller method.
    for example:
    <apex:outputpanel id="outptpnl">
    <apex:outputText value="click here"/>
    <apex:actionSupport event="onclick" action="{!controllerMethodName}" rerender="pgblck" />
    </apex:outputpanel>
    Here action support adds AJAX to output panel, so once you click on output panel controller method will be called.

    3. Action function cannot add AJAX support to another component. But from a particular component which has AJAX support(onclick, onblur etc) action function can be called to call the controller method.
    Example:
    <apex:actionFunction name="myactionfun" action="{!actionFunMethod}" reRender="outptText"/>
    <apex:inputcheckbox onclick="myactionfun" />
    In this example onlick of input checkbox "myactionfun" action function is called from where controller method "actionFunMethod" gets called.

    Apart from this, the main difference between the "two" action support and action function is that, the action function can also be called from java script.
    Example:
    <apex:actionFunction name="myactionfun" action="{!actionFunMethod}" reRender="outptText"/>
    <apex:inputcheckbox onclick="myJavaMethod()" />
    <script>
    function myJavaMethod(){
    myactionfun();// this call the action function
    }
    </script>

    Thanks.

  • Hi suraj,

    Somthing like this:
    <aura:iteration items="{!v.newCases}" var="case">
    <button type="button" onclick="{!c.showCaseDeleteModal(case.Id)}">Delete</button>
    </aura:iteration>

    You can further refer to this article : https://developer.salesforce.com/blogs/developer-relations/2015/03/lightning-components.html

    Thanks.

  • Hi saurabh,

    You will get to know it by using limit class in Salesforce.

    Just refer to thi sexample code :

    trigger accountLimitExample on Account (after delete, after insert, after update) {

    System.debug('Total Number of SOQL Queries allowed in this Apex code context: ' + Limits.getLimitQueries());
    System.debug('Total Number of records that can be queried in this Apex code context: ' + Limits.getLimitDmlRows());
    System.debug('Total Number of DML statements allowed in this Apex code context: ' + Limits.getLimitDmlStatements() );
    System.debug('Total Number of CPU usage time (in ms) allowed in this Apex code context: ' + Limits.getLimitCpuTime());

    // Query the Opportunity object
    List<Opportunity> opptys =
    [select id, description, name, accountid, closedate, stagename from Opportunity where accountId IN: Trigger.newMap.keySet()];

    System.debug('1. Number of Queries used in this Apex code so far: ' + Limits.getQueries());
    System.debug('2. Number of rows queried in this Apex code so far: ' + Limits.getDmlRows());
    System.debug('3. Number of DML statements used so far: ' + Limits.getDmlStatements());
    System.debug('4. Amount of CPU time (in ms) used so far: ' + Limits.getCpuTime());

    //NOTE:Proactively determine if there are too many Opportunities to update and avoid governor limits
    if (opptys.size() + Limits.getDMLRows() > Limits.getLimitDMLRows()) {
    System.debug('Need to stop processing to avoid hitting a governor limit. Too many related Opportunities to update in this trigger');
    System.debug('Trying to update ' + opptys.size() + ' opportunities but governor limits will only allow ' + Limits.getLimitDMLRows());
    for (Account a : Trigger.new) {
    a.addError('You are attempting to update the addresses of too many accounts at once. Please try again with fewer accounts.');
    }
    }

    else{
    System.debug('Continue processing. Not going to hit DML governor limits');
    System.debug('Going to update ' + opptys.size() + ' opportunities and governor limits will allow ' + Limits.getLimitDMLRows());
    for(Account a : Trigger.new){
    System.debug('Number of DML statements used so far: ' + Limits.getDmlStatements());

    for(Opportunity o: opptys){
    if (o.accountid == a.id)
    o.description = 'testing';
    }

    }
    update opptys;
    System.debug('Final number of DML statements used so far: ' + Limits.getDmlStatements());
    System.debug('Final heap size: ' + Limits.getHeapSize());
    }
    }

    Thanks.

  • Hi suraj,

    Just refer to this diagram, it will clear your doubts :

    OWD

    Thanks.

     

  • Hi suraj,

    1. difference is in case of Action function we invoke AJAX using Java script while in case of Action support we may directly invoke method from controller

    2. other difference is Action function may be commonly used from different place on page while action support may only be used for particular single apex component.

    difsupfun

    Just Try out this example http://www.cloudforce4u.com/2013/06/difference-between-action-support-and.html

    Thanks.

  • Hi Suraj,

    This works just fine. (Without the return false; after the alert, the page refreshes)

    <apex:commandButton value="Alert Me" onclick="test(); return false;" />
    <script>
    function test(){
    alert('Got it');
    }
    </script>

    Thanks.

  • Manpreet

    Member
    April 19, 2017 at 1:20 pm in reply to: What is Wrapper Class & Where to use Wrapper Class in Salesforce?

    Hi suraj,

    A wrapper or container class in Salesforce is a class, a data structure, or an abstract data type whose instances are collections of other objects.

    Let me give you a scenario, say you have to create a Table in your Visualforce Page. Each row of the table is suppose to show information from a Contact record also some details from the related Account record too. So, it would be nice, it we had a Class (An Abstract Data Type or a wrapper or a kind of a temporary holder for information) where it could hold the details for each row from different tables.

    Just try out a basic Wrapper http://www.infallibletechie.com/2015/03/sample-wrapper-class-using-apex-in.html

    Thanks.

  • Hi Suraj,

    You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.

    Thanks.

  • Manpreet

    Member
    April 18, 2017 at 1:23 pm in reply to: Difference between seeallData=true and seeAllData =false ?

    Hi suraj,

    IsTest(SeeAllData=true) : to grant test classes and individual test methods access to all data in the organization,
    1) If a test class is defined with the isTest(SeeAllData=true) annotation, this annotation applies to all its test methods whether the test methods are defined with the @isTest annotation or the testmethod keyword
    2) The isTest(SeeAllData=true) annotation is used to open up data access when applied at the class or method level

    Use the isTest(SeeAllData=true) means you need to create the test data in your org.

    User, profile, organization, AsyncApexjob, Corntrigger, RecordType, ApexClass, ApexComponent ,ApexPage we can access without (seeAllData=true) .
    SeeAllData=true will not work for API 23 version eailer .

    NOTE:- Always try to avoid use SeeAllData= true because in that case your test class depend on your sandbox data. You May get some issue will deployment.

    Thanks.

  • Manpreet

    Member
    April 18, 2017 at 12:46 pm in reply to: Salesforce to facebook integration

    Hi Sridhar,

     

    Step1:

    Go to Setup → Build → Develop → Pages

    Click on the “New Button” within Salesforce to create a new page

     

    Step2: Create a Visualforce page in Salesforce with the name Facebook Integration, in the field type
    Facebook Integration, In the name field type Facebook Integration.

    Step3:  Paste this code into the Visualforce editor within Salesforce

    <apex:page><div id=”fb-root”></div><script>(function(d, s, id) {varjs, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = “//connect.facebook.net/en_US/all.js#xfbml=1″;fjs.parentNode.insertBefore(js, fjs);}(document, ‘script’, ‘facebook-jssdk’));</script><apex:pageBlock title=”facebook Integration” mode=”edit”><apex:pageBlockSection title=”facebook Comment Block”>

    <div data-href=”http://example.com/comments” data-numposts=”5″ data-colorscheme=”light”></div>

    </apex:pageBlockSection>

    </apex:pageBlock>

    </apex:page>
    Save this code within Salesforce and Open this Visualforce page.

    Thanks.

  • Hi suraj,

    No, it is not possible for more than one of these variables to be true within a single invocation of a trigger.A given operation will invoke the trigger so therefore it will only be insert OR update OR Delete OR Undelete.

    Those context variables enable you to identify the different operations within the same trigger.

    Thanks.

  • Hi Suraj,

    No, there is no such inbuilt feature.Although you can do this via custom coding.

    Thanks.

  • Manpreet

    Member
    April 17, 2017 at 1:38 pm in reply to: How to auto resize a Salesforce Visualforce Page?

    hi suraj,

    You can do something like this:

    HTML
    <div id="boxContainerContainer">
    <div id="boxContainer">
    <div id="box1"></div>
    <div id="box2"></div>
    <div id="box3"></div>
    </div>
    </div>
    CSS
    #boxContainerContainer {
    background: #fdd;
    text-align: center;
    }

    #boxContainer {
    display:inline-block;
    border:thick dotted #060;
    margin: 0px auto 10px auto;
    text-align: left;
    }

    #box1,
    #box2,
    #box3 {
    width: 50px;
    height: 50px;
    background: #999;
    display: inline-block;
    }
    You can refer to this link: http://jsfiddle.net/pauldwaite/pYaKB/

    Thanks.

  • Hi saurabh,

    Yes ,we can include one formula field with in another formula field.It will calculate the formula field characters which we included in the formula field.

    Thanks.

  • Hi saurabh,

    To grant login access there are two methods, depending on whether you are a System Administrator or any other type of user. Learn how below.

    System Administrator
    Depending on your Organization, the "Setup" button will be beside your name at the top right of the page or listed as a drop-down option when you click on your name.

    1. Choose one of the following in Salesforce Classic User Interface:
    -Click on Setup | My Personal Information | Grant Login Access.
    - Click on Your Name | My Settings | Personal | Grant Account Login Access
    2. Set the access expiration date for "Salesforce.com Support" (Minimum of 1 month for technical escalations).
    3. Click Save.
    Choose one of the following in Lightning Experience User Interface:
    1. Click on your avatar in the top right-hand side of the screen and choose "Settings".
    2. Click on Grant Account Login Access.
    3. Set the access expiration date for Salesforce.com Support (Minimum of 1 month for technical escalations).
    4. Click Save.
    All Other Users
    1. Choose Your Name | My Settings | Personal | Grant Account Login Access.
    2. Set the access expiration date for "salesforce.com support" (Minimum of 1 month for technical escalations).
    3. Click Save.

    Thanks.

  • Hi Saurabh,

    Insert is the DML statement which is same as databse.insert. However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions).

    Important Difference:

    If we use the DML statement (insert), then in bulk operation if an error occurs, the execution will stop and Apex code throws an error which can be handled in a try-catch block.
    If DML database methods (Database.insert) used, then if an error occurs the remaining records will be inserted/updated means partial DML operation will be done.

    Thanks

  • Hi suraj,

    Step 1: Create a Visualforce page called SamplePage1....

    <apex:page >
    <apex:outputlink value="/apex/SamplePage2"> Click Here <apex:param name="msg" value="success"/> </apex:outputlink>
    </apex:page>

    Step2: Create a Visualforce page called SamplePage2

    <apex:page controller="Sampleclass"> </apex:page>

    Step 3: On SamplePage1 Click on the " Click Here" link. You will see that when you click on the link you will navigate to the SamplePage2. Check the URL now..
    https://na5.salesforce.com/apex/SamplePage2?msg=success

    You can see that the parameter " msg" with value "success" has been passed to the new page.
    Pagereference().getParameters().put()

    PageReference is a type in Apex. Read the documentation here.
    When you click a command button or a command link in a visualforce page, you call a method. The return type
    of this method would be a PageReference meaning that, after clicking the button the user will be redirected to a
    new Page. Below is a sample code, which shows how to pass parameters from a PageReference

    public Pagereference gotonewpage()
    {
    PageReference pageRef = Page.existingPageName;
    pageRef.getParameters().put('msg','success');
    return PageRef
    }
    existingPageName - actual name of a visualforce page
    Retrieve Parameter Values in Apex Class:
    The Apex Class code would be

    public class Sampleclass
    {
    Public String message = System.currentPagereference().getParameters().get('msg');
    }

    So now, the variable "message" would store the value of your parameter "msg"....

    Thanks.

  • Hi suraj,

    A sandbox refers to an isolated environment, like a VM, a jail (in FreeBSD) or an LXC container in Linux. The essential property of such an environment is isolation. That means you don't have some hard coded system configuration lying around or different versions of some libraries installed etc. You get to setup everything as it should be in the production environment and test your project in that condition. A sandbox is also useful from a security point of view.

    A dev environment is just that, a dev environment. Although it would be good to do development and local testing inside a sandbox but it can be tiresome unless you have good automation tools to set things up quickly.

    Thanks.

  • Manpreet

    Member
    April 13, 2017 at 4:03 pm in reply to: How forecasting works in salesforce?

    Hi Suraj,

    have you checked out the documentation in the help files around forecasting. That is where I have found the best general information. If you have specific questions let us know!
    https://help.salesforce.com/apex/HTSearchResults?qry=forecasting

    Thanks.

  • Manpreet

    Member
    April 12, 2017 at 1:51 pm in reply to: Can We use more than one Pricebook in Salesforce Opportunity ?

    Hi Suraj,

    Currently when an opportunity is created, and the sales person adds the products to the opportunity they can only choose products from one price book. Often times our sales team uses pricing from a standard price book and then from our special pricing price book. Since you can't use both on one opportunity, they are forced to either create a separate opportunity for the products from the other price book or just not report them at all. The ability to use multiple price books per opportunity would greatly improve the use of the products section within the opportunity but such feature is not yet available.

    Thanks.

  • Hi suraj,

    Products (API Name : Product2) is the Standard salesforce Object.These include all the Products in Salesforce.Now when you add these Products into an Opportunity , they are then called OpportunityLineItems.These OpportunityLineItems are the Opportunity Products.

    Thanks.

Page 9 of 12