You need to sign in to do that
Don't have an account?
ExploreForce
Apex:CONSTRUCTOR.Pls help
If i have two VF pages,
<apex:page standardController="Request__c" extensions="LocationRequestController" sidebar="false"> and
AND
<apex:page standardController="Order" extensions="LocationRequestController" sidebar="false">.
Controller:
public LocationRequestController(ApexPages.StandardController controller) {
AccId= ApexPages.currentPage().getParameters().get('AccId');
if(object==Request__c)
{
system.debug('AccId'+ AccId);
ReqUser=(Request__c) controller.getRecord();
ReqUser.Location__c=AccId;
brequest=true;
}
else
{
OrderReq=(Order) controller.getRecord();
OrderReq.AccountId=AccId;
blorder=true;
}
}
Is this allowed in salesforce?
IS there any way i can differentiate, based on object?
<apex:page standardController="Request__c" extensions="LocationRequestController" sidebar="false"> and
AND
<apex:page standardController="Order" extensions="LocationRequestController" sidebar="false">.
Controller:
public LocationRequestController(ApexPages.StandardController controller) {
AccId= ApexPages.currentPage().getParameters().get('AccId');
if(object==Request__c)
{
system.debug('AccId'+ AccId);
ReqUser=(Request__c) controller.getRecord();
ReqUser.Location__c=AccId;
brequest=true;
}
else
{
OrderReq=(Order) controller.getRecord();
OrderReq.AccountId=AccId;
blorder=true;
}
}
Is this allowed in salesforce?
IS there any way i can differentiate, based on object?
Use Id methods to find the token of the object.
Hope it helps! :)
try{
ReqUser=(Request__c) controller.getRecord();
}
catch(System.TypeException e){
OrderReq=(Order) controller.getRecord();
}