• XactiumBen
  • SMARTIE
  • 710 Points
  • Member since 2008

  • Chatter
    Feed
  • 27
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 47
    Questions
  • 196
    Replies

I have two multi select lists that I pass values back and forth using jQuery. When testing the values that are being passed from both lists, I receive "Conversion Error setting value" with the values from the select lists with spaces in between:

 

Conversion Error setting value 'a0BQ0000000y4KRMAY a0BQ0000000y4LAMAY' for '#{productionNumbers}'.
Conversion Error setting value 'a0BQ0000000y4LFMAY' for '#{selectedNumbers}'.

 

I need these values to run some SOQL queries and subsequent updates.   More specifically, these values (ids) will be used in:

 

Set<Id> newAvailable = new Set<Id>();
		
for (Production_No__c submitAvailable : [SELECT Id FROM Production_No__c WHERE Id IN : productionNumbers]) {
			
	newAvailable.add(submitAvailable.Id);
			
}


Set<Id> newSelected = new Set<Id>();
		
for (Production_No__c submitSelected : [SELECT Id FROM Production_No__c WHERE Id IN : selectedNumbers]) {
			
	newSelected.add(submitSelected.Id);
			
}

 

 

Here's their properties in the class:

 

public String[] productionNumbers {
		
	get; set;
		
}

public String[] selectedNumbers {
		
	get; set;
		
}

 

 

In the VF page, they're represented by:

 

<apex:selectList id="productionNumbers" styleClass="firstSelect" value="{!productionNumbers}" multiselect="true" size="4">
	<apex:selectOptions value="{!productionOptions}" />
</apex:selectList>


<apex:selectList id="selectedNumbers" styleClass="secondSelect" value="{!selectedNumbers}" multiselect="true" size="4">
	<apex:selectOptions value="{!selectedOptions}" />
</apex:selectList>

 

 

How do I go about retrieving this values for use in my loops? Thanks.

Hi:

   I have 2 links. I have 2 booleans to show or hide a form. Each link relates to a different part of the page.

 VF Page:

 

<apex:form id="menu"> <table border="0" cellspacing="0" cellpadding="0"> <tr><th> <apex:commandLink id="menustudent" value="Student" action="{!showform}" rerender="student"/> </th><th> <apex:commandLink id="menuteacher" value="Teacher" action="{!showform2}" rerender="teacher"/> </th></tr> </table> </apex:form> <apex:outputPanel id="stud" rendered="{!displaystudent}"> <apex:outputPanel layout="block" > <apex:form > blahblahblah </apex:form> <apex:outputPanel id="stud" rendered="{!displayteacher}"> <apex:outputPanel layout="block" > <apex:form > blahblahblah t </apex:form>

 Controller:

 

public boolean displaystudent {get; set;} public boolean displayteacher {get; set;} public void closeform() { displaystudent = false; displayteacher= false; } public void showform() { displaystudent = true; } public void showform2() { displayteacher= true; }

 It works when you click on it once but it does not hide the form when you click on another link. It brings both up and I do not know how to utilize my closeform command???

 

please help..

Thanks

 

 

 

 

How do I display a list with objects of different types. I have to have show a list of Sales Orders and for each sales order a list of Sales Order Item objects that are related to the sales order through a relationship list. I'd like to be able to display it in such a fassion:

 

- Sales order 1

* Item 1

* Item 2

- Sales order 2

* Item 1

* Item 2

 

And so on. Right now I can get a list of sales orders but how do I then show the items related to each one? Any ideas? Any good examples?
Message Edited by Bella on 03-12-2010 01:20 PM
  • March 12, 2010
  • Like
  • 0

I am writing a simple VF template 

 

Getting an error while saving ( Error: Invalid field Opportunity_Rebate__r for SObject Opportunity)

 Opportunity_Rebate is a custom related list and Master Detail with the Opportunity

i have tried all the options(Opportunity_Rebate__c ,Opportunity_Rebates__c,Opportunity_Rebates__r,Opportunity_Rebate__r)

 

<messaging:emailTemplate subject="testing"
recipientType="Contact"
relatedToType="Opportunity"
subject="Rebates for opportunities: {!relatedTo.name}">

<messaging:smileytongue:lainTextEmailBody >
Dear {!recipient.name},
 
Below is a list of Opportunities Rebates related to Opportunity: {!relatedTo.name}

              [ Discount ] - [ Subject ] - [ Email ] - [ Status ]
<apex:repeat var="cx" value="{!relatedTo.Opportunity__Rebate__r}">
              [ {!cx.Discount__c} ]

</apex:repeat>

</messaging:smileytongue:lainTextEmailBody>
</messaging:emailTemplate>

 

Any suggetions!!Do i need to add somting else

 

Thnaks

  • December 17, 2009
  • Like
  • 0

Hi:

   I need to know which I can not find in my research is how to write a testmethod when a standard button is override which means that I have specified in my controller to override the URL.

Now the standard button is New on the Opportunity.

I am overriding the Opportunity URL, so that I can place in the Contact Name and fill it in automatically when they create a new Opp through Contact record.

 

In my test method I do not know how to write a testmethod for this part of my controller:

 

