You need to sign in to do that
Don't have an account?
j_wenner
s-control to copy the Billing Address to the Shipping Address
I am new to s-controls and need to build an s-control to copy the Billing Address to the Shipping Address on the Account object. Please advise.
thx
Jeanette
Yes, I would like it to be a button that is pushed.
Can you send me the URL code that I would need to accomplish this task?
I can't send you the code, since I can't see your screen, but I can point you in the correct direction
Create a new button Setup > App Setup> Customize > Accounts > Buttons and Links
Select Detail Page Button, Display in existing window with out header or sidebar
Down at the bottom, start with
In my sandbox, I tried the following code in a Detail Page Button with "Display in new window" and "URL" selected:
https://tapp0.salesforce.com/{!Account.Id}/e?retURL=%2F{!Account.Id}&ShippingStreet={!Account.BillingStreet}&ShippingCity={!Account.BillingCity}&ShippingState={!Account.BillingState}&ShippingPostalCode={!Account.BillingPostalCode}&save=1
It opens up a new window but does not do the copy as expected. :( Please advise.
Here is my code with our custom Billing Address and Shipping Address:
https://tapp0.salesforce.com/{!Account.Id}/e?retURL=%2F{!Account.Id}&Shipping_Address__c={!Account.Billing_Street__c}&Shipping_City__c={!Account.Billing_City__c}&Shipping_State__c={!Account.Billing_State__c}&Shipping_Zip_Code__c={!Account.Billing_Zip_Code__c}&save=1
And unfortunately, it still doesn't work :(
Below is what's behind that link I told you about. Maybe you can chase down where that exists in Salesforce's own JavaScript files and leverage that.
I changed my button to "execute javascript" and copied/pasted the following code example from you posting and changed the names of the fields appropriately:
javascript: copyAddr('Shipping_Address__c', 'Shipping_City__c', 'Shipping_State__c', 'Shipping_Zip_Code__c', 'Billing_Street__c', 'Billing_City__c', 'Billing_State__c', 'Billing_Zip_Code__c', true, true)
When I click on the button it throws an error stating:
"A problem with the OnClick JavaScript for this button or link was encountered"
'javascript' is undefined
Please advise. I am new to these buttons and links and need much guidance.
thx :)
I tried your suggestion and viewed the source of the edit screen on Account and found the following:
<label for="00N300000017WV9"><span class="requiredMark">*</span>Mailing Street</label>
I would assume that I would have found "Billing_Street__c" in the "label for=" section since that is the field name in the database. The id shown above seems unique to that particular Account record.
I want to make this s-control button generic enough to work on whatever Account record you happen to be viewing. Please advise.
If you were putting data in the Mailing Street field then the code would be
00N300000017WV9={whateverFieldYouAreInserting}
I tried doing that exact thing with the following code:
javascript: copyAddr('00N300000017U1C', '00N300000017U1H', '00N300000017U1b', '00N300000017U1M', '00N300000017WV9', '00N300000017WVE', '00N300000017WR3', '00N300000017WVJ', true, true)
When I click on the button it still throws an error stating:
"A problem with the OnClick JavaScript for this button or link was encountered"
'javascript' is undefined
I did that and now I get the following error:
"A problem with the OnClick JavaScript for this button or link was encountered"