• dhcrusoe
  • NEWBIE
  • 5 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies

Hey there,

 

I'm trying to display a print button IF there is certain information in the URL string, e.g., an ?id= field. Here's my statement:

 

 

rendered="{!IF({!id} != 'null', true, false)}

 

 Clearly, it didn't like this... any suggestions to fix? Thanks!

 

--Dave

 

p.s. here's the entire element:

 

 

<apex:outputLink rendered="{!IF(id != 'null', true, false)}" target="_blank" value="/apex/CTN_Lessons_37p?apprenticeshipId={!apprenticeshipID}&ctContactId={!ctContactId}&id={!id}">Print My Lesson</apex:outputLink>

 

 

 

 

Hi there,

 

We're trying to get (what seems to be) a simple query to display on a page through {!lastUpdated}. However, for some reason, we neither receive an error, nor receive information displayed through the query. Any ideas?  Thanks!

 

--Dave

 

Code:

 

public class appDetailExtension { Private string ctContactId; Private string apprenticeshipID; public appDetailExtension(ApexPages.StandardController controller) { } public appDetailExtension(ApexPages.StandardSetController controller) { setMyValues(); } private String lessonPlanID; public String getlessonPlanID (){ return lessonPlanID; } public void setlessonPlanID(String v){ lessonPlanID =v; } private String lastModified; public String getlastModified (){ return lastModified; } public void setlastModified (String v){ lastModified =v; } private String lastCtModified; public String getlastCtModified (){ return lastCtModified; } public void setlastCtModified(String v){ lastCtModified =v; } Public void setMyValues(){ PageReference pageRef = System.currentPageReference(); apprenticeshipID = pageRef.getParameters().get('id'); Lesson_Plan__c myVar = [select Lesson_Plan__c.id, Lesson_Plan__c.lastmodifieddate, Lesson_Plan__c.Last_CT_Modified__r.Name from Lesson_Plan__c where Lesson_Plan__c.Apprenticeship__r.id = 'a0GR0000001AjI3MAK' and Lesson_Plan__c.Lesson_Number__c = '1']; lessonPlanId = myVar.id; lastModified = String.valueOf(myVar.lastmodifieddate); lastCtModified = myVar.Name; } }

 

 

 

Hi all,

 

Thanks for your help - many times in the past! I'm trying to redirect a user once a form has been saved... following the code example in the Developer's guide (p.393), but I'm getting an error:

 

Class.appLessonExtension.save: line 27, column 22 External entry point 

 

with this controller extension, which seems to be correct to me? 

 

 

public class appLessonExtension { private final Lesson_Plan__c lessonplan; private final ApexPages.standardController theController; ... public PageReference save() { PageReference pageRef = new PageReference('CTN_Apprenticeship'); pageRef.setRedirect(true); try { return theController.save(); } catch (DmlException e) { ApexPages.addMessages(e); } return pageRef ; } }

 

 

 

Hey all,

 

I'm still relatively green to Visualforce & Apex, coming from the design end (rather than the code end). I'm trying to query an object (query works) and then call two variables into my custom page: lesson_plan__c.id and lesson_plan__c.lastmodifieddate. Here's the code I've been using; maybe I'm missing the obvious, but for some reason, I can't retrieve the data... 

 

 

public class appDetailExtension { public appDetailExtension(ApexPages.StandardController controller) { } Private string ctContactId; Private string apprenticeshipID; Private string lessonPlanID; Private string lastModified; public appDetailExtension(ApexPages.StandardSetController controller) { } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Citizen_Teacher__r.Name, Citizen_Teacher__r.Email from CT_Connector__c where Apprenticeships__r.id = :apprenticeshipID])); } return setCon; } set; } public list<CT_Connector__c> getNames() { PageReference pageRef = System.currentPageReference(); apprenticeshipID = pageRef.getParameters().get('id'); return (List<CT_Connector__c>) setCon.getRecords(); } public string getContactid() { PageReference pageRef = System.currentPageReference(); ctContactId = pageRef.getParameters().get('ctContactId'); return ctContactId; } public String getlessonPlanID (){ return lessonPlanID; } public void setlessonPlanID(String v){ lessonPlanID = v; } public String getlastModified (){ return lastModified; } public void setlastModified (String v){ lastModified = v; } Public void setMyValues(){ PageReference pageRef = System.currentPageReference(); apprenticeshipID = pageRef.getParameters().get('id'); try { Lesson_Plan__c myVar = [select Lesson_Plan__c.id, Lesson_Plan__c.lastmodifieddate from Lesson_Plan__c where Lesson_Plan__c.Apprenticeship__r.id = :apprenticeshipID and Lesson_Plan__c.Lesson_Number__c = '1']; lessonPlanID = myVar.id; lastModified = String.valueOf(myVar.lastmodifieddate); } catch(Exception e){ } } }

 

 

 

Hi all,

 

I think this is simple, but can't quite figure it out. Here's the use case:

 

A teacher has links to lesson plans (an object), 1-10, each residing in a different area of the page. Each lesson plan link sends the following to a new page:

 

