You need to sign in to do that
Don't have an account?

parameters in URLFOR...
Hello. I am writing an scontrol which overrides the New button on
a Custom Object. I want the button to take me to an edit
screen, but I want to pass a few parameters. I'm able to pass
constant string parameters into fields, but I can't make dynamic fields
work. My basic scontrol is pasted below. The "static text
here" is displayed in the input field in the edit screen. However
I can't make the Project__c.Name value appear. I've tried all
sorts of things - enclosing it in quotes (then the quoted text
appears), using the merge notation (error when saving), etc.
Note that I'm trying to create a new Timecard__c record from inside the Project__c record's related list. (If using the New button from anywhere else, these fields will be blank which is fine...) So my question is - what is the proper notation that I use to pass the value of Project__c.Name?
<script type="text/javascript">
window.parent.location.href="{! URLFOR($Action.Timecard__c.New, null, [CF00N50000001S4Rz="static text here", CF00N50000001Ru1r=Project__c.Name], true)}";
</script>
Thanks for your time.
Chris
Note that I'm trying to create a new Timecard__c record from inside the Project__c record's related list. (If using the New button from anywhere else, these fields will be blank which is fine...) So my question is - what is the proper notation that I use to pass the value of Project__c.Name?
<script type="text/javascript">
window.parent.location.href="{! URLFOR($Action.Timecard__c.New, null, [CF00N50000001S4Rz="static text here", CF00N50000001Ru1r=Project__c.Name], true)}";
</script>
Thanks for your time.
Chris
Find the ID of the parameters - in my example two lookup fields.
Make a VF page like this:
and a controller extension like this:
Finally, overwrite the New button for the opbject (in my example OwnEquipment__c).
I did some fine-tuning to the example above:
Is there a way to do this where you don't hardcode the field id's ? Like $field.id versus CF00N40000001TxNz ? Its hard to hardcode these ids and then deploy the code to other orgs.