Just wondering if it was possible to tweak a document generation app to populate a template/document based on specific input fields whilst incorporating some rules?

To be specific, I have created a new object/app called 'Product Solution'. This object has 5 fields that can be populated using a multi-option defined picklist. Once the fields are populated and the record saved, I want to generate a document that includes specific product information based on the field contents. My difficulty comes from the fact that some pick-list answers will invalidate certain information from appearing in the final template. For example, the first field is a customer volume estimate with 3 possible options (only one can be chosen) 0-250 annually, 250-1000 and 1000+. When populating the final template I would want to invalidate all contract only products from appearing if 1000+ is not chosen, as this is the contract product access requirement in my organisation.

Any help much appreciated!


I`m making some assumptions when I post what I think would be the answer. After you save the record in the Product Solution object and then you go to the next step of creating the document. If you are using a VisualForce page / Apex Controller you can do something like this:

In your apex field under the VisualForce page you should have an attribute called rendered. This accepts true or false values <apex:inputField rendered="{!isrendered}"/> where the isrendered could be a method in the controller where it returns true of false. You could then have a SOQL query which selects the value of customer volume and do a little bit of logic in the code. I will write some pseudo-code in the method

public Boolean getIsRendered() {

    Select CustomValue FROM ProductSolutions;
    return CustomValue < 1000;


Hope it helps

|improve this answer|||||
  • Thanks Mihai, I'm still playing around with it as I write this. Hoping to design the object in such a way as to avoid most of these issues, but will comment again if the apex/SOQL method gets the right result. – Cameron Oct 30 '14 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.