You need to sign in to do that
Don't have an account?
Get help in update the records !!
Hi All,
Please look inot the below code:
I am trying to update the specimen data but its not updating, I am not getting any error nothing , I have higlihted the code,,, The record which I am updating from text box not updating in the object please look inot it, I placed only required code !! becuse of chr limit
Regards
Raman
<apex:page standardController="Case_Accession__c" extensions="GenerateCaseNumber" >
<apex:form >
<apex:pageblock title="Accessioning" >
<apex:outputPanel id="detail1">
<apex:pageBlockSection id="pageBlockProcessed" rendered="{!RenderedSpecimen}">
<style type="text/css">
.dateFormat{float:left; display:inline-block; clear:both}
th{white-space: normal;}
</style>
<table cellspacing="0">
<tr>
<th style="text-align:center"> Tissue Type </th>
<th style="text-align:center"> Specimen Site</th>
<th style="text-align:center"> Transport Container/ Medium</th>
<th style="text-align:center"> Pieces Received </th>
<th style="text-align:center"> Specimen Description/ Procedure </th>
<th style="text-align:Center"> Collection Date</th>
<th style="text-align:center"> Recieved Date</th>
<th style="text-align:center"> Request Date</th>
<th style="text-align:center"> Test </th>
</tr>
<tr>
<td>
<table>
<tbody>
<apex:selectList multiselect="false" size="1" value="{!SelectedTissueType}" >
<apex:selectOptions value="{!TissueTypeOption }"/>
</apex:selectList>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:selectList multiselect="false" size="1" value="{!SelectedSpecimenSite}" >
<apex:selectOptions value="{!SpecimenSiteOption }"/>
</apex:selectList>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:selectList multiselect="false" size="1" value="{!SelectedTransportType}" >
<apex:selectOptions value="{!TransportTypeOption }"/>
</apex:selectList>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:inputText id="txtPiecesRecieved" value="{!SpecimenPiecesRecieved}" />
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:inputTextarea id="txtSpecimenDescription" value="{!SpecimenDescription}" />
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:pageBlockSectionItem >
<apex:inputField value="{!objSpecimen.CollectedDate__c}"/>
</apex:pageBlockSectionItem>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:pageBlockSectionItem >
<apex:inputField value="{!objSpecimen.ReceivedDate__c}"/>
</apex:pageBlockSectionItem>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:pageBlockSectionItem >
<apex:inputField value="{!objSpecimen.RequestDate__c}"/>
</apex:pageBlockSectionItem>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<apex:selectList multiselect="false" size="1" value="{!seletedTestValue}" >
<apex:selectOptions value="{!LoadTests }"/>
</apex:selectList>
</tbody>
</table>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:outputPanel>
VF Code
public with sharing class GenerateCaseNumber
{
public GenerateCaseNumber(ApexPages.StandardController controller)
{
objPatient = new Patient__c();
objAccession = new Case_Accession__c();
objCaseType = new CaseType__c();
objSpecimen = new Specimen__c();
objApcase = new ApCase__c();
selectedValue ='testing';
objComment = new Comment__c();
objLabs = new Lab__c();
objClients = new Client__c();
objPhysician = new Physician__c();
objFacility = new Facilty__c();
objPatientList = new List<Patient__c>();
objSpecimenTestOrder = new Specimen_TestOrdered__c();
var = ApexPages.currentPage().getParameters().get('field1');
if (var ==null || var=='')
{
TestEditAccession = 'No ID';
}
else
{
TestEditAccession = var ;
Load_Lab_Client_Facility_Physician(var);
}
}
public void Load_Lab_Client_Facility_Physician(string AccessionID)
{
objAccession = [select Lab__c,Facilty__c,Name,Client__c,Physician__c,RequisitionNo__c ,Patient__c from Case_Accession__c where id = :AccessionID];
objPatient = [select ID, FirstName__c,MiddleName__c,LastName__c,Address__c,Country__c,State__c,City__c,Gender__c ,DOB__c from Patient__c where id =:objAccession.Patient__c];
objApcase = [select ID, Case_Accession__c,CaseNo__c,CaseType__c from Apcase__c where Case_Accession__c =:AccessionID];
objSpecimen = [select id , ApCase__c,BodySite__c,Description__c,CollectedDate__c,PiecesReceived__c,ReceivedDate__c,RequestDate__c,SpecimenType__c,TransportType__c from Specimen__c where Apcase__c=:objApcase.ID];
objSpecimenTestOrder = [select id, Test__c from Specimen_TestOrdered__c where Specimen__c=:objSpecimen .id ];
if([select ID,CommentName__c from Comment__c where Case_Accession__c =:AccessionID].Size()==1)
{
objComment = [select ID,CommentName__c from Comment__c where Case_Accession__c =:AccessionID];
}
seletedTestValue = objSpecimenTestOrder.Test__c;
SelectedSpecimenSite = objSpecimen.BodySite__c;
SpecimenDescription = objSpecimen.Description__c;
SpecimenPiecesRecieved = String.Valueof(objSpecimen .PiecesReceived__c);
SelectedTissueType = objSpecimen.SpecimenType__c ;
SelectedTransportType = objSpecimen.TransportType__c;
SpecimenID = objSpecimen.ID;
txtboxSpecimenID = SpecimenID;
selectedValue = objApcase.CaseType__c;
CheckCaseType = false;
TestFinalCaseNumber = objApcase.CaseNo__c;
LabSelectedValue= objAccession.Lab__c;
ClientselectedValue = objAccession.Client__c;
Facilityselectedvalue = objAccession.Facilty__c;
Physicianselectedvalue= objAccession.Physician__c;
PatientID = objAccession.Patient__c;
}
public GenerateCaseNumber ()
{}
public Patient__c objPatient {get;set;}
Public List<Patient__C> objPatientList {get; set;}
public Case_Accession__c objAccession {get;set;}
public CaseType__c objCaseType {get;set;}
public Specimen__c objSpecimen {get;set;}
public Specimen_TestOrdered__c objSpecimenTestOrder {get;set;}
public CaseType__c CaseSpecimenList {get; set;}
public Comment__c objComment{get;set;}
public string selectedValue{get;set;}
public Apcase__c objApcase {get;set;}
public string LabSelectedvalue {get;set;}
public Lab__c objLabs {get;set;}
public string ClientselectedValue{get;set;}
public Client__c objClients {get;set;}
public string Facilityselectedvalue{get;set;}
public string Physicianselectedvalue{get;set;}
public Facilty__c objFacility {get;set;}
public Physician__c objPhysician{get;set;}
Public String inputValue {get; set;}
public string SearchPatient{get;set;}
public string PatientID{get;set;}
public string SpecimenID = '';
public string testPatientid{get;set;}
public string returnPatientID ;
public string TestFinalCaseNumber{get;set;}
public string TestCaseNumber {get;set;}
public string CaseNumber;
public string SpecimenDescription{get;set;}
public string SpecimenPiecesRecieved {get;set;}
public string SelectedTissueType {get;set;}
public string SelectedSpecimenSite{get;set;}
public string SelectedTransportType {get;set;}
public string seletedTestValue {get;set;}
public List<Test__c> TestList;
public string txtboxSpecimenID {get;set;}
public PageReference save()
{
try
{
objLabs = [select ID from Lab__c where ID=:LabSelectedvalue];
objClients = [select id from Client__c where ID=:ClientselectedValue];
objFacility = [select id from Facilty__c where ID=:Facilityselectedvalue];
objPhysician= [select id from Physician__c where ID=:Physicianselectedvalue ];
insertPatient();
upsert objPatient;
objAccession.Patient__c = objPatient.id;
objAccession.Lab__c = objLabs.id;
objAccession.Client__c = objClients.id;
objAccession.Facilty__c = objFacility.id;
objAccession.Physician__c = objPhysician.id;
if (var ==null || var=='')
{
Insert objAccession;
}
else
{
objAccession.id = var;
update objAccession;
}
objComment.Case_Accession__c = objAccession.id;
Insert objComment;
objApcase = new ApCase__c();
objApcase.Case_Accession__c = objAccession.id;
objApcase.CaseType__c = selectedValue;
objApcase.CaseNo__c = TestFinalCaseNumber;
insert objApcase;
objSpecimen.Description__c = SpecimenDescription;
objSpecimen.PiecesReceived__c = Decimal.Valueof(SpecimenPiecesRecieved) ;
objSpecimen.BodySite__c = SelectedSpecimenSite;
objSpecimen.TransportType__c = SelectedTransportType;
objSpecimen.SpecimenType__c = SelectedTissueType ;
if(SpecimenID!= '')
{
objSpecimen.Apcase__c = objApcase.id;
objSpecimen.ID = SpecimenID ;
}
upsert objSpecimen;
objSpecimenTestOrder.Specimen__c = objSpecimen.id;
objSpecimenTestOrder.Test__c = seletedTestValue;
insert objSpecimenTestOrder;
}
catch(Exception ex)
{
System.debug('\n\nException ='+ex.getMessage()+'\n\n');
}
return Null;
}
public List<selectOption> TransportTypeOption
{
get
{
string casetypeId = selectedValue;
List<CaseTypeSpecimenTransport__c> CaseTypeSpecimenTransportList = [select TransportType__c from CaseTypeSpecimenTransport__c where CaseType__c =:casetypeId ];
List<selectOption> TrasnportTypeName =new List<selectOption>();
TrasnportTypeName .add(new selectOption('None', 'None'));
for(integer i = 0 ; i<CaseTypeSpecimenTransportList.Size();i++)
{
TransportTypeList= [select ID , SpecimenTransportName__c from TransportType__c where id=:CaseTypeSpecimenTransportList[i].TransportType__c];
for (TransportType__c ttn:TransportTypeList)
TrasnportTypeName .add(new selectOption(ttn.ID, ttn.SpecimenTransportName__c));
}
return TrasnportTypeName ;
}
private set;
}
public List<selectOption> LoadTests
{
get
{
string casetypeId = selectedValue;
List<CaseTypeTests__c> CaseTypeTestsList = [select Test__c from CaseTypeTests__c where CaseType__c =:casetypeId ];
List<selectOption> TestsName =new List<selectOption>();
TestsName.add(new selectOption('None', 'None'));
for(integer i = 0 ; i<CaseTypeTestsList.Size();i++)
{
TestList= [select ID , TestName__c from Test__c where id=:CaseTypeTestsList [i].Test__c];
for (Test__c ttn: TestList)
TestsName.add(new selectOption(ttn.ID, ttn.TestName__c));
}
return TestsName;
}
private set;
}
}