You need to sign in to do that
Don't have an account?
AmandaSilber
Javascript custom button - I need help!
I'm basically just learning as I go here - so bear with me!
I have a custom button on a custom object detail page that when clicked, I would like for it to create a child record and then update the lookupfield with the newly created child record.id on the parent record.
Here is the code I have - the first part works fine - the record creates seamlessly. The second part updating the lookup field does not work - I've altered, googled, altered, studied, and altered again with absolutely nothing working.
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")} {!Partnership_Employees__c.Employee_Onboarding__c} var copyonboarding = new sforce.SObject("Employee_Onboarding__c"); copyonboarding.Partnership_Employee__c = "{!Partnership_Employees__c.Id}"; copyonboarding.Name = "{!Partnership_Employees__c.Employee__c }"; copyonboardingID = copyonboarding.get("ID"); sforce.connection.create([copyonboarding]); //update employee record var employee = new sforce.SObject("Partnership_Employees__c") employee.Employee_Onboarding__c = copyonboardingID; sforce.connection.update([employee]); window.alert("Employee Onboarding Created"); window.location.reload();
http://www.interactiveties.com/b_execute_javascript_button.php