• ryan_marples
  • NEWBIE
  • 145 Points
  • Member since 2008

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 35
    Replies

 

Hi All, 

 

How can I pass a value to an apex:param of an apex:commandLink from an apex:SelectList ?

I think I have to set an Id attribute to my SelectList but the problem is that my SelectList is in a DataList and I don't know how I can set a different SelectList Id for each row of my DataList.

 

My code

<apex:dataList value="{!events}" var="event"> <apex:form> <apex:outputText value="{!event.Commercial__c}"/> <apex:outputText value="{!event.Produits__c}"/> <apex:outputText value="{!event.Subject}"/> <apex:outputText value="{!event.What.Name}"/> <apex:selectList value="{!choice}" multiselect="false" size="1"> <apex:selectOptions value="{!choiceaction}"/> </apex:selectList> <apex:commandLink value="Do Action for this event" action="{!goToAction}"> <apex:param value="{!event.Id}" name="eventid" /> <apex:param value="" name="selectedChoice" /> </apex:commandLink> </apex:form> </apex:dataList>

 

 

I want my param selectedChoice have to take the value of the SelectList when I click on my commandLink.

 

My Controller

 

... public PageReference goToAction() { evt = PageReference Traitementcas1 ApexPages.currentPage().getParameters().get('eventid'); choice = PageReference Traitementcas1 ApexPages.currentPage().getParameters().get('selectedChoice'); ... }

 

 

Any Help please ?

 

Thanks

 

  • August 28, 2009
  • Like
  • 0
Hi how do you get the left side border when you do a pageblock Tag? The right side comes out and the bottom breaks? Anyone plz help.. Thanks
<apex:pageBlock >

Hi,

 

I want a situation where a user from my .net UI can create a folder under documents and add documents to it.  Now, I can figure out how to create documents in a pre existing folder.  But, I can not figure out how to create a folder under documents.

If anyone has any ideas, please share.

 

Swati 

Hello, Sirs.

 

I have such Email template:

 

Dear {!Contact.FirstName},
Secret code is - {!??????????}

 

I must insert into email message my specific text message ( instead ???????? ).

 

 

 

Apex Code:

//AcID - Contact ID


