You need to sign in to do that
Don't have an account?
Beth Walter
Creating a Visual Force page, to create a custom button
I was sent here by someone on the Salesforce support team. She informed me that I need to create a visualforce page, so that I can create a custom button. I want to create a button or action that gives me the option to create a quote right after creating (saving) an opportunity. Do I need to create a Visual Force page, then a custom button or do I need to do something with the Opportunity object workflow? I need help creating these things, either way.
Sorry for this issue you are facing.
You can use apex trigger to create a new quote when an opportunity is created.
Please find the trigger below which creates a new quote when a new opportunity is created. Hope this helps.
Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are facing a similar issue.
Thanks,
Nagendra
Error: Opportunity_Quote line 1, column 1: Content is not allowed in prolog
Error: Content is not allowed in prolog.
I am new at this, so I am not sure how to fix it.
trigger QuoteCreate on Opportunity (after insert) {
List<Id> oppIdsList = new List<Id>();
List<Quote> quoteList = new List<Quote>();
for (Opportunity o : Trigger.new) {
if(o.FME_AMC_Renewal__c == True)
oppIdsList.add(o.id);
}
Opportunity[] oppList = [SELECT name, id, account.billingStreet, account.billingCity,
account.billingState, account.billingCountry
FROM Opportunity
WHERE id IN :oppIdsList];
for (Opportunity o : oppList) {
Quote q = new Quote();
q.name = o.name;
q.opportunityId = o.id;
q.billingStreet = o.account.billingStreet;
q.billingCity = o.account.billingCity;
q.billingState = o.account.billingState;
q.billingCountry = o.account.billingCountry;
quoteList.add(q);
}
insert quoteList;
}