Be Good & Do Good!

Tag: Salesforce (Page 8 of 11)

Salesforce AJAX Toolkit Shell

Came across something tweak toolkit installed and accessible right inside of any Salesforce.com Org. Access Salesforce AJAX Toolkit Shell @ http://instanceName.salesforce.com/soap/ajax/17.0/debugshell.html.

Enter the instanceName, such as na1, for your organization. You can see the instanceName in the URL field of your browser after logging
in to Salesforce.com.

Salesforce – Date (Calendar) Picker in VisualForce

In general it is a bad idea to use any of the javascript calls that references any standard app features.  These can and do change frequently and might have side effects that are hard to track down.

To get the datePicker the best solution right now is to use inputField and then use an empty SObject with a date field to store the value for you.

Visualforce

<apex:inputField value=”{!proxyObject.closeDate}”/>

Controller

Opportunity o = new Opportunity();
public Opportunity getProxyObject() { return o; }

then in your controller when you need to access the date you ask for o.closeDate.

Source : Salesforce Community

Salesforce – Know-How : Anonymous Block

  1. Unlike classes and triggers, anonymous blocks execute as the current user and can fail to compile if the script violates the user’s object- and field-level permissions. So, essentially, it is only allows the user to do what they could through the API.
  2. if you don’t have CRUD for delete on Account, you can’t delete Accounts through anonymous blocks.
  3. The Author Apex profile perm, only applies to Apex that is stored in the org’s metadata (i.e. normal Apex Classes and Triggers that run in system mode).
  4. As far as Async Apex (Batch Apex), it doesn’t look like it is possible because @future requires the method be static but anonymous blocks can’t have static methods

Salesforce – Visualforce / Apex Code Samples

Following is list of Apex/Visualforce code samples listed on Salesforce Wiki. These are collections of pieces of code that you think will be useful to us (Salesforce community). These are typically small (a few pages of Apex, or Apex and a few Visualforce pages, or a trigger or two) and one-off.

If you want to instead create or join a collaborative coding project, check out Salesforce Code Share

Source : Salesforce Wiki

Salesforce – Checkbox in DataTable

Displaying the check box in a data table or page block table is a general requirement in every project. with the help of wrapper class we can display the checkboxes in a data table. SrinivasaRao Pendala writes a simple and neat article on how to generate checkboxes in data table.

Also added in the code is small javascript so that if we select the header checkbox it will select all the checkboxes.

Read complete article @ Salesforce Wiki

Salesforce – Hide standard buttons display

Below version isn’t working due to cross domain issues (As visualforce pages are served from *.force.com domain and salesforce standard pages are served from *.salesforce.com domain, so it results in cross domain errors).

Please read new working version @ https://www.chiragmehta.info/chirag/2010/08/16/salesforce-hide-standard-buttons-display-working-version/

There are many a times where we want to remove few standard buttons from page layout, but there is no such option to remove such restricted buttons. Few such buttons are …

  • “New Note” or “Attach File” button on Google Docs, Notes, & Attachments Related list
  • “Save & Send Invitation” button on New Event page
  • Following is a solution which will hide “Save & Send Invitation” button on New Event page

    STEP1: Visualforce Code

    <apex :page sidebar="false" showHeader="false">
    <script language="javascript" type="text/javascript">
    window.onload = new function()
    {
    window.parent.document.getElementsByName("sendEmail")[0].style.display = 'none';
    window.parent.document.getElementsByName("sendEmail")[1].style.display = 'none';
    }
    </script>

    </apex>

    STEP2: Create a Home Page Component of type (HTML Area)

    <iframe src="/apex/aboveVFPageName" frameborder="0" width="100%" height="100"></iframe>

    STEP3: Add above created Home page component in your home page layout.

    That’s it you are all set, now open New Event and add invitees, automatically the “Save & Send Invitation” button will disappear.

    Algorithm for converting 15 digit Salesforce Id to 18 digit

    Following is an algorithm I found on Salesforce Community. It converts a 15 digit salesforce Id to the corresponding 18 digit Salesforce Id. This is pretty helpful in onclick JavaScript codes and S-Controls where merge fields normally return only 15 digits. Also, although the code is in JavaScript, it can be easily converted to any other coding language code.

    function normaliseSforceID( id) { // fluff up a 15 char id to return an 18 char id
    if (id == null) return id;
    id = id.replace(/\"/g, ''); // scrub quotes from this id
    if (id.length != 15) {
    //print('well, id is not 15, bye' + id + ' ' + id.length);
    return null;
    }
    var suffix = "";
    for (var i = 0; i < 3; i++) { var flags = 0; for (var j = 0; j < 5; j++) { var c = id.charAt(i * 5 + j); if (c >= 'A' && c < = 'Z') { flags += 1 << j; } } if (flags <= 25) { suffix += "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(flags); } else { suffix += "012345".charAt(flags-26); } } return id + suffix; }

    « Older posts Newer posts »