• Ralph Callaway
  • NEWBIE
  • 175 Points
  • Member since 2008

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 52
    Replies

I have an Integer value that I'm assigning to a apex:InputText.  However, it displays as a displays with a decimal point "4654.0" when I use a apex:InputText as opposed to apex:InputField.  Is there any way to specify formatting for this number?  If not, is there a workaround?

 

Edit:

By the way, the reason I want to use an apex:InputText is so that I can set the item to disabled.

Hello,

 

I've run into some trouble trying to fetch related object fields from a dynamic query using SObjects e.g.

 

 

String qs = 'SELECT account.name FROM Contact LIMIT 1';
SObject s = database.query(qs);

String name = s.get('account.name'); // OR
SObject account = s.get('account');

 So neither of the bottom two lines execute and I really need to fetch that information out and into a generic SObject. Anyone have a solution?

 

Wes

 

 

 

Can I set my own response headers besides cache and content-type for an <apex:page> or any other pages on the force.com platform?

 

I'd be interested in setting my own headers in general but in this instance I'm trying to proxy a download of a JSON document through Apex with some modifications before it's passed off to the client.

 

I can return the text just fine and force it to download by modifying the Content-Type but without the Content-Disposition header, I can't set the filename which is a non-starter in my case. If I can't get Apex / VF to do this I'll have to setup a proxy outside of Salesforce.

 

Thanks!

  • March 11, 2011
  • Like
  • 0
I have a VF Page with a custom controller. It contains a string with get and set methods. This value is passed as a String to a component. The attribute has an assignTo referencing a public string with {get;set;) in the components controller. The value is not available (is null) when acessed in the components constructor but is available shortly after within a command button action. I need the value within the constructor. Any ideas?
Hi,

I have a requirement to create a summary page which contains all the data related to a custom object or rather all the fields in that object but those values should appear as read-only. There will be a 'Edit' button on the page and on click of it all the fields should become editable.

How do I go about achieving this?

Regards,
Jina

