-
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
Why Enroll in a Salesforce Administrator Course? Key Benefits for Your Career Advancement
In today's competitive digital landscape, organizations rely heavily on customer relationship management (CRM) systems to streamline their operations and build stronger customer relationships. As…
Stuck on the Salesforce Security Review Process?
The attack vector and evidence of vulnerability associated with each item is listed below with a description of the vulnerability. Remediation steps and additional educational…
Which is the Best Marketing Automation Tool?
Selection of the best marketing automation tool is akin to picking your preferred ice cream flavour. There are many great options available, each with its…
Popular Salesforce Videos
Salesforce Service Cloud Overview Demo
Service Cloud is a complete service solution built on the Salesforce platform that lets you quickly adapt to change, to deliver trusted service from anywhere.…
What are Queues in Salesforce? | A Salesforce Video Tutorial
Queue is useful for load management and it is most useful for the object like leads and cases for managing the work in a better…
Understanding Products & Pricebooks in Salesforce
In this video, Shrey gave detailed information about products and pricebooks You will also learn: 1. How to add and manage Products in Salesforce? 2.…