-
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
What is the Salesforce Analytics Cloud? | The Ultimate Guide
Welcome back to our page! Today, we are going to know about analytics cloud. Salesforce Analytics Cloud, also known as Salesforce Einstein Analytics, is a…
Texas Dreamin’ is All Set to Surprise the Salesforce Trailblazer Community
Howdy Ohana, Texas Dreamin’ is quickly approaching. So put on your spurs and fasten your seat belts; the event will be hosted inperson this year on April…
Popular Salesforce Videos
Streamline Sales Goals and Add Value to Your B2B Organization With Salesforce Marketing Automation
Salesforce Marketing Automation enables businesses to automate marketing processes, track customer engagement while delivering personalized experiences to each customer. With it, you can streamline and…
How to Create a Free Developer Account in Salesforce?
There are many ways of creating a Salesforce account without investing a single rupee or a dollar with the developer’s edition and working on the…
What is a Salesforce Admin?
Salesforce administrators are the gatekeepers of their employer's sales and marketing data. They create each user account and determine the proper level of access based…