function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Urgent : Name issue of list element

Hello friends,


I amhaving the list of  custom object t which i want to give numbers bt all the time it is giving me list of work order of same name.

public static integer c=0;
public ID QID {get; set;}
public List<ID> ProdList=new List<ID>();
public Work_Orders__c wo = new Work_Orders__c();
public list< Work_Orders__c> wos = new list<Work_Orders__c>();
public list<Work_Orders__c> woinsert = new list<Work_Orders__c>();
public Quote q = new Quote();
Public list<QuoteLineItem> QlIm=new list<QuoteLineItem>();
public list <Work_Schedule__c> wslist=new list<Work_Schedule__c>();
public list <Work_Schedule__c> wslist1=new list<Work_Schedule__c>();
public set<date> datelist=new set<date>();
public List<date> listdate=new List<date>();
integer i;
public void ConvertWorkOrder()
QID = ApexPages.currentPage().getParameters().get('ID');
QlIm=[ SELECT ListPrice, PricebookEntryId, Quantity, QuoteId, Id, UnitPrice FROM QuoteLineItem where QuoteId=:QID];
wslist=[select date__c,product__c,quote__c from Work_Schedule__c where quote__c =:QID and product__c!=null];
for(Work_Schedule__c w:wslist)


for(date d:datelist)

for(Work_Schedule__c ws:[select date__c,product__c,quote__c from Work_Schedule__c where quote__C=:QID and date__c=:listdate.get(i)])

system.debug('*******List of WOrk Order*********'+wslist1);
integer n=listdate.size();


for(quote q : [Select ID, Name, Description, Summary__c, Notes__c, OpportunityID, contactID, Opportunity.AccountId,Opportunity.Location__c from Quote where Id =: QID])
string name;
if(q != null)
wo.Quote__c = q.ID;




for(Work_Orders__c won:woinsert )
integer k;



Jeff MayJeff May

which object are you having problems with?


It sounds to me like you're having an issue with the viewstate between the controller and VFP...  This can be difficult without seeing the VFP.


The way I have fixed this with selectlists - which can have the same nasty problem of not getting the value to the controller once you enter it in the VFP, is as follows;


Define a simple function up in the apex:pageblock of the VFP:

 function callUpdate(){


In my case "Category" was what had to be updated -- I'm just cutting and pasting some of my code for you... Sorry, you'll have to modify it to your needs.


Next,  elsewhere on my VFP I call this javascript&colon;


 <apex:SelectList value="{!strMOPId}" size="1" onChange="callUpdate()" multiselect="false">
  <apex:selectOptions value="{!theXMOPItems}"/>
  </apex:SelectList> <br/>


...And just calling the javascript call "updateCategory" in the controller, the fields are synched.


There of course is an "UpdateCategory" function in the controller - but it just returned the pageref;


public PageReference updateCategory() {

  return Apexpages.currentPage();

 ...The trick in my particular case was I simply had to notify the controller that the page was "dirty".

If there's a better way to do this, I too am all ears.   I Hope you get more replies, but in the meantime,  I hope this idea helps.