+ Start a Discussion
Mitch_AMSMitch_AMS 

Hidden Field on VF Page How To Force Static Value

EE

I'm creating a VisualForce page, that employees
will use to create new records in a custom object.

The records in this
custom object requires a Record Type. And the Page(s) I'm creating will have the
Record Type HARD CODED in a hidden fields. So when the user creates a record
(based on the page they use) the record type will automatically be
assigned.

I'm attempting to use

<apex:inputHidden
rendered="false" required="true"
value="{!CustomObject__c.RecordTypeId}"/>

But I don't seem to have any
means of forcing the appropriate RecordType ID to this hidden field.  How do I
pass the Fixed RecordTypeId values in the form

As it stands now, it only
defaults to the default record type for the user, and this cannot be, I need to
pass the correct RecordTypeId into the form...

Any help is greatly
appreciated... thanks!
bob_buzzardbob_buzzard

You'll need a mechanism to extract the record type you desire and make that available to the page. There's a couple of ways you can do this:

 

(1) If you have a custom/extension controller you can look up the record type from the database and make its id available as a property

(2) You can put the id into a custom setting and this will be available to the visualforce page without recourse to a custom/extension controller.

Mitch_AMSMitch_AMS

I'm stil learning how to build vp pages, so my experience is limited, but I'm willing/eager to learn...

 

Would you be able to guide me to some examples of the two choices you've provided, so I can perhaps get a better understanding of how to build these... Thanks!

Mitch_AMSMitch_AMS
I'm leaning toward option 2... Are there any known examples out there that might help me get on the right track???