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
SivarajanSivarajan 

How to clear the Prepopulation of Account lookup value.

 

Hi,

 

In the Contact page, I have replaced the New button on Opportunity related list with Cusotm button (Source is URL).

When I create an Opportunity from Contact, The Acount field of Contact is prepopulated . I have one more Account lookup field in Opportunity. I just want to clear the standard Account lookup field of opportunity and want to prepopulate the custom account lookup field.

 

I fetched HTML id and populated the Account Name in custom lookup field in Opportunity but how to clear the standard Account lookup field in Opportunity (I don't want to mention any values in standard account lookup field?

 

Please help me to get a solution .

 

Thanks in advance...

 

 

Best Answer chosen by Admin (Salesforce Developers) 
ritika@developerforceritika@developerforce

Hi,

 

It seems that the Account value is being picked up by the Contact that you are passing in retURL. Try with this, 

/006/e?CF00N30000004oFdw={!Account.Name}

 

Hopefully thic will work.

 

Regards,

Ritika

All Answers

ritika@developerforceritika@developerforce

Hi,

Please post the URL you are using as a destination for the New button.

It seems that you are passing the Id of the account in 'accId' parameter. The standard controller will pre-populate the Opportunity with this Id.
If you need to pass this Id, use some other parameter name and set it in your custom account field.

Alternatively you can also set the standard account field to null in the opportunity record in the constructor of your controller class.

Hope this helps.

Regards,
Ritika

SivarajanSivarajan

 

 

Thanks Ritika for your immediate reply.

 

I am using URL for custom button

This is URL i have used :

 

/006/e?opp4 =&opp4_lkid =&CF00N30000004oFdw={!Account.Name}&retURL=%2F{!Contact.Id}&conid={!Contact.Id}

 

Here CF00N30000004oFdw is Custom lookup field.

opp4 is Standard Account lookup field ( Got this Html id using Firebug)

 

I tried with accId also. it was not working .

Here I tried to clear the Standard Account lookup value but still it's showing value. Can you please correct that what is the wrong here ?

ritika@developerforceritika@developerforce

Hi,

 

It seems that the Account value is being picked up by the Contact that you are passing in retURL. Try with this, 

/006/e?CF00N30000004oFdw={!Account.Name}

 

Hopefully thic will work.

 

Regards,

Ritika

This was selected as the best answer
SivarajanSivarajan

Thanks Ritika. it's working fine.