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
jcaldjcald 

change record type in javascript for Social Media /Twitter

I've installed Salesforce for Social Media and when I create a case from one of the twitter post. The case defaults to my default record type. I'd like to be able to change to another record type. I've managed to create a custom buttom but dont understand javascript to well. Can someone help me?

 

 

 

Detailed Page button:

window.location = "/apex/sf4twitter__TwitterToCase?records={!sf4twitter__Twitter_Conversation__c.Id}&retURL=" + encodeURIComponent(window.location);

 

I was trying this, which didn't work:

 

window.location = "/apex/sf4twitter__TwitterToCase?records='012U000000016QN'&retURL=" + encodeURIComponent(window.location);

 

red = my recordtype ID

 

 

I found out there are two buttons.

 

List Button:

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}

var records = {!GETRECORDIDS( $ObjectType.sf4twitter__Twitter_Conversation__c)};
var loadedFromHoverMenu = false;
var url = null;

function dataNav(showDataBrowser) {
dataBrowser = '';
for(var i in navigator) {
dataBrowser += "navigator." + i + "\t\t=\t" + eval("navigator." + i)+ "\n";
}
return (showDataBrowser) ? dataBrowser : {'name' : navigator.appName, 'version' : navigator.appVersion, 'userAgent' : navigator.userAgent};

}

try{
if(document.getElementsByName('fcf')[0] == null){
elementName = 'is:islv:inlineSchedulerListView:enhancedList:fcf';
}else{
elementName ='fcf';
}
var listViewFilters = document.getElementsByName(elementName)[0];
var filterId = listViewFilters.options[listViewFilters.selectedIndex].value;
url = new String(window.location);

if (url.indexOf('emptyHtmlDoc.html') >= 0 ) {
url = parent.location;
loadedFromHoverMenu = true;
}

if (url.search(/fcf=[^&]+/) >= 0) {
url = url.replace(/fcf=[^&]+/, 'fcf=' + filterId);
} else {
if (url.indexOf('?') == -1) {
url += '?'
}
url += '&fcf=' + filterId;
}
}
catch(err) {
url = new String(window.location);
if (url.indexOf('emptyHtmlDoc.html') >= 0 ) {
url = parent.location;
loadedFromHoverMenu = true;
}
}

if(dataNav()['name'] == 'Microsoft Internet Explorer'){
if(records.length > 50){
alert('{!JSENCODE($Label.sf4twitter__BROWSER_NOT_SUPPORT_50)}');
}
else {
if (records[0] == null) {
alert("{!JSENCODE($Label.sf4twitter__PLEASE_SELECT_1)}") ;
}
else {
if (loadedFromHoverMenu) {
parent.location = "/apex/sf4twitter__TwitterContact?records=" + records + "&retURL=" + encodeURIComponent(url);
} else {
window.location = "/apex/sf4twitter__TwitterContact?records=" + records + "&retURL=" + encodeURIComponent(url);
}
}
}
}
else {
if (records[0] == null) {
alert("{!JSENCODE($Label.sf4twitter__PLEASE_SELECT_1)}") ;
}
else {
if (loadedFromHoverMenu) {
parent.location = "/apex/sf4twitter__TwitterContact?records=" + records + "&retURL=" + encodeURIComponent(url);
} else {
window.location = "/apex/sf4twitter__TwitterContact?records=" + records + "&retURL=" + encodeURIComponent(url);
}
}
}