• Suri
  • NEWBIE
  • 125 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 40
    Replies

Hi all,

 

I have been researching the forum to understand how to get headers and footers in the PDFs generated from Visualforce. According to these posts it is possible:

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=6411

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=3403

 

However, I have been following the instructions but I get no header or footer. I will explain:

 

1 - I created the static resource as suggested. The file contains the following:

 

 

@page { @bottom-left { content: "Page " counter(page) " Customer Report"; } @top-center { content: "PDF Header"; } }

 

 2 - I included this static resource on my Visualforce page. The first lines of code are:

 

 

<apex:page standardController="Opportunity" showHeader="true" renderas="pdf"> <apex:includeScript value="{!$Resource.PDFHeaderFooter}"/> <table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1"> <tr> <td valign="top">

 

 However, I am not getting anything on the header or footer of the PDF. Can you help? Thanks,

 

J

 

 

 

Hi All,

 

I am developing a visualforce page that has a data table to be dispalyed. The table has around 15 columns to be displayed and the output looks too clumsy. Can anyone plese let me know how to get a scrollbar to traverse in a visualforce page. I could not find any tag relating to scrollbar.

 

Thanks,

Heena 

  • March 12, 2009
  • Like
  • 0

I am trying to update a Date field (Destination) with the value from another Date field (Source). I am calling the Source field in my page using an inputHidden tag. I'm setting the date fields like so:

 

destinationObj.Start_Date__c = sourceObj.Start_Date__c;

 

 

When I do this, I get the following error below:

 

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Start Date: value not of required type: Tue Feb 24 00:00:00 GMT 2009: [Start_Date__c]

Class.MyController.completeMove: line 77, column 9
Class.MyController.Move: line 98, column 9
External entry point

 

However, when I change it to to an inputField tag it works perfectly.  Any reason why it wouldn't work when I hide that field? I don't want the user to have the ability to change this field as it is supposed to be set automatically behind the scenes.

 

Thanks!

Hello,

I am having an issue using the StandardSetController in a VF page for displaying the records from different List Views on Accounts, especially with the setFilderID(String) method.

What my Page does:
It basically just shows all the available List Views on Accounts using the StandardSetController.getListViewOptions() method.

Then the User selects the desired view, it simply sets the StandardSetController.setFilterID() to the selected View ID.

This seems to work fine in most cases, but here is the problem sometimes.

Problem:

For example let's say my List View is "X" with Criteria: Name startsWith Test
- When the StandardSetController.setFilterID() is set to this view, it ALWAYS displays ALL Accounts in the System. The List View filter criteria does not seem to be respected.

HOWEVER, if I just change the SAME List View "X" Criteria to: Name startsWith Sample, the StandardSetController.setFilterID() works perfectly fine.
- and shows me the correct accounts with Names starting with "Sample..."

My conclusion:
The setFilterID() seems to fail in certain cases depending on the VALUE entered in the View Filter (not necessarily on the Field).

Does ANYONE have ANY idea how to solve this?

I tried logging a Case to salesforce already but no viable solution from them yet.

Thanks,

Suri
  • March 04, 2014
  • Like
  • 1

Hello,

I have a Visualforce Component that just contains a button, and performs an Apex Controller action, and reRenders a part of the Component.

VF Component:

<apex:form id="formId">

String reRendered oncomplete: {!reRenderedTextValue}

<apex:commandButton value="ClickButton" action="{!someAction}" reRender="formId" />

</apex:form>

 

This Component works absolute fine when I include it in a VF page in a static way like: <c:MyComponent />

The value of the text in the reRendered postion is refreshed.

But when I include the component using an apex:dynamicComponent like this:

Controller:


public Component.Apex.OutputPanel getDynamicPanel() 
{
Component.Apex.OutputPanel op = new Component.Apex.OutputPanel ();
Component.Apex.PageBlock pBlock = new Component.Apex.PageBlock();
pBlock.childComponents.add(new Component.MyComponent());
op.childComponents.add(pb);
return op;
}

 


In the VF Page:


<apex:dynamicComponent componentValue="{!DynamicPanel}"/>

In this VF Page, when I click the Button, the 'reRender' in the MyComponent does not work at all.

Could any1 help me here?

Thanks,

Suri

  • November 05, 2012
  • Like
  • 0

