You need to sign in to do that
Don't have an account?
SeniorMove
Use Detail Page button with Execute Javascript to pass values to related object?
This seems like it should be straightforward, but it doesn't work. I don't receive any errors, but nothing happens.
The Move__c object is on the detail side of a Master-Detail relationship with Client__c.
I'm trying to use the button to grab field values from Move__c, and pass those values into fields on Client__c.
Am I trying to do something that won't work?
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} var connection = sforce.connection; var url = parent.location.href; //string for the URL of the current page var clientMoved = "{!Move__c.ClientId__c}"; var moveToStreet = "{!Move__c.Move_To_Street__c}"; var moveToCity = "{!Move__c.Move_To_City__c}"; var moveToState = "{!Move__c.Move_To_State_Province__c}"; var moveToZip = "{!Move__c.Move_To_Zip_Postal_Code__c}"; var moveToCountry = "{!Move__c.Move_To_Country__c}"; var moveToProperty = "{!Move__c.Property__c}"; var client= new sforce.SObject("Client__c"); client.Id = clientMoved; client.Mailing_Street__c = moveToStreet; client.Mailing_City__c = moveToCity; client.Mailing_State__c = moveToState; client.Mailing_Zip_Code__c = moveToZip; client.Mailing_Country__c = moveToCountry; client.Shipping_Street__c = moveToStreet; client.Shipping_City__c = moveToCity; client.Shipping_State__c = moveToState; client.Shipping_Zip_Code__c = moveToZip; client.Shipping_Country__c = moveToCountry; client.Property__c = moveToProperty; connection.update([client]); parent.location.href = url; //refresh the page
you can pass the value using the URL ;
/e?clone=1&retURL=%2F0034000000jO8s0&field1=data&field2=data
All Answers
you can pass the value using the URL ;
/e?clone=1&retURL=%2F0034000000jO8s0&field1=data&field2=data
Thanks jackee. I always seem to forget about the URL method. I guess I had moved away from that because I thought Salesforce was going to deprecate the ability to do that.
I also found the following link helpful:
http://salesforce.phollaio.com/2007/01/11/salesforces_url_structure/
Thanks again!