• Ekin Van Winkle 2
  • NEWBIE
  • 34 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hello,

When i try to donwload metadata from production org, it gives me message saying

downloading objects and profiles will overwrite field level security on the fields on those objects when deploying

Is it safe to doownload or not
  • September 30, 2015
  • Like
  • 0

As per release winter 16 release notes: http://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/salesforce_release_notes.htm
 

REQUIRESCRIPT no longer executes JavaScript on Page Load.

We use the REQUIRESCRIPT function in several custom buttons on our lead page.  When the Winter 16 features were released into our sandbox, our buttons started returning an error Reference $ Undefined.

I reached out to salesforce support, and they told me to use the code in the following article which removed the REQUIRESCRIPT function and instead, creates a custom java function.

https://help.salesforce.com/apex/HTViewSolution?urlname=Receiving-error-sforce-apex-is-null-or-not-an-object-1327108329858&language=en_US

I've been messing with the code above to fit it into my button.  I'm stepping through the code through alerts, it stepped all the way through but at the end I get an Object error.  Any help would be appreciated.

function loadScript(url) 

    var request; 
    if (window.XMLHttpRequest) 
    { 
        request = new XMLHttpRequest(); 
    }     
    else if (window.ActiveXObject) 
    { 
        request = new ActiveXObject("Msxml2.XMLHTTP"); 
        if (!request) 
        { 
            request = new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
    
    } 


    var se = document.createElement('script'); 
    se.type = "text/javascript"; 
    //alert("before Request undefined\n");
    request.open("GET", url, false); 
    request.send(null); 
    se.text = request.responseText; 
    document.getElementsByTagName('head')[0].appendChild(se); 
    //alert("end of loadScript\n");


loadScript("/soap/ajax/30.0/connection.js"); 
loadScript("/soap/ajax/30.0/apex.js"); 
loadScript("/resource/jQuery/jquery-1.8.2.min.js"); 
loadScript("/resource/jQuery/ui/jquery-ui-1.9.1.custom.min.js");
loadScript("/resource/jQuery/postmessage/jquery.ba-postmessage.js");
loadScript("/resource/jQuery/bbq/jquery.ba-bbq.min.js");
loadScript("/resource/buttonjs");

try 

    var j$ = jQuery.noConflict(); 
    var newurl= sforce.apex.execute("RegisterMerchant", "getPricingArticleID",{leadID : "{!Lead.Id}"}); 
    newurl1 = String(newurl); 
    alert('Lead ArticleID '+newurl1); 
    if(newurl1.indexOf('error')>-1 ) 

    alert(newurl); 
    document.location.reload(true); 

else 

    alert('Start of Else Statement')
    var strQuery="Select l.of_Pin_Pads__c,l.Id, l.Article_ID__c, l.Processing_Origin__c, l.Company, l.Strategic__c, l.Gift_Only__c, l.Dealer__r.Name, l.Developer__c, l.DLR_Sales__c, l.Name, l.OwnerId from Lead l where Id= '" +'{!Lead.Id}'+"'"; 
    var accFields = sforce.connection.query(strQuery); 
    var records = accFields.getArray("records"); 

    var owner = records[0].OwnerId; 
    var ContactName = records[0].Name; 

    var leadId = records[0].ID; 
    var Dealer = records[0].Dealer__r.Name; 
    var devID = records[0].Developer__c; 
    var Developer = null; 
    var DealerSalesperson = null; 
    if (devID!=null) 
    alert('Developer Record')
    

    var strQuery3 = "SELECT Name from Account where ID='" +devID+"'"; 
    var devField = sforce.connection.query(strQuery3); 
    var devRecord = devField.getArray("records"); 
    Developer = devRecord[0].Name; 
    


var ds = records[0].DLR_Sales__c; 
//if (ds!= null) 
    alert('DLR sales Record1')
//{ 
var strQuery6 = "Select Name from Contact where id = '" +ds+"'"; 
var dlrSalesField = sforce.connection.query(strQuery6); 
var dlrSalesRecord = dlrSalesField.getArray("records"); 
DealerSalesperson = dlrSalesRecord[0].Name; 
//}
alert('Dlr sales Record2') 

var NumberOfPinpads = 0; 
//if(records[0].of_Pin_Pads__c!=null) 
//{ 
NumberOfPinpads = parseInt(records[0].of_Pin_Pads__c); 
//}
alert('Pin Pads') 
var ArticleId = records[0].Article_ID__c; 
var ProcessingOrigin = records[0].Processing_Origin__c; 
var CompanyName = records[0].Company; 
var StrategicAccount= records[0].Strategic__c; 
var GiftOnly = records[0].Gift_Only__c; 
alert('Other stuff') 


// if diff is null, continue, if user clicked cancel, allow them to chg processing origin 
console.log('leadId '+leadId+'--'+Dealer+'--'+Developer+'--'+ArticleId+'--'+DealerSalesperson); 
// next section stolen from Josh, thanks for doing my typing buddy! 
var $articleId = $('<input>', { name: 'ArticleId', type: 'hidden', value: ArticleId }); 
var $processingOrigin = $('<input>', { name: 'ProcessingOrigin', type: 'hidden', value: ProcessingOrigin }); 
var $companyName = $('<input>', { name: 'CompanyName', type: 'hidden', value: CompanyName }); 
var $strategicAccount = $('<input>', { name: 'StrategicAccount', type: 'hidden', value: StrategicAccount }); 
var $giftOnly = $('<input>', { name: 'GiftOnly', type: 'hidden', value: GiftOnly }); 
var $contactName = $('<input>', { name: 'ContactName', type: 'hidden', value: ContactName }); 
var $dealer = $('<input>', { name: 'Dealer', type: 'hidden', value: Dealer }); 
var $developer = $('<input>', { name: 'Developer', type: 'hidden', value: Developer }); 
var $dealerSalesperson = $('<input>', { name: 'DealerSalesperson', type: 'hidden', value: DealerSalesperson }); 
var $numberOfPinpads = $('<input>', { name: 'NumberOfPinpads', type: 'hidden', value: NumberOfPinpads }); 

//alert($articleId.html()); 
var $form = $('<form>', { 
'action': '{!$Label.pricingUI}Invoke', 
'method': 'post', 
'target':'_blank' 
}); 

$form.append($articleId); 
$form.append($processingOrigin); 
$form.append($companyName); 
$form.append($strategicAccount); 
$form.append($giftOnly); 
$form.append($contactName); 
$form.append($dealer); 
$form.append($developer); 
$form.append($dealerSalesperson); 
$form.append($numberOfPinpads); 

$(document.body).append($form); 

$form.submit(); 
// alert('done by me'); 


catch(er) 

alert(er); 
}
 