Hi, I am constructing a HTML in a string, and converting it to PDF using the Blob.toPdf() method.

 

I was getting the following error:

 

FATAL_ERROR|System.InvalidParameterValueException: An error occurred while parsing the input string.

 

I checked it line by line, and I realize that this particular line causes this error. I am referencing a Static Resource in an Image tag, and this is causing the error.

 

Can anybody tell me why? and how to resolve this?

 

String htmlBody = '<img src="/resource/1347290849000/myCompany_Logo" />';

Blob.toPdf(htmlBody);

  • September 23, 2012
  • Like
  • 0

Hi all,
 
Any thoughts on why this happens?
 
Basically, I have a user Object defined in my Controller, and there are 2 input Fields on my VF page.
 
The inputFields are: User.UserRoleId and User.ProfileId
 
When the Role Lookup is selected, and if ANY action happens on the page, the Role simply disappears i.e., becomes null.
 
Any clue why? Or is it a bug in salesforce.com?

 
Please have a look at the code below. Paste this, and just select a Role and hit the "Test" button.
 
VF Page Markup:

======================= VF PAGE MARK UP ==============================
<apex:page controller="TempRolePageController">
<apex:form >
    
    <apex:pageBlock >
        
        <apex:pageBlockButtons >
            <apex:commandButton value="Test" action="{!testButton}" />
        </apex:pageBlockButtons>
        
        <apex:pageBlockSection >
        
            <apex:inputField value="{!userObj.UserRoleId}" required="false" />
            
            <apex:inputField value="{!userObj.ProfileId}" required="false" />
        
        </apex:pageBlockSection>
        
    </apex:pageBlock>
    
    SELECTED ROLE ID: {!userObj.UserRoleId} <br/><br/>
    SELECTED PROFILE ID: {!userObj.ProfileId}
</apex:form>
</apex:page>

=====================================================================
 
Apex Class:
 
==================== CONTROLLER =====================================
 
public class TempRolePageController {

    

    public User userObj { get; set; }

    

    public TempRolePageController()

    {

        userObj = new User();

    }

    

    //Test button

    public pageReference testButton()

    {

        return null;

    }

    



}

=======================================================================

  • April 27, 2010
  • Like
  • 0

Hi

 

I have a page where I have used the "connection.js" to Login into a Salesforce instance.

 

But I am receiving errors when I try to do this.

 

When I host it from a Local Server or on a Salesforce Sites page, I get the error:

 

[Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "https://na6.salesforce.com/soap/ajax/16.0/connection.js Line: 594"]

 

Can anyone tell me why this error occurs? And what should be done for successful Login?

 

I have provided my code below. Its a simple JS code that calls the Login method.

 

 

================ CODE ==============================

 

<HTML>
<HEAD>

<script src="https://na6.salesforce.com/soap/ajax/16.0/connection.js" ></script>

<script type="text/javascript" >

function logincall()
{

    try{
   
    sforce.connection.serverUrl = 'http://www.salesforce.com';
   
    var usrname = document.getElementById('userid').value;
    var passwrd = document.getElementById('passid').value;

    if(usrname == null || usrname == '' || passwrd == null || passwrd == '')
    {
        alert('Please enter Username AND Password');
        return;
    }
   
    var result = sforce.connection.login(usrname, passwrd);

    alert("Logged in with session id " + result.sessionId);
    }
    catch(error)
    {
        alert(error);
       
    }

}

</script>

</HEAD>

<BODY>


To test logging into a Salesforce Instance using the connection.js "login" call


<table>
        <tr>
            <td>Username</td>
            <td><input type="text" id="userid" value="" /></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><input type="password" id="passid" value="" /></td>
        </tr>

</table>


    <input type="button" value="Login" onclick="logincall();" />

</BODY>

</HTML>

 

================ CODE ==============================

  • November 09, 2009
  • Like
  • 0

Hi

 

I have a problem using the Flex Toolkit for salesforce.  I would greatly appreciate if anyone patiently reads this and helps me out.

 

The following are the steps I followed:

 

1. Created a flex project in Flex Builder 3

2. Dropped in the salesforce.mxml file as a startup application

3. Included the as3Salesforce.swc in the library path

4. Entered my own developer username and password into this (salesforce.mxml) file