public newoppbutton(ApexPages.StandardController stdController){ string ret=ApexPages.currentPage().getParameters().get('RetURL'); ret=ret.substring(1,ret.length()); if(ret.startswith('003')){ try{ mycontact = [select id,name from contact where id=:ret]; gotcontact=true; }catch(QueryException q){ system.debug(q.getmessage()); } } }

 I am getting stuck at this:

 string ret=ApexPages.currentPage().getParameters().get('RetURL');
ret=ret.substring(1,ret.length());

 Can someone guide me or have an example of how to write this in a testmethod please?

I did try this in a testmethod which did not work:

 

//Now get the contact id redir='/'+ cc.id; PageReference p2 = new PageReference(redir); system.debug('PageReference p21:' + p2); Test.setCurrentPage(p2); string ret; String redire; ret=redir.substring(1); system.debug('PageReference p21d:' + ret); Contact cn=[Select name, id, firstname, lastname,recordtype.name from Contact where id=:ret];

 Which did not work when I called within my testmethod:

ApexPages.standardController sc = new ApexPages.standardController(new Opportunity());
newoppbutton controller = new newoppbutton(sc); 

 My page Reference in my controller is :

public PageReference init() {
String redirectUrl = '';
String recordTypeId = System.currentPageReference().getParameters().get('RecordType');


if (recordTypeId != null) {
redirectUrl = '/006/e?retURL=/006/o&RecordType=' + recordTypeId + '&nooverride=1';
}else if(gotcontact) {
redirectUrl = '/006/e?CF00N70000002RNNE='+mycontact.Name+'&nooverride=1';
}else{
redirectUrl = '/006/e?nooverride=1';
}
PageReference newOpp = new PageReference(redirectUrl);
return newOpp;
}

 So I have tried everything and keep failing on a attempt to de-ference a null...

Thanks

Happy Holidays to all

 

 

 

 

Is there any to pass to parameters from a javascript to a actionFunction?

For eg  I have a var 'x' in javascript set to some value. On some condition I need to call a actionFunction which calls a controller. I need to pass the value of x to the controller. I can pass using param tag of actionFunction to controller but how to pass x to the actionFunctio?

Hi,

 

I have a button called Display As PDF which basically displays the current page in PDF. I want this button, upon press, to open the PDF view in a new window while leaving the current window as is. ALSO, it should set some attributes on the new page before displaying it (FYI the attribute it sets is the renderAs attrib of the page).

 

Thanks.

  • September 29, 2009
  • Like
  • 0

I've created the following page:

 

<apex:page controller="MyClass4">

    <apex:form >
        <apex:inputfield value="{!mileage.Miles__c}"/>
            <BR/>
        <apex:commandbutton action="{!submitMileage}" value="Submit Mileage"/>
    </apex:form>
</apex:page>

 

Controller is:

 

public class MyClass4
{

    public Integer inputValue{get;set;}
      

    private Mileage__c mileage= new Mileage__c(); //I have an s-object with API name 'Mileage__c'
    public Mileage__c getMileage()
    {return mileage;}
    public void setMileage(Mileage__c mile)
    {mileage= mile;}
   
    public Pagereference submitMileage() {
        insert mileage;
      return null;
    }
}

 

I've included this page and it's controller along with a test suite and the custom object 'Mileagein a package and uploaded it.

Installation URL is:

https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t900000008vib

Navigate to the above Installation URL to install the package. You'll then have everything you need to solve my problem.

 

 

Steps:

1. Open MyPage4 in browser. You'll see an inputtext box and a button 'Submit Mileage'.

2. Enter any value in the inputtext box. Click the 'Submit Mileage' button. In the background, a new record of the s-object 'Mileage__c' will be made  and it's 'Miles__c' field will be populated with the value you provided in the inputtext box.

3. Now, change the value in the inputtext box and click 'Submit Mileage' button again.

4. You'll get an error like:

System.DmlException: Insert failed. First exception on row 0 with id a0190000000EvlBAAS; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

Now, my question is why do we get this error.

 

I guess we get this error because the Controller Class' object doesn't die until the page gets refreshed. The controller's object has only one object of type 'Mileage__c'. It's row0 has 'Miles__c' which already has the value that we passed through the inputtext box the first time.

When we enter some other value in the inputtext box and press the 'Submit Mileage' button again, the page tries to put this new value in row0 again. But, perhaps it's not allowed to overwrite the value once entered into any field of the object of type 'Mileage__c'.

 

If you're not understanding my words, please feel free to call me on 9028527067.

  • September 24, 2009
  • Like
  • 0

 

ok, I have a custom controller where I run a SOPL query and fill a list ir with the results.

Then I loop through ir and count up all the items according to result__c and device_type__c.

 

here's my code: 

 

public integer Devtotal(string dev, string res){ integer i = 0; for (inspection_result__c result : this.ir){ if ((result.device_type__c == dev)&&(result.result__c == res)){ i++; } } return i; }

 

So devtotal('smoke detector', 'passed') returns all the smoke detectors that passed, and devtotal('pull station', 'failed') returns all the pull stations that failed, and so on.

 

