• anilmca
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

Hi,

I'm trying to create a custom detail view for a custom object and implement inline edits. However, the page is not only used to edit the custom object (Test_Parent__c) but also its related objects (Test_Child__c). Here is the controller:

 

 

public class TestController
{

    public Test_Parent__c rep {get; set;}
    public List<Test_Child__c> recs {get; set;} 
    
    public TestController() {
        String id = ApexPages.currentPage().getParameters().get('id');

        rep = [select id, Test_Text__c from Test_Parent__c where Id = :id][0];
        recs = [select id, Hours__c from Test_Child__c where Test_Parent__r.Id = :rep.Id];
    }

    public PageReference save() {
        update rep;
        update recs;
        return null;
    }

}

 and here is the visualforce for this page:

 

 

<apex:page controller="TestController" > 
<apex:form >
<apex:commandButton action="{!save}" id="saveButton" value="Save"/>
<apex:inlineEditSupport>
  <table border="1" bordercolor="black">
      <tr>
          <td>Parent Name:</td><td><apex:outputField value="{!rep.Test_Text__c}" ><apex:inlineEditSupport />
          </apex:outputField></td>
      </tr>
  </table>
<apex:repeat value="{!recs}" var="rec">
    Child Hours: <apex:outputField value="{!rec.Hours__c}"><apex:inlineEditSupport />
          </apex:outputField>
</apex:repeat>
</apex:inlineEditSupport>
</apex:form>
</apex:page>

Now, when I use the inline edit feature, the parent rep objects gets update and the child does not get updated. I played around with placing the inlineEditSupport tag inside the form and also inside the individual outputField records. I wasn't able to get this to work consistently to update both records at the same time. I would sometimes see that the child related record will get updated and most times it would not. 

 

Any suggestions or ideas?

 

 

Hi,

 

Is there a way to deactive a validation rule in APEX. I want to update a record from APEX, but do not want to fire Validation rule, if the same rule is fired from UI, validation rule should fire. 

 

I am thinking to deactive just before record.update and active again. Can this be done? Is there any other way to acheive this? 

 

thanks for the time.

Mitesh

Please help!

I’ve created an APEX class

 

 

global class LeadImporterExternal {

       WebService static String importLead(String xmlParameter) {

              leadImporter importer = new leadImporter();

              return importer.importLead(xmlParameter);

       }

}

 

Downloaded WSDL file for this class. Using this file I have generated a C# code for accessing a web service.

In my code, I’m calling this service in the following way:

 

 

 

SforceService SFSevice = new SforceService();

LoginResult loginResult = SFSevice.login(userName, password);

 

LeadImporterExternalService myService = new LeadImporterExternalService();

myService.Url = loginResult.serverUrl;

myService.SessionHeaderValue = new SessionHeader();

myService.SessionHeaderValue.sessionId = loginResult.sessionId;

 

string result = myService.importLead(xmlText);

 

 

 

But I keep getting an error SoapHeaderException: No operation available for request

{http://soap.sforce.com/schemas/class/LeadImporterExternal}importLead.

 

Can someone tell me why this is not working and what I’m doing wrong?

I’ll appreciate any help

Thanks!

I am trying to understand if the "Without sharing" keyword will allow me do accomplish something I am trying to do with a VF page with a custom controller.
What my goal is, is to send a link to a base user that includes a link to my custom VF page, and include an id to an object that they would not normally have visibility to, for example, opportunities.
 
According to Premier support, "without sharing" executes under the System User, ignoring all CRUD, field level and row-level security. 
 
This would seem to do what I am trying to do.  However, I get an insufficient privileges error when a base user tries to access the page with an object id that they don't normally have access to.
 
Is this NOT with the "with sharing" or "without sharing" mean?  If it isn't, what is the purpose of these keywords and how are they used?
 
Regards,
Jim
  • October 20, 2008
  • Like
  • 0