-
Custom button to add existing records In org.
I am trying to add a custom button to add existing records to a custom object related list (Specifications(custom obj) to Products(custom obj))
Ext class code:
public with sharing class AddExistingSpecsExt {
public Product__c specs { get; set; }
public AddExistingSpecsExt() {
String specs Specification__c = ApexPages.currentPage().getParameters().get('id');
specs = [SELECT Id, Name, Product__c FROM specs WHERE Id =: specs.Id];}
public PageReference associate () {
Opportunity opp = new Opportunity ( Id = Specification__c.Product__c, specsid = Specification__c.Id);
try {
Database.update(opp);
} catch (Exception error) {
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
}PageReference page = new PageReference('/' + specs.Id);
return page.setRedirect(true);
}public PageReference cancel () {
PageReference page = new PageReference('/' + specs.Id);
return page.setRedirect(true);
}}
I am getting this error:Line 7: expecting a semi-colon, found 'Specification__c'
Log In to reply.
Popular Salesforce Blogs
How to Choose the Best Salesforce Consulting Company: A Complete Guide
Selecting the best Salesforce consulting company is essential for any company, enterprises or startups trying to get the most out of its Salesforce investment. Finding…
Data Export in Salesforce - A Brief Guide
Exporting data from Salesforce can be done with the help of Data Export methods, it can be done either in a manual way or in…
The Salesforce Implementation Process: What Is It?
Salesforce implementation is the process of integrating and customizing the Salesforce platform to meet the specific needs of a business or organization. Salesforce is a…
Popular Salesforce Videos
Salesforce Lightning Web Component Crash Course | Learn LWC in 100 Minutes with Live Project
This is a crash course video on the Lightning Web Component framework where we will cover all fundamentals of LWC in just 100 minutes. This…
Salesforce Integration: How to Do it the Best Way?
Once you deploy Salesforce solutions to improve the operation of your enterprise, your next logical step is to enhance the overall functionalities by integrating Salesforce…
5 Tips on How to Run Your Pipeline Engine to Drive Growth | Salesforce on Salesforce
Salesforce’s revenue has been on a firm upward trajectory for years, and every year we see terrific growth. How do we do it? I’ll let…