The problem is In my device_type__c field I have 'pull station' and 'smoke detector', but I also have 'pull station (double)',  'pull station (single)', 'smoke detector (ion)' and 'smoke detector (photo)'.

 

What happens right now is I get counts for each category, but what I want is counts for all the pull stations ('pull station' + 'pull station (double)' + 'pull station (single)') under pull station.

 

I could hard code this in, but if I ever add another option to my device_type__c picklist, I don't want to have to edit my controller.

 

What I want to be able to do is use a wildcard of some kind,  but I don't know if wildcards word here, in Apex as opposed to a SOQL query.

 

Something like this:

 

 

public integer Devtotal(string dev, string res){

dev = dev+'*';

integer i = 0; for (inspection_result__c result : this.ir){ if ((result.device_type__c like dev)&&(result.result__c == res)){ i++; } } return i; }

 

Obviously the above code won't work, so what would I do to make it work? 

 

Hi All, 

I am a newbie to salesforce. I would appreciate, if someone could help me with this. I have two visual force pages A and B. They both use common custom controller. VF page B should access the values set by VF page A. However, I do not want to pass values using apex:param, since I do not want the end user to see the values in query parameters. Is there any way I can access since both pages use the same custom controller?

 

VF Page A

------------

 

<apex:page controller="customcontroller">
<apex:commandButton action="{!gotoNextPage}" value="Next Page"/>
</apex:page>

 

VF Page B (/apex/pageB)

----------------------------

<apex:page controller="customcontroller">
Test Value :{!testValue}
</apex:page>

 

customcontroller

-------------------

 

public String testValue { get; set; }

public PageReference gotoNextPage() {
testValue='TestValue set in VF page A';
// set the next page to VF page B
PageReference page = new PageReference('/apex/pageB');
return page;
}


Hence, when I navigate to pageB, I would like to see Test Value:TestValue set in VF page A. Again, I don't want the URL to be /apex/pageB?testValue='TestValue set in VF page A'. Is it possible to do using VF or apex? I might be missing something simple as well. Thanks for your time to help me.

 

 

http://www.edlconsulting.com

 

 

 

 

 

Message Edited by prakashedl on 11-13-2009 02:32 PM

All, 

 

I'm looking for a way to retrieve the address of a create new object page using apex rather than api functions. For instance, in the api dvelopers guide in Java you use "describeSObject()" to populate a "describeSObjectResult" object from which you can use the field "urlNew"

 

Is there an equivalent of this in Apex or do I have to use a webservice to call out, then the Java api function to retrieve it! 

 

Thanks,

 

M

 

Hi

    In a java script i have done some callculations and i  want to pass dat value to the apex class .

 

 for this i just used the apex function tag but how can i pass the parameter for a function?

 

this is my Visualforce code 

 

<script>

....

...

..

Age = CDateArr[3] - BDateArr[3];
document.getElementById('ageop').value = Age; 

agesend();

....

....

....

</script>

<apex:actionFunction name="agesend" action="{!age}"/>

 

 

 

apex code is

 

string ageval;

 ...

....

public void age(ages)
{
    this.ageval=ages;
}

 

if any one know the solution please help me

  • June 23, 2009
  • Like
  • 0

I have a Visualforce page related to an account with the requirement that the account must have at least one contact. In the page I have created a link that takes them to the creation of a new Contact. Upon save I would like to return the user back to the VF page.

 

Here is a very simple page to reproduce. Simply will in the accid parameter with any account Id.

 

<apex:page > <apex:outputLink value="{!URLFOR($Action.Contact.NewContact,null,[accid = '001Q0000003cgM4'])}">Click me!</apex:outputLink> </apex:page>

When redirected to the Create new contact page you will see the retURL parameter is populated correctly. If you hit cancel you will be returned to the page but if you hit save you will see the detail view for the contact. Is there any way to change this behavior. So type or retSave parameter?

 

Thanks,

Jason

 

Hey everyone. My company creates training videos using Adobe Captivate. We're currently been posting these to our internal website for clients, but are looking at using the new Sites capability to  increase roll out times.

 

I know you can embed flash and flex swf videos in a visualforce page, but I'm not sure if I can use this method for Captivate videos. Our tech writer has stated that he can either output a self-extracting .EXE file or a combination of files including an HTM, 3 SWF and a .JS.

 

I original though I could point to one of the SWF files using apex : flash - but that didn't work. I also tried zipping all 5 files and uploading as a static resource. Then I created a page with an Action coponent like:

action="{!URLFOR($Resource.Training_Video, 'SalesForce_Forecasting.htm')}"

but that doesn't work either.

 

Has anyone else tried embeding the Captivate videos? How did you do it?

 

Thanks!

Hi All,

 

I have been facing issues with rerendering of outputpanels..

 

 

