2

I'm trying to update Billing address with Custom button JavaScript.

But I can't update Billing address parts, as it seems there are taken from primary contact.

Here is example, what I want to do:

{!requireScript("/soap/ajax/26.0/connection.js")} 

var account = new sforce.SObject("Account"); 

account.id = "{!Account.Id}"; 
account.BillingStreet = "test" //here is my problem

sforce.connection.update([account]); 
window.location.reload();
2
  • By the way, are you getting an error message at the problem line? It's not totally clear where things are breaking down from your question. Commented Nov 3, 2013 at 23:34
  • Now its working. I did get undefined on it. Looks like I was pretty tired when doing this. Thanks anyway. Commented Nov 5, 2013 at 19:05

1 Answer 1

1

According to the docs, Account.BillingStreet is updateable, so you might check the field level security for the running user to see if they're allowed to update that field.

enter image description here

Secondarily, a Visualforce Page and an Apex Controller, while more verbose then some javascript may be a better way to go, if only for the fact that APEX gets better support on this forum (I know, not much of a reason) and attention from Salesforce than the AJAX toolkit, which is a relic from the now deprecated S-Control family. (Yes, not much of a reason, I know)

3
  • 1
    Have to agree, though it may not seem like a good reason, it's enough reason for me to go with Apex for most situations Commented Nov 3, 2013 at 23:49
  • Lol, now if only we could use the vf page action attribute without having to worry about security holes (i.e. be able to flag whether a custom button should post to a visualforce page, or do the standard get request) Commented Nov 3, 2013 at 23:54
  • We can hope right??? Lol Commented Nov 4, 2013 at 0:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .