• alexannnic
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hello,
As of this morning, almost all S-Controls in our Salesforce implementation have stopped functioning. For the past ~6years, we have been loading "http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" API to perform simple records manipulation, such as copying Account details to a new Opportunity  etc. The error we're getting when we try to run a page that includes the above reference to the old Sforceclient.js link is a 404 - not found error.

I am aware that the S-Controls have been deprecated but until yesterday afternoon we were able to load the old SforceClient js API.

- Is anyone aware of any changes that happened yesterday to this API or to S-Controls?
- Is any temporary workaround that we can do to temporarily continue functioning? Our Sales team has a major operational issue as a result of this change.

I'd appreciate any help,

Thanks, Alex

[Preface: as of today, all of our organizations' S-Controls which used 'http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js' do not work! This means that we must convert all of our S-controls procedures (about 20) to APEX during this weekend! Why did this happen? Without a warning? Note that we are not the only ones. See here]

 

Could you please help on the following matters?

 

I have a link in Accounts, which runs an S-control that creates a new Opportunity with some data prefilled. How can I create this in APEX-Visualforce? Create a custom link with on-click Javascript? How can I create an APEX controller + Visualforce page that:

1) gets some values from the current Account page? (old way: var AccountName = "{!Account.Name}";)

2) creates a new Opportunity object and fills in some fields

3) Saves the new Opp and redirects the browser to the new Opp page?

 

Thank you for your help!

Alex

[Preface: as of today, all of our organizations' S-Controls which used 'http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js' do not work! This means that we must convert all of our S-controls procedures (about 20) to APEX during this weekend! Why did this happen? Without a warning? Note that we are not the only ones. See here]

 

Could you please help on the following matters?

 

I have a link in Accounts, which runs an S-control that creates a new Opportunity with some data prefilled. How can I create this in APEX-Visualforce? Create a custom link with on-click Javascript? How can I create an APEX controller + Visualforce page that:

1) gets some values from the current Account page? (old way: var AccountName = "{!Account.Name}";)

2) creates a new Opportunity object and fills in some fields

3) Saves the new Opp and redirects the browser to the new Opp page?

 

Thank you for your help!

Alex

This s-control doesn't work and I can't figure out why.  You can click on the custom link and it just takes you to a white screen and then does nothing.  The opportunity doesn't get updated either.

 

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Executed Contract Received</title>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script>
function initPage() {
//Initialize the connection to salesforce.com by setting the sessionid and the
//soap endpoint in the init call
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
sforceClient.registerInitCallback(startUp);
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", false);
}