<apex:selectRadio value="{!country}"> <apex:actionSupport event="onclick" reRender="emailservices"/> <apex:selectOptions value="{!items}"/> </apex:selectRadio> <apex:outputpanel id="emailservices" rendered="{!country== 'YES'}"> Select the Email service to be used &nbsp;&nbsp;&nbsp; <apex:selectList value="{!emailservice}" size="1"> <apex:actionSupport event="onchange" reRender="emailaddress" /> <apex:selectOptions value="{!servicenames}"/> </apex:selectList> <br/> <br/> </font> <apex:outputpanel id="mailserv" id="emailaddress" rendered="{!emailservice != NULL}" > Select the Email address to be used &nbsp; <apex:selectList value="{!mailaddress}" size="1" > <apex:selectOptions value="{!mailaddresslist}"/> </apex:selectList> </apex:outputpanel> </apex:outputpanel>

 Am i going wrong anywhere...

 

Thanks in advance

 

 

I have an HTML table that displays data, but it's not a dataTable. I would like to figure out a way to show or hide individual rows if the data for that row is missing (or some other criteria).

 

For something other than a table row, I would use a outputText tag with a rendered attribute that determines if the element will be shown. But an outputText tag puts a SPAN tag around the text inside the outputText tag, which isn't valid inside a table. 

 

Ideas? 

I've created a PDF visualforce page for a purchase orders application i've created but when I pull out an address the address appears in the PDF as:

 

my house<br>My Address line 1<br>My address line 2<br>state<br>country<br>zipcode

 

and its not converting the <br> tags to new lines, how can I make it do that?

 

Thanks 

  • June 12, 2009
  • Like
  • 0

I need to get the milliseconds of the "CreatedDate" field for a case in my Apex controller extension class.  The code looks like this:

 

long creationDateInMillis = ((DateTime)aCase.get('CreatedDate')); // aCase is the object that's passed in to the constructor

 

When the method that contains this line gets invoked, that line causes the error "System.TypeException: Invalid conversion from runtime type Date to Datetime".

 

According to the documentation, "CreatedDate" is of type  "DateTime", so I'm confused as to why the above casting would not work and why it thinks "CreatedDate" is a "Date" instead of a "DateTime"?

 

I'd like to know what I'm doing wrong here.  I need the accuracy down to the milliseconds, so cannot just cast to "Date" as that'll loose the time component.

 

Thank you.

I want to put up your typical "Are you sure?" confirmation dialog box.  Then if the user says "Yes" call a method in my customer controller and have the user end up on the page of the page reference returned by that controll.er 

 

If I use <actionFunction> I just end up back ont he same page.  What I tried is shown below.

 

I thought about doing something like window.top.location="{!URLFOR(save)}"; But it doesn't know what "save" is.  

 

Any ideas?

 

 

<apex:actionFunction action="{!save}" name="doSaveAction"/>

<script>
function doSaveFunc(){
    if ( confirm('The status is Work in Progress, Cancel, Needs Approval, Customer Rejected, or Internal Only. Are you sure you want to Create a Customer PO from this Cost Proposal?' )) {
        doSaveAction();
    }
}
</script>

...

                     <apex:commandButton onclick="Javascript&colon;doSaveFunc();" value="Save"/>
 

Hi, I am trying to save the visualforce page (rendered as PDF) as document and attachment. I was able to insert them but have problem opening the link.

 

 

When I try the document, it says: File does not begin with '%PDF-'

When I try the attachment, it says: unable to process request, please try again later. Any suggestions?

 

I have read through this link and was using the similar code, not sure why doesn't work.

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=13549#M13549

 

 

 

Thanks for your help and reply!

 

Dawn

Message Edited by dawnzdy on 06-05-2009 01:31 PM

I have known for a while that adding a repeat inside a pageblocktable wasn't currently possible in visualforce.  However, when a colleague of mine attempted to do this they got an error message that said this can only be done in API version 20 and above.  Well, the page was set to version 20 and we still got this error message.

 

So the question is can we have repeat tags inside a pageblocktable (to generate columns based on a list) or has this error message been worded incorrectly?

I'm trying to use the Url Rewriter functionality in my developer edition account but can't seem to get it working.  I get an invalid class error message when creating my apex class (see below) and I also can't see the URL Rewriter field in the Site itself.  Is there something I need to do to get this working or is this not available yet?  I assumed it should be available now my developer edition account has been upgraded to Summer '10.

 

 

I'm using this code in my apex class:

 

global class yourClass implements Site.UrlRewriter {

    global PageReference mapRequestUrl(PageReference yourFriendlyUrl)
    {
    }
    
    global PageReference[] generateUrlFor(PageReference[] yourSalesforceUrls)
    {
    }
}

 

The error I get is:

Error: Compile Error: Invalid class: urlrewriter at line 1 column 35  

 

I am currently in the process of integrating Chatter into a Sites visualforce page.  I am doing a query on my customobject__Feed object to show all of the posts on the page but thought it would be good to have the Chatter UI embedded inside the page.  Any ideas how I could do this?  I have attempted to use the apex relatedList tag and using 'customobject__Feed' as the list type (including many variations to this) but with no success.

I have a button on a list view that was working fine previously.  When I switch to enhanced lists this button stops working with the following error:

 

"

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Client', faultstring:'Attribute "xmlns" bound to namespace "http://www.w3.org/2000/xmlns/" was already specified for element "execute".', }

"

 

Any ideas why this would be happening?

 

Code:

 

