- prasad_more1.3158103303596086E
- NEWBIE
- 0 Points
- Member since 2011
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
5Replies
How to get logged in User session using AJAX toolkit
Hi,
I'm using AJAS toolkit to call Apex class method from Javascript. The javascript used for calling Apex class method is added in SFDC using Custom Home Page component.
To call Apex class method, it is mandatory to use "sforce.connection.login" method to get sessionId. The login method accepts username, password and token to authenticate and create session. Once authentication is successful, I can use "sforce.apex.execute" method to call Apex class method.
I wish to skip call to "sforce.connection.login" and use logged-in users session so that I don't have to specify User Name, password and token in javascript. Is there any way I can use logged-in Users session in AJAX toolkit. Any help in this regard is appriciated.
Thanks,
Prasad
- prasad_more1.3158103303596086E
- December 05, 2011
- Like
- 0
- Continue reading or reply
Get Page Layout Name using Javascript
Hi,
I have created Custom Home Page component which will be shown on all the pages. It has Javascript file and method in JS file which is executed when page is loaded into browser. I want to know which page layout is loaded in Javascript method. Please suggest me how do I get Page Layout name using javascript in Custom Home Page component.
Thanks,
Prasad
- prasad_more1.3158103303596086E
- December 02, 2011
- Like
- 0
- Continue reading or reply
Static Resource is changed every time it edited
Hi,
Why do the ID for Static Resource is changed everytime it is updated?
Also if I add Static Resource e.g. Javascript file, use it in a Custom Home Page Component and add Custom Home Page Component to Package then:
1. Will Static Resource be added automatic to the Package or we need to add it manually?
2. When a package with Static Resource is deployed, will the ID for Static Resource change?
Thanks,
Prasad
- prasad_more1.3158103303596086E
- November 25, 2011
- Like
- 0
- Continue reading or reply
Call Apex Controller Method using JQuery
Hi,
I have added following Controller and Apex page and when I open the Apex page in browser using https://ap1.visual.force.com/apex/AjaxResponder?q=GetAJAX, value for the parameter "q" i.e. "GetAJAX" is displayed in browser.
--Start : Source Code for Controller class
public class AjaxRespController {
String searchResult;
/** invoked on an Ajax request */
public void doSearch() {
Map<string,string> params = ApexPages.currentPage().getParameters();
// Do SOQL query to see if there are any records !
//List<Contact> records = getRecords(params.get('q'));
searchResult = params.get('q');
}
// Returns the JSON result string
public String getResult() {
return searchResult;
}
}
--End : Source Code for Controller class
--Start : Markup for Visualforce page
<apex:page controller="AjaxRespController" action="{!doSearch}"
contentType="text/plain; charset=utf-8" showHeader="false" standardStylesheets="false" sidebar="false">
{!result}
</apex:page>
--End : Markup for Visualforce page
I created Home Page Component and added following following JQuery to call Apex Controller Method, but request is failing.
Also tried using relative path for the URL i.e. "/apex/AjaxResponder". But still reques is failing. Please guide me in resolving this issue.
-- "CallApexController" is called on click of a button which is added in page body using JQuery "Append" method in "Body" tag.
var j$ = jQuery.noConflict();
function CallApexController() {
j$.ajax({
type: "GET",
url:"https://ap1.visual.force.com/apex/AjaxResponder?q=" + searchKeyword,
contentType: "plain/text; charset=utf-8",
data: "{}",
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
}
function AjaxSucceeded(result) {
alert('AjaxSucceeded');
}
function AjaxFailed(result) {
alert('AjaxFailed');
}
Thanks,
Prasad
- prasad_more1.3158103303596086E
- November 25, 2011
- Like
- 0
- Continue reading or reply
Call Apex Controller Method using JQuery
Hi,
I have added following Controller and Apex page and when I open the Apex page in browser using https://ap1.visual.force.com/apex/AjaxResponder?q=GetAJAX, value for the parameter "q" i.e. "GetAJAX" is displayed in browser.
--Start : Source Code for Controller class
public class AjaxRespController {
String searchResult;
/** invoked on an Ajax request */
public void doSearch() {
Map<string,string> params = ApexPages.currentPage().getParameters();
// Do SOQL query to see if there are any records !
//List<Contact> records = getRecords(params.get('q'));
searchResult = params.get('q');
}
// Returns the JSON result string
public String getResult() {
return searchResult;
}
}
--End : Source Code for Controller class
--Start : Markup for Visualforce page
<apex:page controller="AjaxRespController" action="{!doSearch}"
contentType="text/plain; charset=utf-8" showHeader="false" standardStylesheets="false" sidebar="false">
{!result}
</apex:page>
--End : Markup for Visualforce page
I created Home Page Component and added following following JQuery to call Apex Controller Method, but request is failing.
Also tried using relative path for the URL i.e. "/apex/AjaxResponder". But still reques is failing. Please guide me in resolving this issue.
-- "CallApexController" is called on click of a button which is added in page body using JQuery "Append" method in "Body" tag.
var j$ = jQuery.noConflict();
function CallApexController() {
j$.ajax({
type: "GET",
url:"https://ap1.visual.force.com/apex/AjaxResponder?q=" + searchKeyword,
contentType: "plain/text; charset=utf-8",
data: "{}",
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
}
function AjaxSucceeded(result) {
alert('AjaxSucceeded');
}
function AjaxFailed(result) {
alert('AjaxFailed');
}
Thanks,
Prasad
- prasad_more1.3158103303596086E
- November 25, 2011
- Like
- 0
- Continue reading or reply
Is Alias for Users in Salesforce unique?
Is Alias assigned to Users in Salesforce Unique?
- prasad_more1.3158103303596086E
- November 23, 2011
- Like
- 0
- Continue reading or reply
Open Custom Visualforce page on focus of City field in Address Information section
Hi,
When adding/editing account record, I want to auto-populate Billing State/Province and Billing Country fields when Billing City is selected.
I have developed a Visualforce for searching Cities. This Visualforce page should open in a popup window when focus is on Billing City field. In the popup window, User will search for City and select City. When City is selected in popup window, selected City is displayed in Billing City field. I have the data for State/Province and Country for Cities displayed in popup window. I should be able to pass State/Province and Country for selected City from popup window and auto-populate Billing State/Province and Billing Country on account page for selected City. Is this possible with layout provided for Standard Account page?
The Interactive Address lookup application from AppExchange Market place does the same thing. It populates all the address fields when address is selected in popup window and popup window is displayed when focus is on Billing Street field.
Thanks,
Prasad
- prasad_more1.3158103303596086E
- November 17, 2011
- Like
- 0
- Continue reading or reply
a doubt in creating a visualforce component
hi,
i want to create a Value attribute for my custom component. "Value" attribute is the one which is used to get the value in the corresponding controller class in all the default visualforce components. how to create that "Value" attribute for my custom component? we use this "Value" attribute to pass our values to controller class, we retrieve this by putting get, set in controller class, now how can i do in this??
for example :
<apex:page controller="Sample">
<c:sampleComp Value="{!ControllerClass}" />
</apex:page>
i want to pass that value attribute to the controller class called "Sample". Then how should i code this attribute to work like above??
i need any code example to achieve this functionality.. please help me..
thanks,
abivenkat,
SFDC Learner
- abivenkat
- December 27, 2011
- Like
- 0
- Continue reading or reply
Is Alias for Users in Salesforce unique?
Is Alias assigned to Users in Salesforce Unique?
- prasad_more1.3158103303596086E
- November 23, 2011
- Like
- 0
- Continue reading or reply
Open Custom Visualforce page on focus of City field in Address Information section
Hi,
When adding/editing account record, I want to auto-populate Billing State/Province and Billing Country fields when Billing City is selected.
I have developed a Visualforce for searching Cities. This Visualforce page should open in a popup window when focus is on Billing City field. In the popup window, User will search for City and select City. When City is selected in popup window, selected City is displayed in Billing City field. I have the data for State/Province and Country for Cities displayed in popup window. I should be able to pass State/Province and Country for selected City from popup window and auto-populate Billing State/Province and Billing Country on account page for selected City. Is this possible with layout provided for Standard Account page?
The Interactive Address lookup application from AppExchange Market place does the same thing. It populates all the address fields when address is selected in popup window and popup window is displayed when focus is on Billing Street field.
Thanks,
Prasad
- prasad_more1.3158103303596086E
- November 17, 2011
- Like
- 0
- Continue reading or reply