-
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 Queueable Apex in Salesforce?
This Apex allows you to submit jobs for asynchronous processing similar to future methods. We have to implement the Queueable interface to make the class…
Salesforce Automation with Flow
Following on from the previous article on Salesforce automation tools, this time we cover automation using the brand-new Flow Builder tool (as released in Feb 2019). This…
Popular Salesforce Videos
Salesforce Marketing Cloud Connector for UiPath
This is a connector for Salesforce Marketing Cloud that allows you to work in the background with SFMC instance. watch this video and let us…
Salesforce Integration Tutorial | Integrate Salesforce with Apps | Salesforce Training
This Salesforce Integration Tutorial video by Edureka will help you understand what is Salesforce integration in detail. It will also address the various Salesforce integration…
How to Elevate Engagement with Salesforce Experience Cloud?
Salesforce Experience Cloud helps companies create personalized portals for customers to find answers, collaborate, and be part of a community. In this video, ENWAY will…