5. Set the Setup --> Administration Setup --> Security Controls --> Session Settings --> 'Require secure connections (HTTPS)' Checkbox to FALSE

6. Built the project and ran the application salesforce.mxml


Now this works perfectly fine if I run this from my Flex Builder, and I have no issues.

 

Then, what I did was, I exported this as a ".swf" file and uploaded it as a Static Resource in another developer org. of mine. I then embedded this onto a VF Page.

 

Now, when I access this VF Page, the "login" operation works perfectly fine (logging into my 1st developer org) and I get the following text in the "ta.text" Textarea:

 

Login successful:
(com.salesforce.results::LoginResult)#0
  context = (null)
  passwordExpired = false
  serverUrl = "https://na7-api.salesforce.com/services/Soap/u/9.0/...............

 

 

Here is my issue. When I try to do any other operation after this, like "describeSObjects" / "describe all" and so on, I receive this error:

 

fault from operation: (mx.rpc::Fault)#0
  content = (null)
  errorID = 0
  faultCode = "Channel.Security.Error"
  faultDetail = "Destination: DefaultHTTP"
  faultString = "Security error accessing url"
  message = "faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:'Destination: DefaultHTTP'"
  name = "Error"
  rootCause = (flash.events::SecurityErrorEvent)#1
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::URLLoader)#2
      bytesLoaded = 0
      bytesTotal = 0
      data = (null)
      dataFormat = "text"
    eventPhase = 2
    target = (flash.net::URLLoader)#2
    text = "Error #2170: Security sandbox violation: http:<my developer org 2 VF Page URL> cannot send HTTP headers to https://na7-api.salesforce.com/services/Soap/u/9.0/<dev org 1 ID>."
    type = "securityError"

 

 

 Could anyone tell me why exactly this happens and what is the Solution?

 

 I checked out the community Posts:

 

 

  • http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=2741
  • http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=11600

 

 

and tried them out, but doesn't seem to work.

 

 

I would greatly appreciate any help on this issue.

 

Thank You.

Message Edited by Suri on 10-09-2009 06:20 PM
Message Edited by Suri on 10-14-2009 04:39 PM
  • October 09, 2009
  • Like
  • 0

Hi...

 

Here is what i need in brief...

 

I have a VF Page where the User chooses the different fields of an Object.

 

Now, in the next page, I want these fields as <apex:inputField > dynamically rendered on the page.

 

Is this possible?

 

 

Let me explain below how it works for HTML Tags.

 

 

For example, in my controller, if I construct a String dynamicstr = '<input type="text" value="TEST" size="20" />',

 

and render is on my VF Page like: <apex: outputText value="{!dynamicstr}" escape="false" />

 

I am able to see an input Text field on the page with value 'TEST'.

 

But the same doesn't work for VF tags like "<apex:inputField>".

 

 

Can anyone help me out on this?

 

Thanks.

 

Suri

 

 

 

Message Edited by Suri on 08-17-2009 11:26 AM
  • August 17, 2009
  • Like
  • 0

Hi

 

Is there a way in Apex, to find if a Record is Locked?

 

I am not talking about the ProcessInstance Status here.

 

I can get the Status = 'Pending' from the ProcessInstance's TargetObjectID.

 

But it can be possible that the Status is 'Approved' and the record is still locked, waiting for the next in hierarchy to Approve it.

 

So, how do we find if a Record is Locked?

Message Edited by Suri on 08-11-2009 03:07 PM
  • August 11, 2009
  • Like
  • 0

Hi

 

I have created a visualforce page with contentType="application/vnd.ms-powerpoint".

 

