-
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
MFA (Multi-Factor Authentication) in Salesforce
Introduction MFA is a special security feature provided by Salesforce that provides an extra layer of protection against suspicious or unauthorised logins. After enabling the…
Unlocking the Power of Salesforce Outsourcing
In the ever-evolving world of business, organizations are constantly on the lookout for innovative approaches to streamline operations and fuel growth. One increasingly popular strategy…
Azure with Salesforce for Customer Engagement and Operational Excellence
The retail landscape is in constant flux, driven by evolving customer expectations and disruptive technologies. Staying ahead requires more than just keeping up; it demands…
Popular Salesforce Videos
Custom Login Page Using Mulesoft | Salesforce Tutorial
In this video, you will learn how to create a custom login page using Mulesoft. Watch and learn. If you have any doubts do let…
Salesforce Winter 21 Release - Sneak Peek
The Winter ’21 release delivers innovations across the Salesforce Customer 360 platform to help connect you to your customers, from anywhere. Fancy table updates, live…
Getting your Customer on Track with Salesforce
Hear from Jonathan Gardner, Head of CRM Development First Group, and Lee Holsgrove, Client Adviser IBM as they discuss First Group's transformation bringing together a…