-
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
Purpose and Perks of Salesforce Subscription
As a business owner, you know customer relationships are key to success. You also understand that managing those relationships can be time-consuming and expensive. A…
Unpacking the Financial Realities of Salesforce Partner Transitions
Picking a software development partner is a big deal, affecting both your time and budget. People often worry about the hefty price tag of changing…
Deployment on Production Environment in Salesforce
When we move any code or component into a production environment we need to keep the below terms for our understanding: These terms are-: Change…
Popular Salesforce Videos
Get a Complete View of Salesforce Data with MongoDB
Teri will show you how you can incorporate Salesforce (relational data) into a MongoDB collection (non-relational data) to give your customers a unified customer experience.…
How To Start a Salesforce Career | Video Tutorial
In this episode of the TechTual Talk, our lovely guest Rachel joins us, and we discuss how to start a Salesforce career. 00:00:00 Start 00:09:00…
AMPscript Math Functions - Salesforce Marketing Cloud Functions in 5 minutes
Cameron Robert steps through how to use the AMPscript Math Functions in Salesforce Marketing Cloud. Key Moments: Introduction to AMPscript Math Functions (0:00) Add, Subtract,…