function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajat Mahajan 28Rajat Mahajan 28 

URL param not pre populating in a custom look up - please help !

Hello

I am facing a major challenge in prepopulating values in a custom lookup field from a URL (I am redirected to a new record standard page)
URL :
https://cs10.salesforce.com/001/e?acc2=Greg+Hewitt&CF00NJ0000001x7yoMAA=00QJ000000AQSUtMAP&nooverride=1&retURL=%2F001%2Fo

In the above URL : i am able to prepopulate the standard name field of account from the url param:
acc2=Greg+Hewitt

However, there is a custom field on account called convertedfromlead__c (which is a lookup to lead)
The above needs to be populated from:
CF00NJ0000001x7yoMAA=00QJ000000AQSUtMAP

Where : 
00NJ0000001x7yoMAA = Id field of Custom Field 
00QJ000000AQSUtMAP = Id field of lead record

The custom lookup field somehow does not get populated.
I had prepended the id with CF as indicated in some articles, however, did not work with or without that

Thanks in advance
Rajat
Rajendra RathoreRajendra Rathore
Hi Rajat,

You have to use :

Id field of Custom Field  : CF00NJ0000001x7yoMAA__lkid
Id field of lead record : 00QJ000000AQSUtMAP
As well as you have to pass lead name also in url parameters:
Like : CF00NJ0000001x7yoMAA=LeadName

So final url will be :

https://cs10.salesforce.com/001/e?acc2=Greg+Hewitt&CF00NJ0000001x7yoMAA__lkid=00QJ000000AQSUtMAP&CF00NJ0000001x7yoMAA=Leadname&nooverride=1&retURL=%2F001%2Fo

Thanks
Rajendra
Rajat Mahajan 28Rajat Mahajan 28
Hi Rajendra

Even after populating the URL via apex the following way :
https://cs10.salesforce.com/001/e?acc2=niharika+SHARMA&CF00NJ0000001x7yoMAA=niharika+SHARMA&CF00NJ0000001x7yoMAA_lkid=00QJ000000AQSUtMAP&nooverride=1&retURL=%2F001%2Fo

It did not help

Could you please check if i missed something ?

Here is a snippet of forming the URL:

​//This method is used to insert contact
    public PageReference createAccount() {
        PageReference p = new PageReference('/001/e?nooverride=1&retURL=%2F001%2Fo');
        p.getParameters().put('CF' + Id.valueof('00NJ0000001x7yo') + '_lkid',Id.valueof(leadRecord.id));
        p.getParameters().put('CF' + Id.valueof('00NJ0000001x7yo'),leadRecord.name);
        p.getParameters().put('acc2',leadRecord.name);
        return p;
    }
Rajat Mahajan 28Rajat Mahajan 28
I can also do with a solution if i could extract the lead id somehow directly at trigger level while saving the record / although that also comes null when i getparameter().get('leadid')

Regards
Rajat Mahajan