Thursday 5 June 2014

How to Show IP Address in Visualforce Page Salesforce


      In some of point of requirement you may need to show the IP address in visualforce page. The following is the way to show IP address in salesforce.

Apex Class
  1. public class IPAddress
  2. {
  3. public string myIPAddress{get;set;}
  4.    public IPAddress()
  5.    {
  6.       myIPAddress = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');
  7.    }
  8. }
Visualforce page
  1. <apex:page controller="IPAddress" >
  2. Your Login IP Address : {!myIPAddress}
  3. </apex:page>

Here is the IP Address


No comments:

Post a Comment

Activities: Assign Tasks to a Queue Salesforce Lightning

Salesforce announced to assign Tasks to a Queue beginning from Spring'20 release. How does it work? In Setup, enter Queues in th...