I am trying to pass data to a callback function but it doesn't work...
I am using Salesforce "searchAndGetScreenPopUrl" method which is calling callback function. I want to be able to pass some data to that callback function.
Here is the code:
var test = "some data";
sforce.interaction.searchAndGetScreenPopUrl('07411111111', '', '', callback);
And here is my callback function:
var callback = function (response) {
if (response.result) {
recordFound = JSON.parse(response.result);
appendPhone = phonecallBox(recordFound); // get phone call box
$('#box').append(appendPhone).hide().fadeIn('slow');
} else {
alert(response.error);
}
};
Unfortunately passing the data like this doesn't work:
var test = "some data";
sforce.interaction.searchAndGetScreenPopUrl('07411111111', '', '', callback(test));
It comes back with "undefined".