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
KunalKunal 

Trouble implementing Contact Address Update example of AJAX toolkit in Sforce developer account

For some accounts in developer edition it works and for some it doesn't work.

I changed the toolkit url to https://www.sforce.com/.....

Looks like the account ID is obtained fine before the call to sforceclient.js and once that javascript is loaded the account ID is getting lost for some of the accounts (express logistics, U of Arizona).

Let me know if you need more details and I will be happy to provide them.
DevAngelDevAngel
What is the behavior that indicates that the account number is lost?
KunalKunal
OK. Let me tell you step by step what I did.

1) Downloaded the AJAX toolkit and modified the sControlContactAddressUpdate.htm as follows
1.Changed the sforceclient.js file location to https://www.sforce.com/......
2.Since I am accessing the scontrol from within salesforce, changed the pageinit function as follows:

function pageInit() {
contactHeader = document.getElementById("contactTable").firstChild.innerHTML;
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
loadAccountInfo();
setupForm();
}

I want users to modify the contact addresses only for the account for which they click the custom link from. So, I took out the functions (two of them) and html code that populates and manages the drop downs and the DIV.

Everything else is unchanged.

The way I figured that the account ID is getting lost for some account is, if I put an alert to show account ID before I call the sforceclient.js, I can see the account ID and if I put the alert afterwards, I don't even see an empty alert. I think it generates 'Object expected' error in sforceclient.js, I believe.

There are two things I don't understand (1) if I hardcode my username and password in htm file where it requires and then open it in browser, it works perfectly (2)If I make it a s-control and then open it from within salesforce, it works for half of the accounts and doesn't work for the other half. It works for sforce account but doesn't work for U of Arizona account for me.
DevAngelDevAngel
Hi Kunal,

Can you send me your scontrol file (zipped)?

Send it to dcarroll*nospam*@*nospam*salesforce.com. (remove the *nospam* from the email)