Hello,

When i try to donwload metadata from production org, it gives me message saying

downloading objects and profiles will overwrite field level security on the fields on those objects when deploying

Is it safe to doownload or not
  • September 30, 2015
  • Like
  • 0

As per release winter 16 release notes: http://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/salesforce_release_notes.htm
 

REQUIRESCRIPT no longer executes JavaScript on Page Load.

We use the REQUIRESCRIPT function in several custom buttons on our lead page.  When the Winter 16 features were released into our sandbox, our buttons started returning an error Reference $ Undefined.

I reached out to salesforce support, and they told me to use the code in the following article which removed the REQUIRESCRIPT function and instead, creates a custom java function.

https://help.salesforce.com/apex/HTViewSolution?urlname=Receiving-error-sforce-apex-is-null-or-not-an-object-1327108329858&language=en_US

I've been messing with the code above to fit it into my button.  I'm stepping through the code through alerts, it stepped all the way through but at the end I get an Object error.  Any help would be appreciated.

function loadScript(url) 

    var request; 
    if (window.XMLHttpRequest) 
    { 
        request = new XMLHttpRequest(); 
    }     
    else if (window.ActiveXObject) 
    { 
        request = new ActiveXObject("Msxml2.XMLHTTP"); 
        if (!request) 
        { 
            request = new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
    
    } 


    var se = document.createElement('script'); 
    se.type = "text/javascript"; 
    //alert("before Request undefined\n");
    request.open("GET", url, false); 
    request.send(null); 
    se.text = request.responseText; 
    document.getElementsByTagName('head')[0].appendChild(se); 
    //alert("end of loadScript\n");


loadScript("/soap/ajax/30.0/connection.js"); 
loadScript("/soap/ajax/30.0/apex.js"); 
loadScript("/resource/jQuery/jquery-1.8.2.min.js"); 
loadScript("/resource/jQuery/ui/jquery-ui-1.9.1.custom.min.js");
loadScript("/resource/jQuery/postmessage/jquery.ba-postmessage.js");
loadScript("/resource/jQuery/bbq/jquery.ba-bbq.min.js");
loadScript("/resource/buttonjs");

try 

    var j$ = jQuery.noConflict(); 
    var newurl= sforce.apex.execute("RegisterMerchant", "getPricingArticleID",{leadID : "{!Lead.Id}"}); 
    newurl1 = String(newurl); 
    alert('Lead ArticleID '+newurl1); 
    if(newurl1.indexOf('error')>-1 ) 

    alert(newurl); 
    document.location.reload(true); 

else 

    alert('Start of Else Statement')
    var strQuery="Select l.of_Pin_Pads__c,l.Id, l.Article_ID__c, l.Processing_Origin__c, l.Company, l.Strategic__c, l.Gift_Only__c, l.Dealer__r.Name, l.Developer__c, l.DLR_Sales__c, l.Name, l.OwnerId from Lead l where Id= '" +'{!Lead.Id}'+"'"; 
    var accFields = sforce.connection.query(strQuery); 
    var records = accFields.getArray("records"); 

    var owner = records[0].OwnerId; 
    var ContactName = records[0].Name; 

    var leadId = records[0].ID; 
    var Dealer = records[0].Dealer__r.Name; 
    var devID = records[0].Developer__c; 
    var Developer = null; 
    var DealerSalesperson = null; 
    if (devID!=null) 
    alert('Developer Record')
    

    var strQuery3 = "SELECT Name from Account where ID='" +devID+"'"; 
    var devField = sforce.connection.query(strQuery3); 
    var devRecord = devField.getArray("records"); 
    Developer = devRecord[0].Name; 
    


var ds = records[0].DLR_Sales__c; 
//if (ds!= null) 
    alert('DLR sales Record1')
//{ 
var strQuery6 = "Select Name from Contact where id = '" +ds+"'"; 
var dlrSalesField = sforce.connection.query(strQuery6); 
var dlrSalesRecord = dlrSalesField.getArray("records"); 
DealerSalesperson = dlrSalesRecord[0].Name; 
//}
alert('Dlr sales Record2') 

var NumberOfPinpads = 0; 
//if(records[0].of_Pin_Pads__c!=null) 
//{ 
NumberOfPinpads = parseInt(records[0].of_Pin_Pads__c); 
//}
alert('Pin Pads') 
var ArticleId = records[0].Article_ID__c; 
var ProcessingOrigin = records[0].Processing_Origin__c; 
var CompanyName = records[0].Company; 
var StrategicAccount= records[0].Strategic__c; 
var GiftOnly = records[0].Gift_Only__c; 
alert('Other stuff') 


// if diff is null, continue, if user clicked cancel, allow them to chg processing origin 
console.log('leadId '+leadId+'--'+Dealer+'--'+Developer+'--'+ArticleId+'--'+DealerSalesperson); 
// next section stolen from Josh, thanks for doing my typing buddy! 
var $articleId = $('<input>', { name: 'ArticleId', type: 'hidden', value: ArticleId }); 
var $processingOrigin = $('<input>', { name: 'ProcessingOrigin', type: 'hidden', value: ProcessingOrigin }); 
var $companyName = $('<input>', { name: 'CompanyName', type: 'hidden', value: CompanyName }); 
var $strategicAccount = $('<input>', { name: 'StrategicAccount', type: 'hidden', value: StrategicAccount }); 
var $giftOnly = $('<input>', { name: 'GiftOnly', type: 'hidden', value: GiftOnly }); 
var $contactName = $('<input>', { name: 'ContactName', type: 'hidden', value: ContactName }); 
var $dealer = $('<input>', { name: 'Dealer', type: 'hidden', value: Dealer }); 
var $developer = $('<input>', { name: 'Developer', type: 'hidden', value: Developer }); 
var $dealerSalesperson = $('<input>', { name: 'DealerSalesperson', type: 'hidden', value: DealerSalesperson }); 
var $numberOfPinpads = $('<input>', { name: 'NumberOfPinpads', type: 'hidden', value: NumberOfPinpads }); 

//alert($articleId.html()); 
var $form = $('<form>', { 
'action': '{!$Label.pricingUI}Invoke', 
'method': 'post', 
'target':'_blank' 
}); 

$form.append($articleId); 
$form.append($processingOrigin); 
$form.append($companyName); 
$form.append($strategicAccount); 
$form.append($giftOnly); 
$form.append($contactName); 
$form.append($dealer); 
$form.append($developer); 
$form.append($dealerSalesperson); 
$form.append($numberOfPinpads); 

$(document.body).append($form); 

$form.submit(); 
// alert('done by me'); 


catch(er) 

alert(er); 
}