• Ambuj
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi There, Scenario: I have a visualforce page which has a button 'Approve'. On clicking the button; there is a field 'Status' on a custom object 'Approver'(It is a detail object to Opportunity) and a field 'Approval Status' on Opportunity object which gets updated as is written on the corresponding method in the associated controller. Question: I logged in as a user which has access to both the the master and the detail object records and clicked on the 'Approve' button to find both fields are updated. This is fine and expected. Now I logged in as a user who DO NOT has the access to both the master and the detail object records and click on the 'Approve' button to find that the detail object gets updated but the master object do not !!!! Kindly suggest and let me know if the access is necessary then why the detail object record was updated without the user having the access to it and not the master object record?
  • September 26, 2012
  • Like
  • 0

Can someone tell me why the subquery is throwing an error in developer console...????
Opportunity opp = [Select Id, (Select Id, Status__c from Object__r where Status__c = 'Waiting for their Turn') from Opportunity where Id = 'XXXXXXXXXXXXXXX'];
Object__c is detail to Opportunity ....

Error is:
"Didn't understand relationship 'Object__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."

Its urgent.. Thanks..!!!

  • September 04, 2012
  • Like
  • 0

I'd like to override the standard Save button for Account objects. I know I can't do that directly, so I thought I'd override the Account Edit page, going to a Visualforce page instead, and then override the standard save action in a controller extension.

 

So I created a new VF page that looks like this:

 

 

<apex:page standardController="Account" extensions="AccountEditController">
<apex:detail subject="{!id}" relatedList="true"/>
</apex:page>

Then I overrode the Account Edit button to go to this page.

 

My first problem is that this page displays in view mode, not edit mode. If I click the Edit button, it (of course) just loads the same page again. How do I get the <apex:detail> component to display in edit mode?

 

My second problem is overriding the standard Save action. I think I can do it with the following in my controller extension:


public class AccountEditController {
private final Account acct;
private ApexPages.StandardController stdController;

public AccountEditController(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
this.stdController = stdController;
}

public PageReference save() {
// Put my own stuff here

// Do the standard save action
return this.stdController.save();
}
}

 

Is that correct?

 

Thanks!

 

MJ.

 

 

 

 

 

 

 

  • April 16, 2009
  • Like
  • 0