-
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 Create a Partner Community Salesforce Account?
Partner Community : The Partner Community connects you directly to other partners with the power of social collaboration and mobile access. Steps to create a…
Salesforce Customization: Overcoming CRM Limitations for Growing Companies
Salesforce CRM has a complex, multilayered structure that can be adaptive to many business scenarios. Unfortunately, businesses can sometimes face Salesforce limitations (during business scaling,…
Salesforce Data Loss: Is Your Data Correct? How Can UI Contribute?
For a number of years security and safety of data has been the major reason which proved itself to be a hiccup in the path…
Popular Salesforce Videos
Salesforce Connections 2018 Keynote - Ch. 2: Ticketmaster Is A Trailblazer
Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…
How to Transform Sales Processes with Salesforce Anywhere
Salesforce Anywhere – a real-time interface that extends the power of Salesforce – is here to give sales leaders more visibility into what’s going on…
Salesforce JavaScript Developer 1 Certification Series
Hi Everyone, SFDC Panther has started the Salesforce JavaScript Certification series and this is the first session. What you will learn: Variables Data Types Operators…