{!REQUIRESCRIPT("/soap/ajax/18.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/18.0/apex.js")} var list = {!GETRECORDIDS( $ObjectType.Account )}; var errorMsg = sforce.apex.execute("AccountClass", "execute", { accountIds : list }); if (errorMsg != 'success') alert (errorMsg);

 

 

 

I am trying to generate a CSV file using a Document record and a String I supply in the record's body.  Here is how I'm doing it at the moment:

 

Document doc = new Document(); doc.Name = suppliedName; doc.FolderId = suppliedFolder; doc.ContentType = 'text/csv'; doc.Type = 'csv'; doc.Body = Blob.valueOf(csvContent);

 

 

The problem I have is that some characters aren't appearing correctly when I open the file in Excel. Is there a way to fix this, maybe by encoding these characters in my csvContent String? How would I go about doing this?

I have a strange issue that I never realised was an issue before:

 

I have a save button in one of my visualforce pages but when I click it multiple times in a row the action gets fired multiple times ending up in duplicates from the save process.  Should this be happening?

 

Is it best practice to disable all of my commandButtons when I click on it using javascript or have I just somehow broken some visualforce functionality that is already in place?

 

I'm a little confused (and slightly worried) - does it mean all of my commandButtons potentially have this problem?

I am trying to add items to a package which was going fine until I wanted to add reports.  Adding any of the report folders comes up with a message.  Here is the latest one I get:

 

Your requested install failed. Please try this again. None of the data or setup information in your salesforce.com organization should have been affected by this error. If this error persists, contact salesforce.com Support through your normal channels and reference number: 806284727-266 (-1407084036)

 

Any help would be appreciated. 

 

I have started looking at Batch Apex mainly to solve an issue with governor limits but can't seem to get it working.  Here is my code (queries and object names changed):

 

global with sharing class BatchUpdate implements Database.Batchable<SObject> { private final Set<Id> ids; global BatchUpdate(Set<Id> ids) { this.ids = ids; } global Database.QueryLocator start(Database.BatchableContext bc) { return Database.getQueryLocator([Select -lots of fields- Where Lookup__c in :this.ids]); } global void execute(Database.BatchableContext BC, List<SObject> records) { List<Object__c> updateRecords = new List<Object__c>(); for (SObject r : records) { Object__c rs = (Object__c)r; system.debug(rs.id); updateRecords.add(rs); } if (updateRecords.size() > 0) HelperClass.updateRecordsFromList(updateRecords); } global void finish(Database.BatchableContext BC){} }

 

 

I've looked at my debug logs and found that the start method returns 6 records (as it should) but the execute method only processes 1 record.  Can anyone see anything that I've done wrong?

I have a managed package with a page in it that calls some javascript.  Put simply, the javascript gets a div element from the page and uses its offsetWidth and offsetHeight properties.  In a production/developer org these properties give me the correct values but in a sandbox org they give me a value of 0.

 

I've tested my package in two sandboxes - both have the error - and many different developer/production orgs - all of which appear to be fine.

 

I tried to recreate a simple case but it seemed to work in a sandbox - this simple page however wasn't in a managed package.  Is this a bug with sandbox orgs and the managed package interfering with my javascript or am I doing something wrong?

I am trying to create a testmethod for a trigger but I'm running into MIXED_DML_OPERATION error in the Salesforce Run Tests UI. What I do is create an EmailTemplate object in the test (just in case a certain org doesn't have any EmailTemplate records) then creating a Case which fires the trigger. In Eclipse I get 100% code coverage (plus no errors) but in the Salesforce UI I get the MIXED_DML_OPERATION error. Is there any way to fix this issue, like define inserting the EmailTemplate as a setup task that has nothing do to with how my trigger performs?

I am currently looking at the message format feature on an outputText and noticed some problems:

 

 

<apex:outputText value="On {0, Date} there {1, Choice, 0#were no employees|1#was one employee|1<were {1, Number, Currency} employees}"> <apex:param value="{!Account.CreatedDate}" />

<apex:param value="{!Account.NumberOfEmployees}" />

</apex:outputText>

 

 This results in the output 'On May 21, 2009 there were $5.00 employees'.  My currency/locale is set to English (United Kingdom) so I was expecting the pound symbol (£)  

 

