-
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
Driving Innovation With Ideas From Your Online Community | Salesforce Guide
Innovation is the key to business growth. In order to come up with a successful product, you need to make the most of ideas and…
A Machine Learning Approach to Deduping Salesforce
When we look at all of the Salesforce deduplication apps on the AppExchange, they all have one thing in common: they are all rule-based. Basically,…
Salesforce Automation Tools - Document Generation Made Easy
While running a business, there are so many important documents and records that need resources and time for their management. In an organization, generating documents…
Popular Salesforce Videos
Attribute Setup for Skill based Routing in Salesforce
This video is 3rd Part of the Omnichannel Series. Implementation of Attribute set up skill-based routing with the demo. Do let us know in the…
How To Create Global Picklist In Salesforce
Learn how Global Picklist is created in Salesforce. The following points will be covered in this tutorial - 1. Introduction To Global Picklist Global picklist…
Work Your Opportunities and Manage Your Pipeline (Lightning Experience) | Salesforce
In this video, Salesforce Support demonstrates how to work with deals and manage your pipeline in the Salesforce Lightning Experience. With interactive features that help…