function startUp() {

var Type="{!Opportunity.Type}";
var Status="{!Opportunity.Export_Status__c}";
var Profile="{!$User.ProfileId}";
//if(Profile = "00e30000000g5na"){
// var retUrl = "https://na1.salesforce.com/" + "{!Opportunity.Id}";
// window.parent.parent.location.href = retUrl;
// alert("You do not have the proper permissions to mark this opportunity as received!");


if ((Type == "Merchants@ Platinum") || (Type == "Merchants@ Gold") || (Type == "Merchants@ Upgrade")) {
if (Status == "Exported"){
var retUrl = "https://na1.salesforce.com/" + "{!Opportunity.Id}";
window.parent.parent.location.href = retUrl;
alert("This opportunity has already been exported!");
}
else{

//set as Ready for export
var myObj = new Sforce.Dynabean("Opportunity");
myObj.set("id", "{!Opportunity.Id}");
myObj.set("Export_Status__c", "Ready");
var saveResults = sforceClient.Update([myObj]);
var retUrl = "https://na1.salesforce.com/{!Opportunity.Id}";
window.parent.parent.location.href = retUrl;
}
}
else if ((Type == "Amendment") || (Type == "Platinum Renewal") || (Type=="Gold Renewal")) {
if ("{!Opportunity.Master_Opportunity__c}" == "") {
var retUrl = "https://na1.salesforce.com/" + "{!Opportunity.Id}";
window.parent.parent.location.href = retUrl;
alert("This opportunity is missing the Master Opportunity field! Please refer to Sales Ops.");
}
else {
//create remedy ticket
var holdback = "%0D%0AReturn Holdback: {!Opportunity.ReturnHoldback__c}%0D%0A";

//get rev shares from contract
var qr = sforceClient.Query("Select Category__c, Product_Rev_Share__c, Gift_Wrap_Rev_Share__c, Shipping_Rev_Share__c from Revenue_Share__c Where Contract__c = '{!Opportunity.Contract_ID__c}' ");
alert(qr);
var fees = "Category+++++++++ Product | Shipping | Giftwrap%0D%0A-----------------------------------------------------------------------%0D%0A";
for (var i=0;i<qr.records.length;i++) {
var revshare = qr.records[i];
var category = revshare.get("Category__c");
var product = revshare.get("Product_Rev_Share__c");
var shipping = revshare.get("Shipping_Rev_Share__c");
var giftwrap = revshare.get("Gift_Wrap_Rev_Share__c");
var fees = fees + category + "++++++" + product + " | " + shipping + " | " + giftwrap + "%0D%0A";
}

//get contract info
var qr = sforceClient.Query("Select Effective_Date__c, SpecialTerms,Description from Contract Where ID = '{!Opportunity.Contract_ID__c}' ");
alert (qr);
for (var i=0;i<qr.records.length;i++) {
var contract = qr.records[i];
var effective = "Effective Date: " +contract.get("Effective_Date__c") + "%0D%0A";
var terms = "Special Terms: " + contract.get("SpecialTerms") + "%0D%0A";
var descr = "Description:" + contract.get("Description") + "%0D%0A";
var descrclean = descr.replace("&", "and");
}

//find all affected storefronts
var masteropp = "{!Opportunity.Master_Opportunity__c}";
var qr = sforceClient.Query("Select Production_Customer_ID__c, Name from Opportunity Where ID = '{!Opportunity.Master_Opportunity__c}'");
alert(qr);
var storefronts = "%0D%0A%0D%0AAffected Storefronts:%0D%0A%0D%0AProd Cust ID +++++ Opportunity Name%0D%0A-------------------------------------------------------------------------------------------------%0D%0A";
for (var i=0;i<qr.records.length;i++) {
var storefront = qr.records[i];
var prodid = storefront.get("Production_Customer_ID__c");
var name = storefront.get("Name");
var storefronts = storefronts + prodid + "+++++" + name + "%0D%0A";
}

//document.write(qr);
// document.write("%0D%0AEffective Date - " + effective+ "%0D%0A%0D%0ASpecial Terms - " + terms + "%0D%0A");
// document.write(storefronts);

//get original opp
//get names and prod ids from all related opps %0D%0A


//document.write("This is where we would create a remedy ticket");

if (Type=="Tax Amendment"){
var retUrl = "https://tt.amazon.com/new?impact=4&category=Website&type=IWS3&item=Tax+Enablement&assigned_group=IWS-Tax-Manual&assigned_individual=tax-engine-bz&problem_location=&case_type=Trouble+Ticket&short_description={!Opportunity.Type}+Request+for%3A+{!Opportunity.Account}&details={!Opportunity.Type}+Request+for%3A+{!Opportunity.Account}&240000007=" + fees + holdback + effective + terms +descrclean + storefronts;&cc_list=&vendor_id=&quantity=&purchase_order_id=&asin=&isd=&upc=&title=&binding=&stock_number=&ship_origin=&invoice_number=&physical_location=&tracking_number=&picture_file_imdex_location=&bol_number=;
}
else
{
var retUrl = "https://tt.amazon.com/new?impact=4&category=Partners&type=Merchant+Engagement&item=Fee+Changes&assigned_group=Merchant+Engagement&assigned_individual=lmirth&problem_location=&case_type=Trouble+Ticket&short_description={!Opportunity.Type}+Request+for%3A+{!Opportunity.Account}&details={!Opportunity.Type}+Request+for%3A+{!Opportunity.Account}&240000007=" + fees + holdback + effective + terms +descrclean + storefronts;&cc_list=&vendor_id=&quantity=&purchase_order_id=&asin=&isd=&upc=&title=&binding=&stock_number=&ship_origin=&invoice_number=&physical_location=&tracking_number=&picture_file_imdex_location=&bol_number=;
}
var myObj = new Sforce.Dynabean("Opportunity");
myObj.set("id", "{!Opportunity.Id}");
myObj.set("Export_Status__c", "Remedy");
var saveResults = sforceClient.Update([myObj]);

window.location.href = retUrl;
}
}


else {
//warn that type is not correct
var retUrl = "https://na1.salesforce.com/" + "{!Opportunity.Id}";
window.parent.parent.location.href = retUrl;
alert("This opportunity has an unrecognized Type!");
}

}

</script>
</head>
<body onload="initPage()">
</body>
</html>