Curriculum ID (Lesson_Plans lookup relation), Contact (owner) and number (1-10, since each renders a different template). 

 

I'm trying to build a controller extension so that Lessons either loads the right detail view (pre-populated with the right information, if it exists) OR creates a new record with the information in the URL string, e.g., curriculum ID, contact owner and lesson number. 

 

Any ideas / suggestions on how to make this happen? 

 

Thanks!
--Dave

Hi all,

 

I'm building a VF application (will be launched through Sites when it's public) to help teachers plan their lessons. The object is called "lessons". There are three, potentially four, different sets of questions they will have to answer, depending on the stage that their class is at. There are between 8 and 12 questions per stage.

 

But the questions all come from the same pool (of about 20) in the object "Lessons", and many are shared between all stages, e.g., "what materials do you need?". 

 

Is it possible that I can use the controller to render a specific lesson stage (and thereby, a specific set of questions) for each lessons object record? 

 

I'm thinking I would use PageBlocks to do this - and perhaps have three (or four) different pageblocks embedded into a single page? Or would I contain each question in an IF statement, and query against that? Would would you recommend?

 

(Note that I'm developing custom branded pages, not using the internal Page Layouts - but perhaps there's a way to utlize the page layouts to bring up fields on a custom page?). 

 

Thanks so much!

--Dave

 

 

Hi all,

 

We're using Sites pages (in anticipation of its Summer release) to provide our volunteers with a place to plan their lessons.

 

Most of their information is field-based, and very easy to manage. However, we do need to use the notes/attachments feature (specifically, attachments) to provide volunteers with the ability to upload files for their lessons. 

 

Currently, when a user clicks on the "Attach a file", the default Salesforce page (with headers, etc) appears. Has anyone customized this into a simpler view, e.g., a small popup window with file attachment selector & submitter? 

 

This is the code I'm currently using for notes/attachments functionality: 

 

 

<apex:relatedList id="noteslist" list="NotesAndAttachments" subject="{!Apprenticeship__c.id}" />

 

 

 

We definitely don't want to give public users access to any of our internal site... so, any suggestions, code samples or links to ideas would really help -- thanks!

 

--Dave

 

Hey all,

 

Can someone please point me to a code example of how to:

 

1. Display a pageBlockTable that has clickable links that direct to another apex page & controller

2. Preferably, pass through a string, such that:

 

A user views a table of information, and clicks on the appropriate link. Clicking on the link brings the user to a new page with a detail view of the information in the link, e.g., a user sees his past classes; clicking on a link brings up a list of lessons in the past class. 

 

Thanks for the code samples, all!

--Dave

Hi there,

 

I'd like some quick input as to whether the following site structure/access is possible through Force.com Sites. Even preliminary suggestions would help. 

 

Background:

 

We (Citizen Schools) operate an online community, http://ctnation.citizenschools.net. The online community helps volunteers work with our afterschool program, which engages volunteers as teachers ("Citizen Teachers") of apprenticeships. The current site is maintained through DotNetNuke 4.9.2. 

 

We envision integrating DotNetNuke with Salesforce, to help Citizen Teachers manager their lesson planning. The integration is proposed to be as follows: 

 

A Citizen Teacher who is logged into the DNN site clicks on a link (develop lesson), which sends them to the Force.com Sites page. The link contains username and login information (as a ?uname= string) to authenticate them against the Force.com Site. 

 

Once authenticated, the Force.com Site page dynamically generates a list of the lessons they have created, based upon information stored in our SalesForce "Lessons" Object, and lets them add/edit/print/delete their lessons as necessary. 

 

Questions:

 

Q1. How might we authenticate "public" users, such that they can only see their own lessons? Could we pass a cookie? A URL string? An authentication method? We're assuming that the lookup might be against data in the Lessons object, which might contain a field called "Users" that indicates all of the individuals who can view a particular lesson stored in the object. 

 

Q2. Added: Would "Customer Portal" functionality be necessary in this scheme?  Or in what seems to be similar to IdeaStorm, can we have a class of public, but authenticated, user who can interact with certain parts of the system, but on a non-fee method?

 

Q3. Any other thoughts/comments about this proposed implementation of Sites? 

 

Thanks for your help! 

--Dave

Message Edited by dhcrusoe on 04-08-2009 12:56 PM
Message Edited by dhcrusoe on 04-08-2009 12:57 PM

Hey there,

 

I'm trying to display a print button IF there is certain information in the URL string, e.g., an ?id= field. Here's my statement:

 

 

rendered="{!IF({!id} != 'null', true, false)}

 

 Clearly, it didn't like this... any suggestions to fix? Thanks!

 

--Dave

 

p.s. here's the entire element:

 

 

<apex:outputLink rendered="{!IF(id != 'null', true, false)}" target="_blank" value="/apex/CTN_Lessons_37p?apprenticeshipId={!apprenticeshipID}&ctContactId={!ctContactId}&id={!id}">Print My Lesson</apex:outputLink>

 

 

 

 

Hello,

 