I want to know how to provide a "slide-break" (not sure if that's the right term to be used) in order to specify the content in different number of slides.

 

Because right now, irrespective of the size of the visualforce page, the entire page content falls into just a single slide.

 

I would appreciate any help on this issue.

 

Thanks,

 

Suri

  • June 17, 2009
  • Like
  • 0

Hi

 

I have a Contact in my Salesforce org. and have an Attachment (a PDF file) associated to that Contact.

 

Is it possible to download this PDF file from a Site Page?

 

I am able to query and Display the name of the file on my Site page, but want to know if there's a way to download the file.

 

Thanks,

 

Suri

  • June 05, 2009
  • Like
  • 0

Hi

 

I have a Visualforce page with StandardController="Account" and extensions="SampleController_extension".

 

I want to use an <apex:component> inside this page, and I want the contents of the component to reference the extension.

 

So, if I use:

 

<apex:component extensions="SampleController_extension">

 

I get the Error:

 

Error: Only StandardController and Apex Code controllers are currently supported.

 

My question is:

 

How do I specify a StandardController for an <apex:Component> ?

 

Thanks,

 

Suri

Message Edited by Suri on 05-15-2009 03:28 PM
  • May 15, 2009
  • Like
  • 0

Hi

 

I want to know if there is any way of using the Metadata API from Salesforce Sites i.e., from within Salesforce.

 

For example, If I have two salesforce orgs - orgA and org B.

 

I have a Site Page for orgA.

 

Is there any way I can create ApexClasses, Triggers or ApexPages in org B from this orgA's Site Page ?

 

I would greatly appreciate any help on this issue.

 

Thanks,

 

Suri

  • May 04, 2009
  • Like
  • 0

Hi

 

I want to know if there is any way of using the Metadata API from within Salesforce.

 

For example, If I have two salesforce orgs - orgA and org B,

 

is there any way I can create ApexClasses, Triggers or ApexPages in org B from within org A ?

 

I would greatly appreciate any help on this issue.

 

Thanks,

 

Suri

  • May 04, 2009
  • Like
  • 0

http://wiki.developerforce.com/index.php/Using_the_Force_Toolkit_for_Facebook

 

Hi

 

I have created a Facebook App named: ForceApp, and created the corresponding FacebookApplist Object with the API key and the API Secret.

 

 

When I try to load the page: /apex/FBToolkitPage?appname=ForceApp

 

I receive the following error:

 

Application.GetPublicInfo:
<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<error_code>900</error_code>
<error_msg>No such application exists.</error_msg>

 

 Can anyone tell me why this happens?

 

Should the Application be submitted to the Application Directory in Facebook for it to work?

 

(which requires atleast 10 monthly active users)

 

I would greatly appreciate help on this issue.

 

Thank You

  • March 24, 2009
  • Like
  • 0

Hi

 

I have a specific Account Record Type assigned to Standard User.

 

Is there anyway to Query the Record Type ID based on the Profile to which it is assigned?

 

I know i can Query all Record Types in the database using:

 

[SELECT Id, Name, SobjectType FROM RecordType]

 

But is it possible to do this query based on the Profile Id?

  • March 16, 2009
  • Like
  • 0
Hello,

I am having an issue using the StandardSetController in a VF page for displaying the records from different List Views on Accounts, especially with the setFilderID(String) method.

What my Page does:
It basically just shows all the available List Views on Accounts using the StandardSetController.getListViewOptions() method.

Then the User selects the desired view, it simply sets the StandardSetController.setFilterID() to the selected View ID.

This seems to work fine in most cases, but here is the problem sometimes.

Problem:

For example let's say my List View is "X" with Criteria: Name startsWith Test
- When the StandardSetController.setFilterID() is set to this view, it ALWAYS displays ALL Accounts in the System. The List View filter criteria does not seem to be respected.

HOWEVER, if I just change the SAME List View "X" Criteria to: Name startsWith Sample, the StandardSetController.setFilterID() works perfectly fine.
- and shows me the correct accounts with Names starting with "Sample..."

My conclusion:
The setFilterID() seems to fail in certain cases depending on the VALUE entered in the View Filter (not necessarily on the Field).

Does ANYONE have ANY idea how to solve this?

I tried logging a Case to salesforce already but no viable solution from them yet.

Thanks,

Suri
  • March 04, 2014
  • Like
  • 1
Hello,

I am having an issue using the StandardSetController in a VF page for displaying the records from different List Views on Accounts, especially with the setFilderID(String) method.

What my Page does:
It basically just shows all the available List Views on Accounts using the StandardSetController.getListViewOptions() method.

Then the User selects the desired view, it simply sets the StandardSetController.setFilterID() to the selected View ID.

This seems to work fine in most cases, but here is the problem sometimes.

Problem:

For example let's say my List View is "X" with Criteria: Name startsWith Test
- When the StandardSetController.setFilterID() is set to this view, it ALWAYS displays ALL Accounts in the System. The List View filter criteria does not seem to be respected.

HOWEVER, if I just change the SAME List View "X" Criteria to: Name startsWith Sample, the StandardSetController.setFilterID() works perfectly fine.
- and shows me the correct accounts with Names starting with "Sample..."

My conclusion:
The setFilterID() seems to fail in certain cases depending on the VALUE entered in the View Filter (not necessarily on the Field).

Does ANYONE have ANY idea how to solve this?

I tried logging a Case to salesforce already but no viable solution from them yet.

Thanks,

Suri
  • March 04, 2014
  • Like
  • 1

Hi All,

 

I have created a trigger on account, when mergae two accounts then lossing account owner will be the part of account team. I have tested this trigger on sandbox and everythng is working fine.

 

Now i am deploying this trigger on production then it is showing error "Entity is not org-accessible". Please help me.

 

Trigger Code is:

============================================================

trigger AccountMerge on Account (after delete) {
TriggerEnabled__c myCS = TriggerEnabled__c.getValues('AccountMerge');
if(myCS==Null || (myCS.Object_Name__c=='Account' && myCS.Active__c==True)){
List<AccountTeamMember> lstAccountTeam = New List<AccountTeamMember>();
List<AccountShare> acctSharingRules = new List<AccountShare>();
Map<id, Account> mapAccount= New Map<Id, Account>();
Map<string,AccountTeamMember> mapAccountTeam = New Map<string,AccountTeamMember>();
List<Id> lstAccountID= new List<Id>();

for(Account objAccount: trigger.old)
if(objAccount.MasterRecordId!=Null)
lstAccountId.add(objAccount.MasterRecordId);

for(Account objAccount: [Select id, Ownerid, Name from Account where id =:lstAccountId])
mapAccount.put(objAccount.Id, objAccount);

for(Account objAccount: trigger.old)
{
if(objAccount.MasterRecordId!=Null && mapAccount.get(objAccount.MasterRecordId).OwnerId!=objAccount.OwnerId){

string strTemp= objAccount.MasterRecordId + '-' + objAccount.Ownerid;
if(!mapAccountTeam.containsKey(strTemp)){
AccountTeamMember objAccountTeam = new AccountTeamMember();
objAccountTeam.AccountId = objAccount.MasterRecordId;
objAccountTeam.TeamMemberRole = 'Sales Rep';
objAccountTeam.UserId = objAccount.ownerid;
lstAccountTeam.add(objAccountTeam);
mapAccountTeam.put(objAccount.MasterRecordId + '-' + objAccount.ownerid,objAccountTeam );

AccountShare processorSharingRule = new AccountShare();
processorSharingRule.AccountId = objAccount.MasterRecordId;
processorSharingRule.OpportunityAccessLevel = 'Edit';
processorSharingRule.CaseAccessLevel = 'Edit';
processorSharingRule.AccountAccessLevel = 'Edit';
processorSharingRule.UserOrGroupId = objAccount.ownerid;
acctSharingRules.add(processorSharingRule);
}
}
}
system.debug('Account Team---->' + lstAccountTeam);
//system.debug('acctSharingRules------>' + acctSharingRules);
try {
if(lstAccountTeam.size()>0)
insert lstAccountTeam;
if(acctSharingRules.size()>0)
insert acctSharingRules;
}
catch (System.DmlException e){
}
}
}

====================================================================

 

 

  • September 19, 2013
  • Like
  • 0

In the User's Guide there is a sample http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm?CSHID=apex_methods_system_test.htm#TestLoadDataExampleSection

of how to use the Test.loadData method to load a csv file with Accounts.

 

I cannot see any documentation nor samples showing how to load records with references (lookup or master-detail) to parent records - e.g. if I want to load Contacts, which refer to Accounts.

 

Anyone who knows. I suppose I am not going to "invent" record IDs????

Hello,

I have a Visualforce Component that just contains a button, and performs an Apex Controller action, and reRenders a part of the Component.

VF Component:

<apex:form id="formId">

String reRendered oncomplete: {!reRenderedTextValue}

<apex:commandButton value="ClickButton" action="{!someAction}" reRender="formId" />

</apex:form>

 

This Component works absolute fine when I include it in a VF page in a static way like: <c:MyComponent />

The value of the text in the reRendered postion is refreshed.

But when I include the component using an apex:dynamicComponent like this:

Controller:


public Component.Apex.OutputPanel getDynamicPanel() 
{
Component.Apex.OutputPanel op = new Component.Apex.OutputPanel ();
Component.Apex.PageBlock pBlock = new Component.Apex.PageBlock();
pBlock.childComponents.add(new Component.MyComponent());
op.childComponents.add(pb);
return op;
}

 


In the VF Page:


<apex:dynamicComponent componentValue="{!DynamicPanel}"/>

In this VF Page, when I click the Button, the 'reRender' in the MyComponent does not work at all.

Could any1 help me here?

Thanks,

Suri

  • November 05, 2012
  • Like
  • 0

Hi, I am constructing a HTML in a string, and converting it to PDF using the Blob.toPdf() method.

 

I was getting the following error:

 

FATAL_ERROR|System.InvalidParameterValueException: An error occurred while parsing the input string.

 

I checked it line by line, and I realize that this particular line causes this error. I am referencing a Static Resource in an Image tag, and this is causing the error.

 

Can anybody tell me why? and how to resolve this?

 

String htmlBody = '<img src="/resource/1347290849000/myCompany_Logo" />';

Blob.toPdf(htmlBody);

  • September 23, 2012
  • Like
  • 0

Hello everybody,

 

while trying to render a page as .pdf, I tried to use font-family: Arial Unicode MS with font-weight: bold.

That did not work. So I did first things first: google told me that it is simply not possible to do that.

 

Ofcourse I also used SF.com documentation and found this:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_renderas_pdf.htm

 

So, Arial Unicode MS with font-weight: bold is used right in the doc. So what am I doing wrong, it is absolutely not working for me.

 

body {
            font-family:Arial Unicode MS;
            font-weight:bold;    
     }   

// First way I tried it 

body {
            font-family:Arial Unicode MS;  
     }                   
            
div.content {
            font-weight:bold;    
     }   

// Second way I tried

 

Hello,

 

I am getting an exception while making an apex callout to a 3rd party web service from apex stub classes - System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element : <element name>

 

I can see the request as well as response in the developer org, but after getting the response, SFDC might throwing an exception while parsing.

 

Please suggest if anyone has ever encountered this error.

 

Regards,

Hi all,
 
Any thoughts on why this happens?
 
Basically, I have a user Object defined in my Controller, and there are 2 input Fields on my VF page.
 
The inputFields are: User.UserRoleId and User.ProfileId
 
When the Role Lookup is selected, and if ANY action happens on the page, the Role simply disappears i.e., becomes null.
 
Any clue why? Or is it a bug in salesforce.com?

 
Please have a look at the code below. Paste this, and just select a Role and hit the "Test" button.
 
VF Page Markup:

======================= VF PAGE MARK UP ==============================
<apex:page controller="TempRolePageController">
<apex:form >
    
    <apex:pageBlock >
        
        <apex:pageBlockButtons >
            <apex:commandButton value="Test" action="{!testButton}" />
        </apex:pageBlockButtons>
        
        <apex:pageBlockSection >
        
            <apex:inputField value="{!userObj.UserRoleId}" required="false" />
            
            <apex:inputField value="{!userObj.ProfileId}" required="false" />
        
        </apex:pageBlockSection>
        
    </apex:pageBlock>
    
    SELECTED ROLE ID: {!userObj.UserRoleId} <br/><br/>
    SELECTED PROFILE ID: {!userObj.ProfileId}
</apex:form>
</apex:page>

=====================================================================
 
Apex Class:
 
==================== CONTROLLER =====================================
 
public class TempRolePageController {

    

    public User userObj { get; set; }

    

    public TempRolePageController()

    {

        userObj = new User();

    }

    

    //Test button

    public pageReference testButton()

    {

        return null;

    }

    



}

=======================================================================

  • April 27, 2010
  • Like
  • 0

Hi

 

I have a page where I have used the "connection.js" to Login into a Salesforce instance.

 

But I am receiving errors when I try to do this.

 

When I host it from a Local Server or on a Salesforce Sites page, I get the error:

 

[Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "https://na6.salesforce.com/soap/ajax/16.0/connection.js Line: 594"]

 

Can anyone tell me why this error occurs? And what should be done for successful Login?

 

I have provided my code below. Its a simple JS code that calls the Login method.

 

 

================ CODE ==============================

 

<HTML>
<HEAD>

<script src="https://na6.salesforce.com/soap/ajax/16.0/connection.js" ></script>

<script type="text/javascript" >

function logincall()
{

    try{
   
    sforce.connection.serverUrl = 'http://www.salesforce.com';
   
    var usrname = document.getElementById('userid').value;
    var passwrd = document.getElementById('passid').value;

    if(usrname == null || usrname == '' || passwrd == null || passwrd == '')
    {
        alert('Please enter Username AND Password');
        return;
    }
   
    var result = sforce.connection.login(usrname, passwrd);

    alert("Logged in with session id " + result.sessionId);
    }
    catch(error)
    {
        alert(error);
       
    }

}

</script>

</HEAD>

<BODY>


To test logging into a Salesforce Instance using the connection.js "login" call


<table>
        <tr>
            <td>Username</td>
            <td><input type="text" id="userid" value="" /></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><input type="password" id="passid" value="" /></td>
        </tr>

</table>


    <input type="button" value="Login" onclick="logincall();" />

</BODY>

</HTML>

 

================ CODE ==============================

  • November 09, 2009
  • Like
  • 0

Hi

 

I have a problem using the Flex Toolkit for salesforce.  I would greatly appreciate if anyone patiently reads this and helps me out.

 

The following are the steps I followed:

 

1. Created a flex project in Flex Builder 3

2. Dropped in the salesforce.mxml file as a startup application

3. Included the as3Salesforce.swc in the library path

4. Entered my own developer username and password into this (salesforce.mxml) file

5. Set the Setup --> Administration Setup --> Security Controls --> Session Settings --> 'Require secure connections (HTTPS)' Checkbox to FALSE

6. Built the project and ran the application salesforce.mxml


Now this works perfectly fine if I run this from my Flex Builder, and I have no issues.

 

Then, what I did was, I exported this as a ".swf" file and uploaded it as a Static Resource in another developer org. of mine. I then embedded this onto a VF Page.

 

Now, when I access this VF Page, the "login" operation works perfectly fine (logging into my 1st developer org) and I get the following text in the "ta.text" Textarea:

 

Login successful:
(com.salesforce.results::LoginResult)#0
  context = (null)
  passwordExpired = false
  serverUrl = "https://na7-api.salesforce.com/services/Soap/u/9.0/...............

 

 

Here is my issue. When I try to do any other operation after this, like "describeSObjects" / "describe all" and so on, I receive this error:

 

fault from operation: (mx.rpc::Fault)#0
  content = (null)
  errorID = 0
  faultCode = "Channel.Security.Error"
  faultDetail = "Destination: DefaultHTTP"
  faultString = "Security error accessing url"
  message = "faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:'Destination: DefaultHTTP'"
  name = "Error"
  rootCause = (flash.events::SecurityErrorEvent)#1
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::URLLoader)#2
      bytesLoaded = 0
      bytesTotal = 0
      data = (null)
      dataFormat = "text"
    eventPhase = 2
    target = (flash.net::URLLoader)#2
    text = "Error #2170: Security sandbox violation: http:<my developer org 2 VF Page URL> cannot send HTTP headers to https://na7-api.salesforce.com/services/Soap/u/9.0/<dev org 1 ID>."
    type = "securityError"

 

 

 Could anyone tell me why exactly this happens and what is the Solution?

 

 I checked out the community Posts:

 

 

  • http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=2741
  • http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=11600

 

 

and tried them out, but doesn't seem to work.

 

 

I would greatly appreciate any help on this issue.

 

Thank You.

Message Edited by Suri on 10-09-2009 06:20 PM
Message Edited by Suri on 10-14-2009 04:39 PM
  • October 09, 2009
  • Like
  • 0

Hi,

Is there a way to disable the Edit buttoni n the Enhanced list view? Thank you much.

 

Paul

 

  • August 13, 2009
  • Like
  • 0

Hi

 

I have created a visualforce page with contentType="application/vnd.ms-powerpoint".

 

I want to know how to provide a "slide-break" (not sure if that's the right term to be used) in order to specify the content in different number of slides.

 

Because right now, irrespective of the size of the visualforce page, the entire page content falls into just a single slide.

 

I would appreciate any help on this issue.

 

Thanks,

 

Suri

  • June 17, 2009
  • Like
  • 0