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
Jake GharibJake Gharib 

Create Opportunity from Task

Hi All,

I handle more of the Admin side of things at my company so haven't done much coding / development work in my experience.  We have an ask to generate an Opportunity from specific Tasks that are created in our environment.  I've attempted a Process Builder which works just fine once I hit the criteria we need, however, bringing in the Task that started the Opportunity and tying it back to it is the trouble I have.  I was told this could be done with coding and if there's any assistance anyone could provide, it would be greatly appreciated.  Below is the criteria needed...
  • Starting on the Task record - Click custom button "Create RGO"
  • Have it mark the Task as Status "Completed"
  • Create new Opportunity with Stage "Pre-Upload Needs Assessment"
  • Assign the same OwnerId, WhoId, and AccountId on Task to the new Opportunity created
  • Tie back the SAME Task record that started the process and relate it to the created Opportunity
Thank you again for any help in advance.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Jake,

You can create a Visualforce page and place it on the field so that you can create a new opportunity. and that component can inturn mark the task completed.

I hope this helps.

Regards,
Anutej