Showing posts with label salesforce. Show all posts
Showing posts with label salesforce. Show all posts
Saturday, February 4, 2017
Getting Salesforce Organization Server Url
Getting Salesforce Organization Server Url
Hi All,
Recently i faced a situation where i need to get Current Org Server URL (Host Url) in Trigger. I know we can get it easily in VF or Apex Class, but what about in Trigger or some future method? One of my colleague Mr. Yogesh Rankawat suggested me a very good way to do this easily (Thanks to him). So here i am going to tell you this method.
1) Create a simple class with following code:-
public class HostUrl{
public string url {get;set;}
public HostUrl(){
url = ApexPages.currentPage().getHeaders().get(Host);
}
}
2) Create a even simple VF page with following code:-
<apex:page sidebar="false" showHeader="false" controller="HostUrl" contentType="text">{!url}</apex:page>
3) Now just simply use below code to get the Server URL
PageReference pg = Page.HostUrl;
String SERVER_URL = pg.getContent().toString();
Isnt it too simple!!! If you know even better way, then please share.
Thanks
Aslam Bari
Available link for download
Labels:
getting,
organization,
salesforce,
server,
url
Thursday, January 26, 2017
Google Transliteration component for Salesforce
Google Transliteration component for Salesforce
Hi All,
Recently I had a requirement where client needs easy way to type details in both English/Hindi language in Standard Salesforce screens. For example, there are call center agent users. They use Salesforce Case screen to type whatever detail they get from end customer. Client needs that agent can type details or resolution in both English and Hindi language. So, i come up with one solution here. I used "Google Transliteration" JS API to achieve it and attached this to standard description field for Case Edit screen.

I found this is useful for many others people or developers. So I come up with one common component solution for this. Here is a screen cast you can see this in Action.
http://screencast.com/t/J5OrRMAR
How to install:
1) Download the "Google Transliteration Support" Home page component code from here http://labs.aslambari.com/google_transliteration_support.txt
2) Make one "Narrow Side Bar" html component in your SFDC org and put the code there.
3) Enable this component to Active Home page layout (Make sure it will be visible on all pages in sidebar)
4) Some settings you need to take care (or need to change)
Language: You can see the line of code "google.elements.transliteration.LanguageCode.HINDI". This is the target language. You can change it if you want the native language according to your need.
Field Id: You can see the line of code "opp14". This is the field id of "description" field of Opportunity Edit Screen. You can find the any field id (textarea/text) of the object which you want to make transliteration support. And you need to give that id here.
Extra feature: There is one extra hidden feature here. While you are typing you can toggle between language "Ctrl + g" shortcut keys. But be sure this is not synch with Button on left side (I did not get much time for that, so left that). But this is very convenient for a agent to switch between two language using shortcut keys.
Let me know your thoughts once you able to use it.
Thanks
Aslam Bari
Available link for download
Labels:
component,
for,
google,
salesforce,
transliteration
Subscribe to:
Posts (Atom)