-
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 Role Does Salesforce Play in High-Tech Success?
The high-tech sector is experiencing explosive growth, emerging as a global economic powerhouse. Projections indicate that this industry's global market value will rise to $16…
Salesforce Health Cloud Features That Enhance Healthcare Team Collaboration
In the modern healthcare landscape, collaboration among medical professionals is the foundation of better patient outcomes. As healthcare organizations expand and data becomes more complex,…
Bridge Your Digital Transformation Gaps With DAP | Salesforce-powered Communities
In today’s day and age, the way businesses operate has shifted drastically. Running a business without using some sort of software or technology is unimaginable.…
Popular Salesforce Videos
Lightning Component In Salesforce
In this video, we are going to look into: Lightning Component Lightning Component features Types of Lightning Component Lightning Component bundle Watch this video and…
How to Get Started on Your Salesforce Admin Certificate with Trailhead
In this video, Brad discusses how to get started with your Salesforce career using trailhead. He discusses how to create and validate your account, the…
How To Use Salesforce Campaigns in Pardot
Learn campaign basics to help you plan your marketing strategy. In this video, Pardot experts guide you in: - Defining campaigns in Pardot and Salesforce…