I have a relatively simple visualforce page following all the listed best practices (avoided multiple component controllers, use transient, don't use multiple forms, etc.) for managing view state, but I'm continually getting view state limit exceeded errors.  Trouble is, my controller and my variables only account for a paltry 15KB out of the 135KB limit with the mysterious "Internal" section taking over 90KB.  

 

WTF*&$!!@#  How is one supposed to go about optimizing a page when we don't have any idea what is in there!  Please help.

 

For full details, please see my post on Salesforce Stackexchange for a full discussion ...

 

Product Management!  R&D! Tier 3! Please HELP!!  This is no beginner question, can someone in the know please help!  I'm offering a healthy bounty for your trouble!!!

 

Could this be a platform bug????????????

I need to download all report metadata from an org to perform some analysis and I'm getting some strange blank retrieve warnings.  Has anyone seen this?  Is there anything I should be concerned about?

 

[sf:retrieve] Request for a retrieve submitted successfully.
[sf:retrieve] Request Id for the current retrieve task: 04s30000000b15GAAQ
[sf:retrieve] Waiting for server to finish processing the request...
[sf:retrieve] Request Status: InProgress
[sf:retrieve] Request Status: InProgress
[sf:retrieve] Request Status: InProgress
[sf:retrieve] Request Status: Completed
[sf:retrieve] Retrieve warnings (4):
[sf:retrieve] package.xml - 
[sf:retrieve] package.xml - 
[sf:retrieve] package.xml - 
[sf:retrieve] package.xml - 
[sf:retrieve] Finished request 04s30000000b15GAAQ successfully.

 

Has anyone experienced issues with Salesforce.com pages becoming unresponsive while using the old system log?  Typically I'll have the debug log running and then try and load a debug log, or execute some anonymous APEX and everything will crash.

Any updates on when one is planned for Summer '11?

 

The community wiki page is pretty explicit about skipping Spring '11, but doesn't address anything beyond that.

It's great how you can query a single custom field from an object and not the whole enchilada.  Does anyone know if it's possible to pull just on custom label?

 

I've tried mucking around with package.xml, but without much luck and can't find anything on the forums.  My gut says this isn't possible but wanted to check with all the experts out there to see if someone has a workaround.

Anyone out there able to get String.format() to work with actual format strings as supposed to basic substitutions?  

 

This works fine and outputs "Name foo, Value bar"

 

String formatString = 'Name {0}, Value {1}';
List<String> inputs = new String[] { 'foo', 'bar' };
system.debug(String.format(formatString, inputs));

 But this blows up with this error: "System.StringException: Cannot format given Object as a Number"

 

String formatString = 'Percent: {0, number, percent}';
List<String> inputs = new String[] { '.85' };
system.debug(String.format(formatString, inputs));

I'm trying to build a user interface that will dynamically format it's output.  I'd hope to have use String.format() to accomplish this.

 

 

Am I making a syntax error or doing something else wrong?

 

I've got some really nasty formulas I'm building out and had hoped to use apex:variable to make the code more readable.  Problem is it appears that apex:variable doesn't work with apex:pageBlockTable and apex:dataTable.  Specifically the variable takes on the value for last row in every row.  The same effect does not happen with apex:repeat and apex:dataList.

 

Is this a bug or am I doing something wrong here?  I can't find anything in the documentation, but did find this post which has yet to be answered.

 

To see what I mean here's some sample code that illustrates the issues.

 

 

public with sharing class VariableInRepeatTest {

	public List<Integer> intArray { get; set; }
	{ intArray = new Integer[] { 1, 2, 3 }; }
}

 

<apex:page controller="VariableInRepeatTest">
<apex:pageBlock >
	<apex:pageBlockSection title="Variable in Page Block Table">
		<apex:pageBlockTable value="{!intArray}" var="int">
			<apex:variable var="variable" value="{!int}"/>
			<apex:column headerValue="Value" value="{!int}"/>
			<apex:column headerValue="Variable" value="{!variable}"/>
		</apex:pageBlockTable>
	</apex:pageBlockSection>
	<apex:pageBlockSection title="Variable in Repeat">
		<apex:repeat value="{!intArray}" var="int">
			<apex:variable var="variable" value="{!int}"/>
			Value: {!int} | Variable: {!variable}
		</apex:repeat>
	</apex:pageBlockSection>
	<apex:pageBlockSection title="Variable in Data List">
		<apex:dataList value="{!intArray}" var="int">
			<apex:variable var="variable" value="{!int}"/>
			Value: {!int} | Variable: {!variable}
		</apex:dataList>
	</apex:pageBlockSection>
	<apex:pageBlockSection title="Variable in Data Table">
		<apex:dataTable value="{!intArray}" var="int">
			<apex:variable var="variable" value="{!int}"/>
			<apex:column headerValue="Value" value="{!int}"/>
			<apex:column headerValue="Variable" value="{!variable}"/>
		</apex:dataTable>
	</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

 

 

 

Is there a DOCUMENTED way to use a static resource as an image in a formula field?  I'm trying to create an 'action link' that looks like a command button and need to find a place to store the background image for the link in a way that is environment agnostic

 

I'd hoped this would work, but $Resource doesn't seem to be recognized in formula fields (works fine in visualforce formulas).  

HYPERLINK('/apex/createAgreement?id=' +  Id ,  IMAGE( $Resource.Create_Agreement_Button , 'Create Agreement' )  , '_top')

 

It appears that this will work, but I'd rather not depend on undocumented functionality to accomplish this.  Particulary given I'd like to add this to a managed package at sometime and in theory there could be an identically named resource that alread exists in the org.

HYPERLINK('/apex/createAgreement?id=' +  Id ,  IMAGE( '/resource/Create_Agreement_Button' , 'Create Agreement' )  , '_top')

 

Documents are also a reasonable approach, but I don't know how to use them across multiple environments where I won't no the document id.

I have a relatively simple visualforce page following all the listed best practices (avoided multiple component controllers, use transient, don't use multiple forms, etc.) for managing view state, but I'm continually getting view state limit exceeded errors.  Trouble is, my controller and my variables only account for a paltry 15KB out of the 135KB limit with the mysterious "Internal" section taking over 90KB.  

 

WTF*&$!!@#  How is one supposed to go about optimizing a page when we don't have any idea what is in there!  Please help.

 

For full details, please see my post on Salesforce Stackexchange for a full discussion ...

 

Product Management!  R&D! Tier 3! Please HELP!!  This is no beginner question, can someone in the know please help!  I'm offering a healthy bounty for your trouble!!!

 

Could this be a platform bug????????????

Has anyone experienced issues with Salesforce.com pages becoming unresponsive while using the old system log?  Typically I'll have the debug log running and then try and load a debug log, or execute some anonymous APEX and everything will crash.

I am trying to create a simple trigger that check is a field has updated and if so adds a datetime stamp in another field.

 

I am getting a read only error and I know it is because I am trying to update the trigger.old. The problem is I am new and do not know how to update the trigger.new. I assume you are supposed t switch back but I can not figure out how to do it

 

Here is my code so far

 

trigger CreateDispositionTimeStamp on Lead (after insert, after update)

{



for (Lead l : System.Trigger.new){

    Lead beforeUpdate = System.Trigger.oldMap.get(l.Id);
   if(l.Status != beforeUpdate.Status){
  
  l.Last_Disposition_Update__c=datetime.now();
   }
}
}

 

 

Any help would be appreciated.

Given that Salesforce does not give out line number/apex class where the crash happened in a managed package, how would one go about debugging where the crash came from when you have 1000's of lines of code. Anyone from salesforce care to shed light? Any hidden knobs, info in debug log? The only thing I can see in debug log is the last query that executed before the crash...nothing more....

 

 

 

 

 

 

 

Hello all,

 

I'm trying to make an application that allows the user to define certain settings and have them be re-used the next time the application is opened. I see that you can define custom settings:

 

https://login.salesforce.com/help/doc/en/cs_define.htm

 

But the method for doing so described there requires making changes in the Salesforce UI. I don't want my users to have to muck around with doing so; is there a way to have my application create the custom settings programmatically the first time it is run?

 

Alternatively is it possible to create a custom database object programmatically, and store the information that way?

 

Thanks!

we currently have a process that can print a word doc from a case which is sort of cool.

but we're looking for a way to print multiple docs instead of one at a time.

i dont want to loop through creating a doc for each one, like mulitple instances of word

Im lookg for a way to format the data so that it will open one word doc with mutliple pages to print them all at once

 

possible?

I'm trying to create a trigger that will fire on the insert/update of any object a User selects from a picklist in a custom VF page I made. Because it could be any object (either custom or standard), I can't just build a trigger the standard way. What I'm assuming is I'm going to have to pass the data into a class/function and that function will create the trigger. I've been looking around but I can't find a way to build a trigger within a class filled with the rest of the necessary data I need to populate the trigger. Is this even possible? If so, can someone point me in the right direction on this?

 

Thanks!

Alright, I have 3 objects set up.

A custom Pipeline Tracker object used to track certain deals

The standard Account Object

A custom Account Team object

 

Both my Pipeline Tracker and Account Team custom objects relate to the Account object on the Account Name.  I need to set up an SOQL statement pulling data from all the objects. About 90% will come from the Pipeline Object and only a handful of fields will come from the Account and Account Team objects.

 

As a test, I've been trying to call 3 fields. One field from each record.

I can successfully call "Category" from the Pipelline Tracker object, and I can successfully relate my Pipeline Tracker to the Account Object and pull the field "Sales Pole" from the Account Object. However, I'm stuck at how to then relate the Account object to my Account Team object and pull the field, "Sales Director". Does anyone know the proper syntax to successfully call a related record of a related record?

 

    List<Pipeline_Tracker_3__c> pipelineRecords = new List <Pipeline_Tracker_3__c>();

    public MultipleDBJoin()
    {
        buildList();
    }

    public void buildList()
    {
        for (Pipeline_Tracker_3__c pt: [SELECT Category__c, Account__r.Sales_Pole__c, Account__r.Account_Team__r.SD__c
        FROM Pipeline_Tracker_3__c])
        {
            pipelineRecords.add(pt);
        }
    }

 

Thanks,

Mike

We use custom settings in a SalesForce app. We access it like so:


    MySettings__c settings = MySettings__c.getOrgDefaults();

 

This was working fine, but today the app completely crashed. By that I mean the page doesn't load at all, I just get a white screen telling me an internal error occurred. We traced it down to this line of code - when it is commented out the page loads as well as it can without those settings (but at least it loads). 

 

Running that single line of code in the System Log (using the Execute functionality) also causes a report of Internal System Error. The only thing the system log reports is "FATAL_ERROR Internal Salesforce.com Error." The Apex code modal reports "Internal System Error: 1018505045-332 (-920440070)"

 

The setting has values for the organization - we've also tried deleting the settings and recreating them to no affect. So far SalesForce support has been no help beyond telling us to try posting here.

 

This is very frustrating as it was working fine on Friday and today it was broken before anyone touched anything.

Hi,

 I am trying to get the value of 3 fields and get the latest record by the contact id getting error, when I try to get the value of other field(Id) that is not in groupby clause

sobject[] res= [Select id,Contact__c,max(createddate) from Custom_Object__c group by Contact__c];

This is general syntax also in other sql. Dow to get the ID of the record which is the latest.

 

Is there any soql I can use which would give me the result with(ID, Contact__c)?

Contact__c could have multiple records.

 

 


.

 

 

  • April 12, 2011
  • Like
  • 0

It's great how you can query a single custom field from an object and not the whole enchilada.  Does anyone know if it's possible to pull just on custom label?

 

I've tried mucking around with package.xml, but without much luck and can't find anything on the forums.  My gut says this isn't possible but wanted to check with all the experts out there to see if someone has a workaround.

My controller works correctly, but when I go to test it I get an error and I'm not sure how to fix it.  Can anybody help?

 

static testMethod void testInquiryToProject()
  {
      List<Case> inquiries = [SELECT ID FROM Case LIMIT 1];
    
    if (inquiries.size() > 0)
    {
        Case inquiry = inquiries[0];
      ApexPages.StandardController controller = new ApexPages.StandardController(inquiry);
      controller.reset();
      InquiryToProjectExtension ext = new InquiryToProjectExtension(controller);
    }else
      System.debug('No Cases available');
  }

 

////////////////////////////////////////////////////////////////////////////////////

 

ublic InquiryToProjectExtension(ApexPages.StandardController cont)
  {
    List<String> fields = new List<String>();
    fields.add('Account');
    fields.add('CaseNumber');
    fields.add('Neighborhood_Lookup__c');
    fields.add('Sector__c');
    fields.add('Owner');
    fields.add('In_a_Main_Street_District__c');
    fields.add('Main_Street_Districts__c');
    cont.addFields(fields);//I get my error here when my test method executes
    inquiry = (Case)cont.getRecord();
    project = new Project__c(RecordType = [select id, name from RecordType where Name =: 'Grant'], Project_Account__c = inquiry.accountID, Neighborhood_Lookup__c = inquiry.Neighborhood_Lookup__c, Sector__c = inquiry.Sector__c, Project_Manager__c = UserInfo.getUserId(), In_a_Main_Street_District__c = inquiry.In_a_Main_Street_District__c, Main_Street_District__c = inquiry.Main_Street_Districts__c);
    controller = new ApexPages.StandardController(project);
  }

Hello,

 

just wanted to get a little info on how some of you might be using svn with your salesforce code.  I'm mainly interested in how you are storing the code in repositories.  Are you just keeping all of your apex code in a single repository, or breaking it up on a project by project basis?  

 

Thanks for any help!

I have a component that accepts a Boolean attribute. Certain combinations of inline functions generate the error message shown in the subject line. See code below for details:

 

<!-- this produces the error --> <c:myComponent myBooleanValue="{!LEN(myObj__c.myField__c) == 0}" .../> <!-- this produces the error --> <c:myComponent myBooleanValue="{!LEN(myObj__c.myField__c) = 0}" .../> <!-- this works! --> <c:myComponent myBooleanValue="{!NOT(LEN(myObj__c.myField__c) > 0)}" .../>

 

Obviously I have a workaround (the last example) but I'm curious to know why the other two do not work.