-
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
Salesforce CPQ Pricing Tools - All You Need to Know
CPQ Pricing Methods are the ways to set prices in CPQ. Imagine a situation where the same product must be sold to different consumers at…
Types of Report Formats in Salesforce - All You Need to Know
What are the Report Formats in Salesforce? A Salesforce report is a list of information produced dependent on predefined standards. They can be displayed in…
The Impact of Salesforce On Your Customer Service Performance
Technology and innovation are changing the way businesses interact with customers. One such innovation is the use of customer relationship management (CRM) tools to help…
Popular Salesforce Videos
Sales Cloud: Opportunity Splits in Lightning Experience
In today's connected world, technology is rapidly becoming the difference between big quarters and big misses. Companies must empower every sales rep to sell faster,…
Salesforce Admin Certification Questions and Explained Answers with References to Trailblazers
A Salesforce Admin Certification is the highest form of recognition a Salesforce Administrator can achieve; it demonstrates expertise in the field as well as a…
How to Use the Lightning Knowledge Migration Tool | Salesforce Tutorial
Use the Lightning Knowledge Migration Tool to move your Classic knowledge base into Lightning Knowledge. The Lightning Knowledge Migration Tool works differently depending on whether…