Tuesday, 6 May 2014

Working with custom button in service cloud console and the regular salesforce.com application

Hi,

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');
}

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.

For more information please look into below url:
Click here for more information



No comments:

Post a Comment