I have a visualforce page which is giving me the error "You cannot call save() on a null object" on both new & and existing records when attempting to save.

 

I cannot see why it is giving this problem, as I'm using the standardController for saving.

 

Visualforce page:

 

 

<apex:page standardController="SalesOrder__c" extensions="MySalesOrderController"> <apex:form id="theForm"> <apex:pageBlock title="Sales Order"> <apex:pageBlockSection title="Information" columns="1"> <apex:inputField value="{!salesorder.Name}"/> <apex:inputField value="{!salesorder.Account__c}"/> <apex:inputField value="{!salesorder.Amount__c}"/> <apex:inputField value="{!salesorder.Assets_Total__c}"/> <apex:inputField value="{!salesorder.Invoice_Type__c}"/> <apex:inputField value="{!salesorder.Description__c}"/> <apex:inputField value="{!salesorder.Currency__c}"/> <apex:inputField value="{!salesorder.CAD_Amount__c}"/> <apex:inputField value="{!salesorder.ConversionRate__c}"/> <apex:inputField value="{!salesorder.Invoice_Date__c}"/> <apex:inputField value="{!salesorder.Account_Exec__c}"/> <apex:inputField value="{!salesorder.Revenue_Recognition_Date__c}"/> <apex:inputField value="{!salesorder.Opportunity__c}" /> </apex:pageBlockSection> <apex:commandButton action="{!save}" value="Save" /> <apex:commandButton action="{!cancel}" value="Cancel" /> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

Extension:

 

 

public class MySalesOrderController { public SalesOrder__c salesorder { get; set; } public Account account; public User user; public MySalesOrderController(ApexPages.StandardController controller) { if ( ApexPages.currentPage().getParameters().get('id') != null) { salesorder = [select Id, Account_Exec__c, Account__c, Amount__c, CAD_Amount__c, ConversionRate__c, Currency__c, Description__c, Invoice_Date__c, Invoice_Type__c, Revenue_Recognition_Date__c, Name, Assets_Total__c, Opportunity__c from SalesOrder__c where id = :ApexPages.currentPage().getParameters().get('id')]; } else { salesorder = new SalesOrder__c(); salesorder.Account__c = ApexPages.currentPage().getParameters().get('AccountId'); } user = getUser(); if(user != null) { salesorder.Account_Exec__c = user.Id; } } public String getName() { return 'MySalesOrderController'; } public Account getAccount() { if(salesorder.Account__c != null) { account = [select id, name, ownerid from Account where id = :salesorder.Account__c]; } else { System.debug('no Account Id '); account = new Account(); } return account; } public User getUser() { if (ApexPages.currentPage().getParameters().get('id') != null) { if(salesorder.Account_Exec__c != null) { user = [ select id, name from user where id = :salesorder.Account_Exec__c]; } } if(user == null) { account = getAccount(); if(account.OwnerId != null) { user = [ select id, name from user where id = :account.OwnerId]; } } return user; } }

 

 

 

 

Hi all,

 

Thanks for your help - many times in the past! I'm trying to redirect a user once a form has been saved... following the code example in the Developer's guide (p.393), but I'm getting an error:

 

Class.appLessonExtension.save: line 27, column 22 External entry point 

 

with this controller extension, which seems to be correct to me? 

 

 

public class appLessonExtension { private final Lesson_Plan__c lessonplan; private final ApexPages.standardController theController; ... public PageReference save() { PageReference pageRef = new PageReference('CTN_Apprenticeship'); pageRef.setRedirect(true); try { return theController.save(); } catch (DmlException e) { ApexPages.addMessages(e); } return pageRef ; } }

 

 

 

Hi all,

 

I'm building a VF application (will be launched through Sites when it's public) to help teachers plan their lessons. The object is called "lessons". There are three, potentially four, different sets of questions they will have to answer, depending on the stage that their class is at. There are between 8 and 12 questions per stage.

 

But the questions all come from the same pool (of about 20) in the object "Lessons", and many are shared between all stages, e.g., "what materials do you need?". 

 

Is it possible that I can use the controller to render a specific lesson stage (and thereby, a specific set of questions) for each lessons object record? 

 

I'm thinking I would use PageBlocks to do this - and perhaps have three (or four) different pageblocks embedded into a single page? Or would I contain each question in an IF statement, and query against that? Would would you recommend?

 

(Note that I'm developing custom branded pages, not using the internal Page Layouts - but perhaps there's a way to utlize the page layouts to bring up fields on a custom page?). 

 

Thanks so much!

--Dave

 

 

Might there be an IRC channel where Visualforce and/or APEX developers gather to chat?

 

If not, are there others interested in starting one?

 

Hey all,

 

Can someone please point me to a code example of how to:

 

1. Display a pageBlockTable that has clickable links that direct to another apex page & controller

2. Preferably, pass through a string, such that:

 

A user views a table of information, and clicks on the appropriate link. Clicking on the link brings the user to a new page with a detail view of the information in the link, e.g., a user sees his past classes; clicking on a link brings up a list of lessons in the past class. 

 

Thanks for the code samples, all!

--Dave