• Slava Ram
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
Hello everybody!
Here my example:

public class DemoController {

public List<User> mRecords { get; set; }
private Integer mRecordsCount { get; set; }

public ADemoController() {
  mRecordsCount = 1;
  mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}

public void loadOneMoreRecord() {
  mRecords.clear();
  mRecordsCount++;
  mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}

}


<apex:page controller="DemoController" >

<apex:pageMessages />

<apex:form id="TheForm">
  <apex:pageBlock id="TheBlok">
   <apex:commandButton value="Load one more record" action="{!loadOneMoreRecord}" reRender="TheTable" />
   <apex:pageBlockTable value="{!mRecords}" var="record" id="TheTable">
    <apex:column headerValue="Records">
     <apex:outputLink value="/{!record.Id}"><apex:outputText value="{!record.FirstName}" /></apex:outputLink>
    </apex:column>
   </apex:pageBlockTable>
  </apex:pageBlock>
</apex:form>
 
</apex:page>

After first page loading the link is work fine, but after loading more records in table, links became dead (works only through rmc).
The question is how can I prevent this?

Sorry for my english.
Hello everybody!
Here my example:

public class DemoController {

public List<User> mRecords { get; set; }
private Integer mRecordsCount { get; set; }

public ADemoController() {
  mRecordsCount = 1;
  mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}

public void loadOneMoreRecord() {
  mRecords.clear();
  mRecordsCount++;
  mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}

}


<apex:page controller="DemoController" >

<apex:pageMessages />

<apex:form id="TheForm">
  <apex:pageBlock id="TheBlok">
   <apex:commandButton value="Load one more record" action="{!loadOneMoreRecord}" reRender="TheTable" />
   <apex:pageBlockTable value="{!mRecords}" var="record" id="TheTable">
    <apex:column headerValue="Records">
     <apex:outputLink value="/{!record.Id}"><apex:outputText value="{!record.FirstName}" /></apex:outputLink>
    </apex:column>
   </apex:pageBlockTable>
  </apex:pageBlock>
</apex:form>
 
</apex:page>

After first page loading the link is work fine, but after loading more records in table, links became dead (works only through rmc).
The question is how can I prevent this?

Sorry for my english.
Hi everybody , I have troubles with my code.
What I have to do is update a Field in a object with the same field taken from another object.

I'm trying this with a trigger , here's the code below :

trigger TriggerCreateTaskBroker on Candidatura_Tenant__c (after update)
{
  for (Integer i = 0; i < Trigger.new.size(); i++) 
   {
        if (Trigger.new[i].selected__c != Trigger.old[i].selected__c && Trigger.old[i].selected__c == null && Trigger.new[i].selected__c == 'Si')
      {
          Task_apt__c obj = new Task_apt__c();
          obj.type__c = 'Attivazione Playourhouse';
          obj.responsabile__c = Trigger.old[i].agente_cand__c;
          obj.RecordTypeId = '012a0000001WEaI';
          obj.task_desc__c = 'prova trigger roger x agente';
          obj.phone__c = 20142014;
          insert obj;
          //BookInsert.put(obj.id,obj);
      }
   }
}

The problem is that in the class test, the assert that I've set is wrong,Expected 0, actual 1. So, probably my trigger doesn't do what  have to do.
Anybody has some idea to solve my problem?
thsnk you in advance
Hi I am trying to understand below given code from teh visual force book.I am stuck at one place and i do not find information on that.

I am struggling to understand the lines underlined in the code:-

1) What does filterid signify here.I assume it should either be a method of the case class or some variable.I am not sure what it s.if it is one of these then where can I get information about them.

<apex:selectList value="{!filterId}" size="1">

2) I do  not understand {!listviewoptions} options .Can somebody please help?

<apex:selectOptions value="{!listviewoptions}"/>


<apex:page standardController="Case" recordSetvar="cases">
    <apex:pageBlock>
        <apex:form id="theForm">
            <apex:panelGrid columns="2">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                </apex:selectList>
            </apex:panelGrid>
            <apex:pageBlockSection>
                <apex:dataList var="c" value="{!cases}" id="list">
                {!c.subject}
                </apex:dataList>
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>
</apex:page>
I want to create a relationship between two contacts and have the relationship listed in the same related list on both contacts.

I created a relationship junction record using 2 lookup fields to the contact object. When I create the record it wont display the relation in the same related list on each object. In order to do that, upon creating the relationship record I need apex to duplicate the record and at the same time insert the same fields for the lookup but just switch them around, contact "A" and contact "B" should switch positions on the duplicate.

I tried writing some apex put im having trouble withe the creation of a new record, as opposed to an update on the current one.

trigger NewRelationship on Relationship__c (after insert) {
    List<relationship__c> NewRelationship = new List <relationship__c> ();

    for (relationship__c x : Trigger.new) {
        relationship__c NewRec = new relationship__c();
        NewRec.First_person_in_relationship__c = x.Second_person_in_relationship__c;
        NewRec.First_person_is_second_persons__c = x.Second_Person_is_first_persons__c;
        NewRec.Second_person_in_relationship__c = x.First_person_in_relationship__c;
        NewRec.Second_Person_is_first_persons__c = x.First_person_is_second_persons__c;
        newRelationship.add(NewRec);
   }
   INSERT newRelationship;
}

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger NewRelationship caused an unexpected exception, contact your administrator: NewRelationship: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, NewRelationship: maximum trigger depth exceeded Relationship trigger event AfterInsert for [a002000000VpusW] Relationship trigger event AfterInsert for [a002000000VpusX] Relationship trigger event AfterInsert for [a002000000VpusY] Relationship trigger event AfterInsert for [a002000000VpusZ] Relationship trigger event AfterInsert for [a002000000Vpusa] Relationship trigger event AfterInsert for [a002000000Vpusb] Relationship trigger event AfterInsert for [a002000000Vpusc] Relationship trigger event AfterInsert for [a002000000Vpusd] Relationship trigger event AfterInsert for [a002000000Vpuse] Relationship trigger event AfterInsert for [a002000000Vpusf] Relationship trigger event AfterInsert for [a002000000Vpusg] Relationship trigger event AfterInsert for [a002000000Vpush] Relationship trigger event AfterInsert for [a002000000Vpusi] Relationship trigger event AfterInsert for [a002000000Vpusj] Relationship trigger event AfterInsert for [a002000000Vpusk] Relationship trigger event AfterInsert for [a002000000Vpusl]: []: Trigger.NewRelationship: line 18, column 1