Showing posts with label custom button. Show all posts
Showing posts with label custom button. Show all posts

Tuesday, 31 May 2016

Auto populate Parent Owner in child object User lookup field

Example

please have the BDD - owner Field, on the contract, auto populate with the Opportunity Owner when the contract is created?

Solution:-

There is custom button called New Contract, We need to do it with URL hacking

CF00NG000000F7Cge={!JSINHTMLENCODE(Opportunity.OwnerId)} 
&CF00NG000000F7Cge_lkid={!Opportunity.OwnerId}


Here CF00NG000000F7Cge is BDD - owner Field id, you have to take it from Inspect Element, you will get it when you right click on the field. 

JSINHTMLENCODE is mandatory to get the Look-up fields

Friday, 11 September 2015

custom button in service cloud console


Here i am going to explain how to work with custom button in service cloud console mode and the regular salesforce.com application.

Basically we have a requirement i.e we need to create a list button for populating some of the fields from parent record.This should works in regular salesforce.com application  and service cloud console mode.

If we use " window.open " method for both it won't work for service cloud console mode in a proper way.So we need to use different things to work with both .The following things are useful whenever you want to construct an url from custom button for both service cloud console mode and regular salesforce.com app.

if (typeof(srcUp) == 'function') {
srcUp('/a1z/e?retURL=%2F{!Acccount.Id}&CF00Ne0000000u_lkid={!Contact.Id}');
} else {
window.open('/a1z/e?retURL=%2F{!Acccount.Id}&CF00Ne0000000u_lkid={!Contact.Id}','_parent');
}

(OR)

if (typeof(srcUp) == 'function') {
srcUp('/{!Case.AccountId}');
} else {
window.open('/{!Case.AccountId}','_parent');
}

Here,we check to see if the srcUp method is defined with "if(typeof(srcUp)=='function')".If we are in the Service Cloud Console ,this condition will evaluate to true.If it is false and we are in the regular app, we use the javascript "window.open" method to open our target url in a new window.