Sunday, 13 April 2014

Branding Salesforce Login page

Branding is a way to motivates the buyer, concretes user loyalty, and delivers the message clearly.After Salesforce winter 14 release any organization that are using salesforce, able to customize salesforce login page.
What means of Customizing login page ?
Now you can change the look and feel of your login page by adding a background color, custom +logo, and right-frame content.
What is the Prerequisites ?
At least one Domain is enable for your organization.To check this follow the path Name | Setup | Administration Setup | Domain Management | Domains and check whether domain is enabled for your salesforce org or not. If you want to add Domain and don’t know how to do that, then click on link (Adding a Domain).
To customizing your login page follow the instruction.
1. Navigate to Name | Setup | Administration Setup | Domain Management | My Domain.
2. Click on Edit button under ‘Login Page Branding‘ section
Customize branding page
3. If you want to customize your logo, upload an image.
Note :- Images can be .jpg, .gif or .png files up to 100 KB in size. Maximum image size is 250px by 125px.

Header Logo
Header Logo
Here I used below image  as a logo.

Logo
Logo

4. If you want change your login page background, it’s very easy click the color picker or enter a valid hexadecimal color code.

Background Color
Background Color

5. To change right side iframe on the login page, enter URL to ‘Right Frame URL‘ Box

Right Frame URL
Right Frame URL
In above screen shot i am using one of image url from my old blogpost.
Note :-Content must be located at a URL that uses SSL encryption and the https:// prefix. Maximum content size is 478px by 397px.
6. Optionally,You can select additional authentication services to include on your login page.
7. Finally click on Save Button, to save your work.
8. Now logout from salesforce and go to login page by using your domain like for me it’s (https://rakeshistom-dev-ed.my.salesforce.com/)

My dev org login page
My developer org login page

Friday, 11 April 2014

Data import from csv using Visualforce page

  

Sometimes we need to read a csv file in a visualforce page.

Here is a example to read a csv file and display it in a pageblocktable.

Following example reads a csv file having account records in it and displays them in a table when "Read csv" button is pressed.

Csv file format used in this example:













Output screen shot:




Visualforce page

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<apex:page controller="csvFileReaderController">
    <apex:form >  <!-- csv reader demo -->
        <apex:pageBlock >
            <apex:panelGrid columns="2" >
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Read csv" action="{!readcsvFile}"/>
            </apex:panelGrid>
        </apex:pageBlock>
        <apex:pageBlock >
           <apex:pageblocktable value="{!sObjectList}" var="rec">
              <apex:column value="{!rec.name}" />
              <apex:column value="{!rec.AccountNumber}" />
              <apex:column value="{!rec.Accountsource}" />
              <apex:column value="{!rec.Type}" />
              <apex:column value="{!rec.Website}" />
        </apex:pageblocktable>
     </apex:pageBlock>
   </apex:form>
</apex:page>


Controller

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Public with sharing class csvFileReaderController {
public Blob csvFileBody{get;set;}
Public string csvAsString{get;set;}
Public String[] csvfilelines{get;set;}
Public String[] inputvalues{get;set;}
Public List<string> fieldList{get;set;}
Public List<account> sObjectList{get;set;}
  public csvFileReaderController(){
    csvfilelines = new String[]{};
    fieldList = New List<string>();
    sObjectList = New List<sObject>();
  }
  Public void readcsvFile(){
       csvAsString = csvFileBody.toString();
       csvfilelines = csvAsString.split('\n');
       inputvalues = new String[]{};
       for(string st:csvfilelines[0].split(','))
           fieldList.add(st);  
       
       for(Integer i=1;i<csvfilelines.size();i++){
           Account accRec = new Account() ;
           string[] csvRecordData = csvfilelines[i].split(',');
           accRec.name = csvRecordData[0] ;            
           accRec.accountnumber = csvRecordData[1];
           accRec.Type = csvRecordData[2];
           accRec.website = csvRecordData[3];
           accRec.AccountSource = csvRecordData[4];                                                                              
           sObjectList.add(accRec);  
       }
  }
}

Modifying Salesforce Picklist Values


If you have been using Salesforce for a while, you have probably come across a need to replace or remove a picklist value.
Salesforce Picklists, Salesforce Consultant, Salesforce Support, Salesforce Partner, StarrForce

This may seem like a simple task, but if not thought out properly, it can lead to complications down the road. Below are the options you have when replacing or deleting picklist values in Salesforce.
Rename the Salesforce Picklist Value
If you just want to rename a value, click the “Edit” link next to the value and type in the new value. For instance, if you want to change the Lead Source value from Web to Web Page, edit the value and rename it.
Some Salesforce picklists, like the Salesforce opportunity Stage, do not allow editing of the name and need to use one of the other options. Also, keep in mind that if you change the name of a picklist value, and that value is used in a Salesforce report filter, then that report may not work as expected after the change since that value will be removed from the filter criteria or if it is the only criteria, return an error when running/editing the report.
Replace the Salesforce Picklist Value
Another option is to create a new value and then globally replace an existing value. This is handy when combining values or if you want to keep your report filters intact using new or existing values.
When viewing the picklist values of a Salesforce field, use the “Replace” button and enter the value you want to replace. Then select the value to replace it with. You will need to have any new values added before replacing existing values.
This is a global change and will replace the picklist value for all existing records, including records in the recycle bin. Also, this will update the Modified By date and time for all records where the value was replaced.
Deactivate the Salesforce Picklist Value
When you use the “Del” link next to a picklist value, one of two things will happen. The value will either be removed from the picklist and is no longer selectable or you will be presented with a new screen to choose a value to replace the deleted value with.
If you choose to replace the deleted value with “None” (the default), then existing records are not updated and the value is no longer selectable. Existing records will keep the deleted value until changed to a new value. Replacing the value follows the functionality above.
Keep in mind that if you decide not to replace the value, it will still show up in reports and list views but you will not be able to use it in filters since it is no longer a valid picklist value. You can get around this by using the criteria of “Picklist Field” “not equal to” and then select all available picklist values. This will then return all records that do not have a valid (selectable) picklist value.
Now that you understand the different options and ramifications of deleting or replacing Salesforce picklist values you can make the choice that best meets your needs

Tuesday, 1 April 2014

Handling spaces in a Select Field value in an email template

I'm creating an email template called "case closed with survey". It's used in a workflow rule such that when a case is closed, a link to a customer satisfaction survey will be sent to the customer. The body of the email template looks like this:
Thank you for your support inquiry.  We have changed the status of support ticket {!Case.CaseNumber} to “closed”. Please fill out this brief survey:

https://getfeedback.com/r/iy9Ow4Ms?Case_ID={!Case.Id}&Account_Name={!Case.Account}&Case_Type={!Case.Type}&Application={!Case.Application__c}

Thank you.
"Case.Application__c" is a custom field we added to the case object, and it contains the names of our product.  The product names are multi-word with spaces: meaning an Application name could be "widget one", "widget two", etc.
When I use the template as is above, I get "&Application" as part of the URL, but it drops the Application name value after the first space - meaning that the URL ends in "&Application=widget". I've tried both single and double-quotes...when I do either of these, I don't get anything for the application name.

It was suggested that I use URLENCODE (i.e., "&Application={URLENCODE(!Case.Application__c)}") at the end of the URL.  Unfortunately, that still only gets me the first word of the application name as part of the URL.

Any way I can recode this template so that it gives me the full product name?


Answer
The URLENCODE shoud have worked! Write it like this:
{!URLENCODE(Case.Application__c)}
Meanwhile also give these a trial:
{!SUBSTITUTE(Case.Application__c, ' ', '%20')}
Also this one:
{!SUBSTITUTE(Case.Application__c, ' ', '+')}

Workflow on Opportunity changed Stage not working

Trying to create a workflow to send an email every time an opportunity is changed from  Closed to something else

I can't get it to fire

AND(ISCHANGED(StageName), (OR(PRIORVALUE( StageName )= "Closed Won",PRIORVALUE(StageName )= "Closed Lost")))

It will fire just on the Stage change, but not with the Priorvalue change.  Note, i reordered them and tried Contains instead of using an OR.

Any suggestions?

ANS

So you want it to fire if the stage is changed and the prior status of the opportunity was closed, is that right? That's what your syntax says right now. Assuming that is the case you can simply down to this:
AND(
ISCHANGED(StageName),
PRIORVALUE(ISCLOSED))




View scheduled reports by user?

Q

Is it possible to view the number of scheduled reports per each user?

A


You cannot really view a summary by user, but you can get a list of what is scheduled to run next and who scheduled it.

Go to:
Setup>Monitor>Jobs>Scheduled Jobs

From there you can probably extract who has what scheduled. 

Is there an easy way to run a report that looks at the number of users created by year in an org - cumulative?

QUE

Is there an easy way to run a report that looks at the number of users created by year in an org - cumulative?



ANS

User-added image