Any ideas on how I can get what I want without resorting to creating my own pattern (since I'd like to use it for multi currency orgs)?

Message Edited by XactiumBen on 07-09-2009 10:46 AM

I get 'System.VisualforceException: java.net.SocketException: Connection reset' when I use 'myPage.getContent().toString();'

 

Is this a timeout error or something else?

I have tried unsuccessfully to create a syndication feed for one of my custom objects.  I have created a simple one for accounts like this:

 

Query: SELECT Id, Name, Rating, Owner.Name, CreatedDate FROM Account Mapping: ft: "Account Feed", et: Name, ec: Rating, el: "/" + Id, ea: Owner.Name, eu: CreatedDate

 

 

But when it comes to creating one for a custom object I get this error for some reason:

 

•Query: The SOQL for this feed refers to an invalid object type. Check the syntax of the query and make sure that any objects referenced are readable via your site's public access settings.

 

 

I have given the custom object Read access in the Sites public access settings and also checked the field level security in the same place.  Is there anything else I'm meant to be applying to the object to get this to work? I know I've had trouble giving access to custom objects before in one of my Sites pages.  Has anyone else had this trouble?

I recently created a new package that contains some Sites pages and tried to install this package onto another developer org.  I kept getting a vague 'Install Failed' message before I realised I had to activate Sites on this developer org.

 

It would be good to have an actual message telling me that Sites needs to be enabled on this developer org to save time trying to figure out why my package is failing.

I have a few once active approval process that, when deactivated, I cannot delete.  Is there a way to delete these old approval processes or are they going to be stuck in my salesforce org forever?  I've tried removing the records that have approval history but with no success.

 

Any help would be appreciated on this.

Hi,

 

I have created a formula field that uses the IMAGE() function to dynamically show an image on a record detail page.  This appears to work fine.  My problem occurs when I use an outputField to try and show this formula field on my visualforce page - I just get the html code written as text instead of the actual image.

 

Is this a bug or just some issue with how the visualforce page handles security issues?

I have been testing out the installation of my app through the appexchange and I noticed that although I have set my default license to expire in 30 days this isn't reflected on the page after I click on the 'Get It Now' button.  It looks ok in my LMO and in the actual account I have installed to so it just looks like an Appexchange UI issue.

I have a complex app that uses dynamic apex and have had some problems packaging it.

 

I know that people have had trouble accessing objects when adding them into a dynamic apex package but my problem is that everything seems to be fine apart from accessing a sharing object.

 

Any fixes out there to get around this?

I have an apex relatedList tag on one of my Sites pages which doesn't show up. 

If I load this up within Salesforce I see my related list no problem but when I try and access the same page from Sites I get the Authorisation Required page.  If I move my related list tag around my page then I always see it in Salesforce but in Sites I get a mixture of Authorisation Required and the page showing up but with no related list showing.  Any ideas?

Hi,

I have a spreadsheet that I would like to import into salesforce.  I am saving the spreadsheet as a csv data file then using the Apex Data Loader to get this into salesforce.  My problem is that I have data from different languages and these seem to appear as question marks (e.g. ???? ???) in salesforce.  If I copy and paste the data straight into salesforce it appears with no problems.

I don't however want to copy and paste 300+ records to get them showing properly.  Is there some way to get these special characters importing correctly using the apex data loader?

I have two multi select lists that I pass values back and forth using jQuery. When testing the values that are being passed from both lists, I receive "Conversion Error setting value" with the values from the select lists with spaces in between:

 

Conversion Error setting value 'a0BQ0000000y4KRMAY a0BQ0000000y4LAMAY' for '#{productionNumbers}'.
Conversion Error setting value 'a0BQ0000000y4LFMAY' for '#{selectedNumbers}'.

 

I need these values to run some SOQL queries and subsequent updates.   More specifically, these values (ids) will be used in:

 

Set<Id> newAvailable = new Set<Id>();
		
for (Production_No__c submitAvailable : [SELECT Id FROM Production_No__c WHERE Id IN : productionNumbers]) {
			
	newAvailable.add(submitAvailable.Id);
			
}


Set<Id> newSelected = new Set<Id>();
		
for (Production_No__c submitSelected : [SELECT Id FROM Production_No__c WHERE Id IN : selectedNumbers]) {
			
	newSelected.add(submitSelected.Id);
			
}

 

 

Here's their properties in the class:

 

public String[] productionNumbers {
		
	get; set;
		
}

public String[] selectedNumbers {
		
	get; set;
		
}

 

 

In the VF page, they're represented by:

 

<apex:selectList id="productionNumbers" styleClass="firstSelect" value="{!productionNumbers}" multiselect="true" size="4">
	<apex:selectOptions value="{!productionOptions}" />
</apex:selectList>


<apex:selectList id="selectedNumbers" styleClass="secondSelect" value="{!selectedNumbers}" multiselect="true" size="4">
	<apex:selectOptions value="{!selectedOptions}" />
</apex:selectList>

 

 

How do I go about retrieving this values for use in my loops? Thanks.

I'm trying to use the Url Rewriter functionality in my developer edition account but can't seem to get it working.  I get an invalid class error message when creating my apex class (see below) and I also can't see the URL Rewriter field in the Site itself.  Is there something I need to do to get this working or is this not available yet?  I assumed it should be available now my developer edition account has been upgraded to Summer '10.

 

 

I'm using this code in my apex class:

 

global class yourClass implements Site.UrlRewriter {

    global PageReference mapRequestUrl(PageReference yourFriendlyUrl)
    {
    }
    
    global PageReference[] generateUrlFor(PageReference[] yourSalesforceUrls)
    {
    }
}

 

The error I get is:

Error: Compile Error: Invalid class: urlrewriter at line 1 column 35  

 

My outputPanel is parsing the wrong information as below:

 

 

<script type="text/javascript">
		        function toggleCancelItems(blDisplay) {
		        	if ( !blDisplay ) {
		        		jc('{!$Component.notificationSection.notificationSectionItem}').hide();
		        		jc('{!$Component.notificationSection.event_cancelledemails}').hide();
		        		jc('{!$Component.cancelNoteSection.cancelNoteSectionItem}').hide();
		        		jc('{!$Component.cancelNoteSection.event_cancelNotes}').hide();
		        	} else {
		        		jc('{!$Component.notificationSection.notificationSectionItem}').show();
		        		jc('{!$Component.notificationSection.event_cancelledemails}').show();
		        		jc('{!$Component.cancelNoteSection.cancelNoteSectionItem}').show();
		        		jc('{!$Component.cancelNoteSection.event_cancelNotes}').show();
		        	}
		        }
		        <apex:outputPanel layout="none" rendered="{!newEvent.IsCancelled__c==false}">toggleCancelItems(false);</apex:outputPanel>
		        </script>

 

 

 

is apparently equal to:

 

 

<script type="text/javascript">
          function toggleCancelItems(blDisplay) {
           if ( !blDisplay ) {
            jc('j_id0:j_id112:j_id113:j_id193:notificationSection:notificationSectionItem').hide();
            jc('j_id0:j_id112:j_id113:j_id193:notificationSection:event_cancelledemails').hide();
            jc('j_id0:j_id112:j_id113:j_id193:cancelNoteSection:cancelNoteSectionItem').hide();
            jc('j_id0:j_id112:j_id113:j_id193:cancelNoteSection:event_cancelNotes').hide();
           } else {
            jc('j_id0:j_id112:j_id113:j_id193:notificationSection:notificationSectionItem').show();
            jc('j_id0:j_id112:j_id113:j_id193:notificationSection:event_cancelledemails').show();
            jc('j_id0:j_id112:j_id113:j_id193:cancelNoteSection:cancelNoteSectionItem').show();
            jc('j_id0:j_id112:j_id113:j_id193:cancelNoteSection:event_cancelNotes').show();
           }
          }</td></tr><tr><td class="data2Col  first " colSpan="2">toggleCancelItems(false);</td></tr><tr><td class="data2Col  first " colSpan="2">
          </script>

 

I specifically told it NOT to parse HTML.

 

 

Hi:

   I have 2 links. I have 2 booleans to show or hide a form. Each link relates to a different part of the page.

 VF Page:

 

<apex:form id="menu"> <table border="0" cellspacing="0" cellpadding="0"> <tr><th> <apex:commandLink id="menustudent" value="Student" action="{!showform}" rerender="student"/> </th><th> <apex:commandLink id="menuteacher" value="Teacher" action="{!showform2}" rerender="teacher"/> </th></tr> </table> </apex:form> <apex:outputPanel id="stud" rendered="{!displaystudent}"> <apex:outputPanel layout="block" > <apex:form > blahblahblah </apex:form> <apex:outputPanel id="stud" rendered="{!displayteacher}"> <apex:outputPanel layout="block" > <apex:form > blahblahblah t </apex:form>

 Controller:

 

public boolean displaystudent {get; set;} public boolean displayteacher {get; set;} public void closeform() { displaystudent = false; displayteacher= false; } public void showform() { displaystudent = true; } public void showform2() { displayteacher= true; }

 It works when you click on it once but it does not hide the form when you click on another link. It brings both up and I do not know how to utilize my closeform command???

 

please help..

Thanks

 

 

 

 

How do I display a list with objects of different types. I have to have show a list of Sales Orders and for each sales order a list of Sales Order Item objects that are related to the sales order through a relationship list. I'd like to be able to display it in such a fassion:

 

- Sales order 1

* Item 1

* Item 2

- Sales order 2

* Item 1

* Item 2

 

And so on. Right now I can get a list of sales orders but how do I then show the items related to each one? Any ideas? Any good examples?
Message Edited by Bella on 03-12-2010 01:20 PM
  • March 12, 2010
  • Like
  • 0

I have a strange issue that I never realised was an issue before:

 

I have a save button in one of my visualforce pages but when I click it multiple times in a row the action gets fired multiple times ending up in duplicates from the save process.  Should this be happening?

 

Is it best practice to disable all of my commandButtons when I click on it using javascript or have I just somehow broken some visualforce functionality that is already in place?

 

I'm a little confused (and slightly worried) - does it mean all of my commandButtons potentially have this problem?

The following code works fine when the API version of the page is set to 17. The output pdf page is rendered with two outputPanels which touch each other and everything is ok.
But it doesn't work correctly if I change the API version to 18. Now it shows a gap between two outputPanels.
And if I removed the line "<apex:outputField value="{!Opportunity.name}"/>", the code doesn't work both
under version 17 and 18.
Can anybody help me to fix this problem.
 

<apex:page renderAs="pdf" standardController="Opportunity">

<apex:outputPanel style="border:solid 1px red;height:200px; position:fixed; width:100%;">

</apex:outputPanel>

<apex:outputPanel layout="block" style="border:solid 1px green;position:relative; top:200px; height:200px">

</apex:outputPanel>

<apex:outputField value="{!Opportunity.name}"/>

</apex:page>

 

 

Oke I have been toying around with this the whole day and I don't seem to get it working ... and it frustrates me.

 

I want to open the documents which are in the document table, this is a test for some future development.

 

So I developed a apex class/controller class 

 

 

public class AttachmentOpener { public String attachment {get; set;} public String contenttype {get; set;} public String filetype {get; set;} public AttachmentOpener () { Document doc = [Select d.Body, d.ContentType, d.Type From Document d where d.type='xls']; contenttype = doc.ContentType; filetype = doc.Type; Blob b = doc.Body; attachment = b.ToString(); } }

 

 And an visual force page

 

<apex:page showHeader="false" cache="true" Controller="AttachmentOpener" contenttype="{!contenttype}#test.{!filetype}"> <apex:OutputText escape="false" value="{!attachment}" /> </apex:page>

 

When I open the page Firefox askes me to open or save the attachment (with the correct contenttype), so that all goes according to the way it should.

 

However the content of the file looks all wrong. For text files it works, but when they have more complex content like pdf, excel or word it doesn't work.

 

For instance a pdf does show me the correct number of pages (like 4) but no content (alle pages are blank). The document is correct since salesforce it able to show it to me using the standard functionality.

 

I have the feeling that it has to be something to do with (en)coding but I fail to find a reference as to what to do.

 

So can anybody give a clue to look for next?

 

Thnx

   Natalie

 

 

  • February 12, 2010
  • Like
  • 0

I have some apex code that has been running since winter '09 and it still works in Winter '10.  It consistently fails in Spring '10 

The apex code that invokes a visualforce page and then invokes a getContent method to retrieve the PDF that is created by the Visualforce page.    It consistently fails in Spring '10 with the following error

System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException:  

 

Has anyone seen this and have you figured out what to do? Here is a code snippet - it fails on the getContent.  I have not heard of any changes that are in Spring '10 that should cause this to fail.

 

 

PageReference pdfPage = new PageReference(Page.MyPage.getURL() + '?id=' + quoteId); System.debug('URL for attachment ' + pdfPage.getURL()); System.debug('create new attachment'); //create an attachment //Attach as an Attachment Attachment attachment = new Attachment(); attachment.ParentId = quoteId; attachment.name = 'QuoteSent' + System.now()+'.' + extension; attachment.body = pdfPage.getContent();

 

 

 

  • February 08, 2010
  • Like
  • 0

I have a lookup to Contact on an record o and would like to retrieve the value of a field on contact. This syntax does not seem to work:

o.Contact__r.number__c

Do I really have to run a SOQL query the information? 

Thanks

Pierre 

Hi I am struggling to get a complete test method to work from the below controller. Any help would be appreciated.

 

public class blogController { public Blog_Post__c[] getPosts() { return [select Name, id, CreatedDate, CreatedBy.Name, Post__c from Blog_Post__c]; } public PageReference newPost() { PageReference pageRef= new PageReference('/apex/blogedit'); pageRef.setredirect(true); return pageRef; } public static testMethod void myTest(){ Blog_Post__c testBlog = new Blog_Post__c(name='test blog name'); insert testBlog; } }

 

 

 

I have to run few batch apex classes in a sequence. For example I have BatchApex1, BatchApex2 and BatchApex3. I want BatchApex2 to be started only after BatchApex1 is complete.

similarly BatchApex3 should start only after BatchApex2 is complete. please suggest me how can I achieve this.

 

Thanks in advance.

RS

Message Edited by sfdeveloper9 on 12-19-2009 02:23 PM

Hi,

 

I have  couple tabs which displays the related lists of the corresponding objects which are related to the first tab object.

 

when I selected a record in the related of any tab for edit , it takes me to native edit functionality , once edit is done there , i wanted to come back to the same tab from which I selected the record.

 

is there any way to add parameters to url .

 

 

Hey all,

 

I'm trying to make a component for adding inline notes to any record.

 

But each time I call the {!addNote} action, I get "System.Exception: DML currently not allowed"

 

I don't know why that is, some explanation would be hot.

 

 

Here is my controller:

 

 

public class GenericInlineNoteComponentController { // External variables public List<Note> n {get; set;} public String myObjectId {get; set;} public GenericInlineNoteComponentController() { Id thisId = myObjectId; n = new List<Note>(); Note newNote = new Note(); newNote.ParentId = thisId; //Add the new line right off the bat n.add(newNote); } //Save public PageReference addNote() { insert n; return null; } }

 

Everything displays correctly till addNote is called.

 

 

 

Thanks,

JNH


 

  • December 18, 2009
  • Like
  • 0

How would one replace the ampersand in this:

R & S

so in an url for salesforce to pick it up it comes in as:

R+&+S

I tried:

String abc;
abc = c.name.replace('&', '+&+');

That did not work...

 

I am overriding a URL... 

Hi I am overriden a new button using Apex Code and VF for redirect...

When the name in the contact is :

FirstName = Me & Marry

LastName = Yo

Total Name = Me & Marry Yo

 

My code works when it is Me Yo

My code ends when it is Me & Marry Yo?

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.name+'&nooverride=1';

 Any Suggestions I also tried:

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.firstname+'+'+c.lastname+'&nooverride=1';

 Did not work...

Thanks