//Eml - Email Template ID

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setReplyTo('support@force.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setTargetObjectId(AcId);
mail.setTemplateId(EmlId);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Which way I can do it ?


Thank you.

 

Message Edited by Olbrest on 03-04-2009 06:59 PM
I have searched the boards looking for an answer, and can't quite find what I'm looking for.

We have a custom object called 'domains' which is simply a form listing off any domains that a user may have purchased through us.  Each contact is associated with an account, a company and an office.  In the cases section when we select a contact it auto-populates the account and office information.  In this new custom object it doesn't seem to grab the account or office info.

Tried creating a trigger to update these fields, but was not successful.  I'm a bit of a SalesForce n00b and would greatly appreciate any help in creating this function.  Basically, when we select a contact the contacts account and office information should auto populate those fields, either on save or when it is selected.

Help?

Thanks,

Benjamin Higginbotham

We have overidden our new and edit buttons for Cases to go to a custom visualforce page.  This was fine until now we want to utilize Record Types.  Now, regardless of the record type chosen, new cases go to the custom visualforce page instead of the page layout for the record type.  I am thinking that I need another VF page to act as a proxy to route the user to the correct page.  I have read a couple of forum posts but am unsure if they are applicable to my problem.

 

http://forums.sforce.com/sforce/board/message?board.id=Visualforce&thread.id=4875

 

Hi All, 

 

How can I pass a value to an apex:param of an apex:commandLink from an apex:SelectList ?

I think I have to set an Id attribute to my SelectList but the problem is that my SelectList is in a DataList and I don't know how I can set a different SelectList Id for each row of my DataList.

 

My code

<apex:dataList value="{!events}" var="event"> <apex:form> <apex:outputText value="{!event.Commercial__c}"/> <apex:outputText value="{!event.Produits__c}"/> <apex:outputText value="{!event.Subject}"/> <apex:outputText value="{!event.What.Name}"/> <apex:selectList value="{!choice}" multiselect="false" size="1"> <apex:selectOptions value="{!choiceaction}"/> </apex:selectList> <apex:commandLink value="Do Action for this event" action="{!goToAction}"> <apex:param value="{!event.Id}" name="eventid" /> <apex:param value="" name="selectedChoice" /> </apex:commandLink> </apex:form> </apex:dataList>

 

 

I want my param selectedChoice have to take the value of the SelectList when I click on my commandLink.

 

My Controller

 

... public PageReference goToAction() { evt = PageReference Traitementcas1 ApexPages.currentPage().getParameters().get('eventid'); choice = PageReference Traitementcas1 ApexPages.currentPage().getParameters().get('selectedChoice'); ... }

 

 

Any Help please ?

 

Thanks

 

  • August 28, 2009
  • Like
  • 0

Exception type: class common.apex.runtime.impl.ExecutionException
Exception msg: Attempt to de-reference a null object
Stack trace:
common.apex.runtime.impl.ExecutionException: Attempt to de-reference a null object

 

Above is a exception I am seeing thrown from a Visualforce Controller class.  I have narrowed down, in the Apex code, the code block area it occurs but I cannot find the error that causes it.  It makes me believe this is a runtime bug in the Apex runtime engine.

 

Has anyone else seen this exception and have a suggestion on how to debug or fix it.

 

  • August 27, 2009
  • Like
  • 0
How do we make apex classes serialisable? This is a urgent requirement. If anyone know please share the information.

Hi everyone,

 

We have a weird problem: After packaging, and whatever type of package we use to do so, the VF page in Sites doesn't retrieve values that has been fetched in the controller.

It ONLY happens in Sites. We have used the same page from the private url and it works. In the packaging org it works on both side.

So it's definitely a Site issue  after packaging.

We tried with a unmanaged package to try and debug. But everything seems to happen ok: the controller is called, the SOQL request gets the values, no exception is sent. But in the VF page there is nothing in place of what should be displayed.

 

Here is a simple example:

 

 

 

public class cont { public String color {get;set;} public cont(){ color = [select color__c from Color__c limit 1].color__c; } } VF page:<apex:page controller="cont">Color:{!color} </apex:page>

 

 

 

 

 No exception is thrown but the color is not displayed if we use this in Site after packaging the application and install it to a DE org.

 

Probably linked to this problem we can't access the page aymore. We need to prefix it with the package prefix manually. By example:

http://oooooooooooooo-developer-edition.na6.force.com/default?foconfig=carreer

doesn't work but

http://oooooooooooooo-developer-edition.na6.force.com/EosTrial98__default?foconfig=carreer 

 works. 

 

We also noticed that the prefixed pages look a bit weird:

 

<apex:page controller="EosTrial98.FrontOfficeConfigExt" showHeader="false"><apex:composition template="EosTrial98__CareerSiteTemplate"> 

Isn't it supposed to be a . and not __ ?

 

Our direct conclusion is that everything is linked in a way. Also it seems that we started to ave these problems since middle of last week. 

 

 

Any idea?

 

Laurent 

I am getting a Apex Code Generation error when trying to import our WSDL: Error: Element not defined for part 'return'

 

I have no real familiarity with WSDL or XML coding and the error message isnt very specific considering there a multuple returns in the WSDL. Any thoughts or anybody seen this error before?

 

Thanks.

Hi,

 

When I use the username and password with harcoded credentials, the connection works properly, but I cannot make the session_id work.

 

My account is a developer account.

 

 

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:salesforce="http://www.salesforce.com/" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#F3F3EC, #F3F3EC]" layout="horizontal" height="300" width="500" applicationComplete="login();"> <salesforce:Connection id="sfdc" /> <mx:Script> <![CDATA[ import com.salesforce.*; import com.salesforce.objects.*; import com.salesforce.results.*; import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.collections.XMLListCollection; import mx.events.ListEvent; private function login():void { sfdc.login( new LoginRequest({ server_url : this.parameters.server_url, session_id : this.parameters.session_id, callback : new AsyncResponder(loginSuccess, loginFault) }) ); } private function loginSuccess(result:Object):void { Alert.show("yo yo"); } private function sfdcFailure(fault:Object):void { Alert.show(fault.faultstring); } private function loginFault(fault:Object):void { Alert.show("Could not log into SFDC: "+fault.fault.faultString,"Login Error"); } ]]> </mx:Script> <mx:Tree id="tree" dataProvider="{categoriesXmlData}" labelField="@name" showRoot="false" width="100%" height="100%" left="0" top="0" /></mx:Application>

 


 

 

In the login function part, if I remove the session_id parameter and replace it with the hardcoded cerdentials it works:

 

 

lr.username = "myLogin"; lr.password = "myPassword";

 

The session id is not empty but it doesn't work.

 

 

Has anybody ever encountered this issue?

 

Cheers 

Message Edited by LaurentDelc on 06-08-2009 08:53 AM

Hi,

 

 I have two button on visual force page. One is apex command button and another is outputpanel with styleclass= btn.From apex command button I am calling execute method using action while in outputpanel I am calling execute method using actionFunction.In Execute, code create lead record and redirect to lead defualt list page.

 

It is working fine in case of apex command button but in case of outputpanel, code redirect the page on lead defualt page but it does not change url and also keeping page editor and component in page. Please guide.

 

Please help

 

 

<apex:page controller="VFJavaScriptDemo" >
<apex:form id="actionForm">
<apex:actionFunction id="executeId" name="executeData" action="{!execute}" reRender="dataForm"/>
</apex:form>
<apex:form id="dataForm" >
<apex:inputText id="value" value="{!name}"/>
<apex:commandButton id="Save" value="Submit" action="{!execute}"/>
<apex:outputPanel onclick="checkJavaScript()" styleClass="btn">
Click Me
</apex:outputPanel>
</apex:form>
<script>
function checkJavaScript() {
alert('inside');
executeData();
}

</script>
</apex:page>

 

public class VFJavaScriptDemo {
public String name { get; set;}

public PageReference execute() {
Lead l = new Lead(
lastname = 'VFJavaScript Testing',
company = 'sungard'
);

insert l;

PageReference pg = new PageReference('/00Q/o');
pg.setRedirect(true);

return pg;
}
}

 


 

Message Edited by Naishadh on 05-12-2009 05:43 AM

Hi all,

 

I think the answer is no, but I'll ask anyway.

 

Is it possible to attach a visualforce page rendered as pdf that uses a custom controller, in a visualforce email template?

 

I saw a post that describes using a component, but I already have the page and the controller built...it seems that it shouldn't take much to make that available as an attachment in an email template. It's kind of silly to have to duplicate things.

 

Are there any workarounds?

 

Thanks,

 

--Alex

I have an existing Visualforce page with a custom controller. When the code was originally written all of the data for display on the VF page was available via relationships and it was simple to gather in a single query. Business requirements have now changed and I need to get data from another object based on results from the original query. How do I combine two different query results into a single List?

 

My over-simplified, original code is below:

--- Visualforce Page --- <apex:page controller="cController"> <apex:pageBlockTable value="{!Data}" var="d"> <apex:column>{!d.Field_1__c}</apex:column> <apex:column>{!d.Field_2__c}</apex:column> </apex:pageBlockTable> </apex:page> --- Custom Controller --- public class cController { public Custom__c[] co = new List<Custom__c>(); public cController() { try { co = [SELECT Account__c, Field_1__c, Field_2__c FROM Custom__c]; } catch (Exception e) { //System.Debug('Exception: '+e); } } public Custom__c[] getData() { return co; } }

For lack of a better way to explain what I would like to do - here is some incorrect code:

 

public class cController { public sObject[] co = new List<sObject>(); public cController() { try { for (Custom__c temp : [SELECT Account__c, Field_1__c, Field_2__c FROM Custom__c]) { Contact cont = [SELECT Name FROM Contact WHERE AccountId = :temp.Account__c LIMIT 1]; co.add(temp, cont); } } catch (Exception e) { //System.Debug('Exception: '+e); } } public sObject[] getData() { return co; } }

 

Basically, I simply want the controller to pass back data from more than one object so I can display it together on the page. I thought I could use the generic sObject but that is proving difficult and I am not familiar with nested Lists (if that is even an option).

 

Any assistance would be greatly appreciated,

-greg

  • March 20, 2009
  • Like
  • 0
I know this is newbie stuff, but I don't know how else to learn but to ask stupid questions:

I have a ProductResult Class constructor which is a placeholder for results of a Product Query.

I have a ProdResController with the following code:

public class ProdResultController {

Product2[] prodQry;
ProductResult[] prodRes = new ProductResult[]{};
string SearchString;

public ProductResult[] getProductSearch()
{

prodQry = [SELECT id, Name, ProductCode, Description, Family, isActive, SVMXI__Product_Cost__c
FROM Product2
WHERE Name like :SearchString
OR Description like :SearchString
OR ProductCode = :SearchString];

if (prodQry.size() > 0)

for (Product2 prd :prodQry)
{
ProductResult newPR = new ProductResult(prd.id, prd.Name, prd.ProductCode, prd.Description, prd.Family,
prd.isActive, prd.SVMXI__Product_Cost__c);
prodRes.add(newPR);
}

return prodRes;
}
}


What I want to do is create a form page with an input field for a SearchString and a button that calls the getProductSearch function to query the Products based on the input string, and create a ProductResult record based on the results, and return it to the page somewhere that hasn't been created yet.

The page code, without the tags (as it doesn't seem to display in the preview) is:

apex:page controller="ProdResultController">
apex:form >
apex:pageBlock title="Product Search">
p/>
Search for: apex:inputField value="{!SearchString}"/>p/>
apex:commandButton action="{!ProductSearch}" value="Search for Products"/>

/apex:pageBlock>
/apex:form>

/apex:page>


The Save Error I'm receiving is "Could not resolve the entity from apex:inputField> value binding {!SearchString}. inputField can only be used with sObject fields"

I'm sure this message is clear as day to most of you, but I'm not sure where to begin. Do I have to define SearchString in the ProductResult constructor class, even though its not really part of the result, but just a string used to get a query?
Do I need to define Searchstring inside the getProductSearch function, or should it not be referenced by the controller definition in the page?
Does the Product Search function require a "get" in this case, or am I not "getting" the 'get' part of a controller function?

How many other completely braindead mistakes am I making here?

Any help would be appreciated.

VM
Hi how do you get the left side border when you do a pageblock Tag? The right side comes out and the bottom breaks? Anyone plz help.. Thanks
<apex:pageBlock >

Hi all,

 

I am working on a solution where I would like to be able to take a custom object populate it then serialize it to XML to store somewhere - in a field in another object to be exact.

 

This I usually do in .NET using XML serialization and it works great. I then can at any time deserialize it obviously for later use. Almost like a freeze and defreeze mechanism.

 

What I really want to do is create another object that will have a text area field where the xml of the serialized object will go and I can retrieve this at any time out of this object to "defreeze" the child object and deserialize it back into memory.

 

In .NET this is really easy to do. But in APEX is this possible at all? The ideal will be I will create a trigger on object x and then that trigger will then run an apex class that runs some code that does the serialization. And as u can set "before" and "after" events in triggers then I will be able to maintain the two states on an object right???

 

Well that's how I vision it as an experienced .NET programmer new to Apex programming.

 

Any pointers guys? Or if it is even possible?

 

Regards,

 

Shion.

Message Edited by Shion on 03-05-2009 01:30 PM
Message Edited by Shion on 03-05-2009 01:30 PM
  • March 05, 2009
  • Like
  • 0

Hi,

 

I want a situation where a user from my .net UI can create a folder under documents and add documents to it.  Now, I can figure out how to create documents in a pre existing folder.  But, I can not figure out how to create a folder under documents.

If anyone has any ideas, please share.

 

Swati 

Hello, Sirs.

 

I have such Email template:

 

Dear {!Contact.FirstName},
Secret code is - {!??????????}

 

I must insert into email message my specific text message ( instead ???????? ).

 

 

 

Apex Code:

//AcID - Contact ID


//Eml - Email Template ID

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setReplyTo('support@force.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setTargetObjectId(AcId);
mail.setTemplateId(EmlId);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Which way I can do it ?


Thank you.

 

Message Edited by Olbrest on 03-04-2009 06:59 PM

Hi,

 

   I am developing a web application through visualforce. I have added a static resource javascript file which 

requires an image file to be called. I have put the images into /img folder and the javascript file(yyyyy.js) into /js folder and zipped folders into (XXXXXXX.zip) and added as a static resource with the name XXXXXXXZip

and added the code in my page as

 

 <script type="text/javascript" src="{!URLFOR($Resource.XXXXXXXZip, 'yyyyy.js')}"/>

 

But still i am not able to display the images.

 

Regards,

Ravindra

Good Morning Everyone,
 
I am trying to access information on a contact from a task which is referencing it. When I use the following syntax I receive an error that phone is not a valid field. I assume this is because the field is a lookup for either a contact or a lead. So how do I get the phone number out?
 
Thanks in advance for your help.
 
Dave
 
Code:
<apex:page standardController="Task" >
    <iframe id="dialer" style="display:none"></iframe>
    <apex:form >
        <apex:pageBlock title="Task Detail">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" value="Edit" id="editButton"/>
                <apex:commandButton action="{!delete}" value="Delete" id="deleteButton"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Details" showHeader="false">
                <apex:pageBlockSectionItem >
                    Assigned To
                    <apex:outputField value="{!task.owner.name}" />
                </apex:pageBlockSectionItem >
                <apex:outputField value="{!task.priority}" />
                <apex:outputField value="{!task.subject}" />
                <apex:outputField value="{!task.activitydate}" />
                <apex:pageBlockSectionItem >
                    Task Record Type
                    <apex:outputField value="{!task.recordtype.name}" />
                </apex:pageBlockSectionItem >
                <apex:outputField value="{!task.status}" />
                <apex:pageBlockSectionItem >
                    Related To
                    <apex:outputField value="{!task.what.name}" />
                </apex:pageBlockSectionItem >
                <apex:outputField value="{!task.result_date__c}" />
                <apex:outputField value="{!task.who.name}" />
                <apex:outputField value="{!task.closed_by__c}" />
                <apex:outputField value="{!task.who.phone}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>

 



Message Edited by mtbclimber on 12-06-2008 11:40 AM