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

Creating 1:1 Relationship in VF, at What Point?

I have a visualforce page that, when the user clicks a button, creates a new record (profile) based on the current record (opportunity).


I want to link the new profile to the existing opportunity via a lookup on the existing record (essentially creating a 1:1 relationship).


At what point in my code and how can I edit the existing opportunity profile field to update it to the newly created profile id?


I have tried the following, but it does not work:



// Create the project
try {
res = sforce.connection.create([project]);
} catch (err) {
if (res[0].getBoolean("success")) {
ret = res[0].id;

sourceOpp.Project_Profile__c = project.Id;


return (ret);


 Note: this page is written in javascript.