2

The following HTML works fine. It sends the user to a specific URL. What I want is to default a custom field to the current user like this &CF00Nw0000008ZPxv={!User.Name}&CF00Nw0000008ZPxv_lkid= {!User.Id}

So I need to append it to the URL but somehow have SF get the User Name and ID and populate the URL with it so it pre-populates the field and not to just add it as text. Can this be done and if so, how?

<apex:page standardcontroller="Grant_Proposal__c" showHeader="false" >
<html>
    <head>
        <meta http-equiv="refresh" content="0;URL=https://eu3.salesforce.com/a07/e?RecordType=012w0000000iaZ9&nooverride=1"/>
    </head>
    <body>

    </body>
</html>
</apex:page>
0

you can use the Visualforce Merge field $User to substitute current user fields inside both html & visualforce markup.

also you don't have to hardcode your instance url - just use the relative url like below so that it works across environments

<apex:page standardcontroller="Grant_Proposal__c" showHeader="false" >
<html>
    <head>
        <meta http-equiv="refresh" content="0;URL=/a07/e?RecordType=012w0000000iaZ9&CF00Nw0000008ZPxv={!$User.FirstName}&CF00Nw0000008ZPxv_lkid={!$User.Id}&nooverride=1"/>
    </head>
    <body>

    </body>
</html>
</apex:page>

and if you can use a custom controller, you can generate the entire url is apex so that you don't need to hardcode record type id & the field ids.

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.