You need to sign in to do that
Don't have an account?
Craig Phoenix
Create Case On Opportunity Field Values
I am struggling with building a trigger to create a case when Opportunity is Closed with Setup Needed = Yes (Picklist) and still trying to learn as I run with Apex.
Opportunity fields Stage=Closed Won, Type=Upgrade and Setup Needed=Yes once all 3 of these fields are set to these values I need it to create a Case with Subject containing Opportunity Name and Account Name, also link to Account that is attached to the Opportunity then dump a bunch of the Opportunity fields into the Description field for example:
Customer: {!Account.Name}
AccountNumber: {!Account.AccountNumber__c}
Sold By: {!Opportunity.OwnerFullName}
I had it setup (since minimal coding experience) where it used a workflow to send an email which looped back into SF with Email-to-Case but thats not working 100% so I believe I need to move it into SF directly.
If anyone can help with building the trigger to create the case with field data from the Opp passed into the case that would be great help!
Opportunity fields Stage=Closed Won, Type=Upgrade and Setup Needed=Yes once all 3 of these fields are set to these values I need it to create a Case with Subject containing Opportunity Name and Account Name, also link to Account that is attached to the Opportunity then dump a bunch of the Opportunity fields into the Description field for example:
Customer: {!Account.Name}
AccountNumber: {!Account.AccountNumber__c}
Sold By: {!Opportunity.OwnerFullName}
I had it setup (since minimal coding experience) where it used a workflow to send an email which looped back into SF with Email-to-Case but thats not working 100% so I believe I need to move it into SF directly.
If anyone can help with building the trigger to create the case with field data from the Opp passed into the case that would be great help!
I hope the following trigger would work for you.
I also tested this scenario in one of my developer org. So once you updated the Opportunity stage as "Closed Won" of an opportunity in which type is "Upgrade" and Setup Needed is set to true. This trigger should work.
Following is the input opportunity that I have been used to test this scenario.
Once it was updated, a case is created as follows.
All Answers
I hope the following trigger would work for you.
I also tested this scenario in one of my developer org. So once you updated the Opportunity stage as "Closed Won" of an opportunity in which type is "Upgrade" and Setup Needed is set to true. This trigger should work.
Following is the input opportunity that I have been used to test this scenario.
Once it was updated, a case is created as follows.