-
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 Maximize Marketing Cloud Benefits: Checklist for 2024
With so much information and many marketing options, standing out and attracting your target customers can take time. But what if you could simplify your…
Latest Salesforce Commerce Cloud Feature: Lightning Order Management to Enhance the Order Management Process
If you are in the process of managing end-to-end order management in e-commerce or a product company, you would agree that it is the most…
How to Import multiple images into Salesforce Document folder?
Hello Everyone, Many times we need to import multiple images that are been available into our laptops to the Salesforce org. Yes, I do agree the…
Popular Salesforce Videos
How To Become a Salesforce Developer [Perfect Guide for Beginners]
Curious about a career in Salesforce development? Our video is your concise guide to getting started. What's inside:→ The average salary for a Salesforce Developer…
Integrate Salesforce with External System using REST API
In this video, Path to Code explains the following topics: - What is API? - Introduction to REST API - Using cURL to consume Rest…
Predicted Job Growth of Salesforce Business Analysts
In this video, Ben Analyst predicts the potential future growth of Salesforce. He compares the growth of Salesforce to other companies' growth rates and also…