• suneilchetlur
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies

HI there,

 

I have a trigger on opportunity(after update) which in my scenario fires when the 'contract duration' field is changed on opp  page.What the trigger does is that it deletes all the opp lineitem schedules and creates new ones based on the contract duration(the value indicates the number of schedules) for each opp line item.

All of this function is working fine but there is just one thing that has put me in a fix here.THe new schedules that are created has quantity as zero.What i noticed with debug logs is that when you delete opp schedules of a particular opp line item the opp line item quantity becomes zero.However,I want to use the same quantity while creating the new opp line item schedules.I tried a few things but nothing seems to work fine and I am still getting the quantity as zero.The schedules are however getting created(the right number,the right schedule dates but quantity zero).

 

There's one thing i noticed when i manually delete the opp line item schedules from the layout the quantity field of opp line item doesn't get affected(it doesnt become zero).

 

Any suggestoins on how to capture the quantity of the line item so that even when schedules are deleted the quantity value remains intact on the line item(so that it can be used while inserting new line item schedules).

 

Note:I am referring to quantity schedules here.

 

Thanks in  advance,

 

Suneil

Hello there,

 

I have a visualforce page which contains a table displaying opportunitylineitemss of a particular opportunity.

I have a couple of fields in the table in the visualforce page which i want to compare upon saving and if they are not having the same values then

I have a requirement which is that everytime i click save button in the page i want a pop up which says these two fields have different values confirm whether i want to save (yes or no) .

 

note-i have a controller in place from which the values are taken and displayed in the visualforce page. 

 

Any idea how to go about this problem?

 

thanks in advance

suneil

Hello there,

 

I have a custom button on opportunity standard page which when clicked displays a visualforce page.

This button should call the page only when a couple of fields on the opportunity page are correctly populated.Say field x and y.

Now I want to have a validation rule or some error message to be displayed on clicking the button whenever x and y are not properly filled.

 

Note- this custom button is present only on certain opportunity record types and not all.

 

Any suggestions would be highly appreciated.

 

Thanks in advance,

 

Suneil

 

<apex:page standardController="opportunity" tabStyle="opportunity" extensions="mySecondController"> <style> .locationError { color: blue; font-weight: strong;} </style> <apex:form > <!--<apex:messages /--> <apex:pageBlock title="opp line items" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="top" > <apex:commandButton value="Save" action="{!saveChanges}" rerender="main" status="ajaxStatus"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionStatus id="ajaxStatus" startText="Updating line items..."> </apex:actionStatus> <!--<apex:outputPanel layout="block" style="overflow:auto;width=750px;height=250px">--> <!--div style="overflow:auto;width=750px;height=250px"--> <apex:pageBlockTable value="{!secondcontroller}" var="oli"> <apex:column id="thename" headerValue="Name"> {!oli.transcript2.PriceBookEntry.Product2.Name} </apex:column> <apex:column > <apex:facet name="header"><b>Schedules</b></apex:facet> <apex:repeat value="{!oli.trainee2}" var="b"> <apex:inputField value="{!b.quantity}"/> </apex:repeat> </apex:column> <apex:column title="This is the total quantity" headerValue="Quantity Sum"> {!oli.transcript2.Quantity} </apex:column> <apex:column title="This is the total quantity" headerValue="Quantity{!oli.tr2.Unit_Of_Measure__c}" footervalue="{!total.quantity}"> <apex:inputField value="{!oli.transcript2.quantity}" id="Custon_validation"/> </apex:column> <apex:column > {!oli.tr2.Unit_Of_Measure__c} </apex:column> <apex:column headerValue="Unit Sales Price" > <apex:inputField value="{!oli.transcript2.UnitPrice}"/> </apex:column> <apex:column headerValue="LineDesc" > <apex:inputField value="{!oli.transcript2.description}"/> </apex:column> <apex:message for="Custon_validation" styleClass="locationError"/><p/> </apex:pageBlockTable> <!--</apex:outputPanel>--> </apex:pageBlock> </apex:form> </apex:page>

 

Hi there,

 

I have a requirement where I have to display different column header names for the different columns generated using apex:repeat in a visualforce table.I have not been able to figure out how to do this.Any help would be much appreciated.

I am using apex:repeat for fetching the values of the opportunitylineitemschedules against each opportunitylineitem in the table.I am getting the values correctly.But for each opportunitylineitemschedule column I need a header name as the schedule date for the opplineitemschedule(which btw wud remain same for each column)>Currently I can show only one header name using facet header but I want to be able to show different names for different columns.

 Here's my VF page:

 

 

Hi Ther,

 

I am trying to build a visualforce page which is rendered when a custom button on an opportunity page is clicked.

 The idea of the VF page is to have a table which lists all the opportunitylineitems(products) and opportunitylineitemschedules(quantity fiield).

I have been able to create this table in VF and have been able to succesfully show the lineitems and schedule quantity values in the page.However,what is happening now is that suppose an opportunitylineitem(product) contains three schedules,in the page i am getting three rows with product name and schedule quantity.What i want is that alongside this particular lineitem i should have these three lineitemschedule quantities in three columns in a single row instead of three rows.

 

Any help would be highly appreciated as this is an urgent requirement i have.Here's the controller code and VF page:

 

 

 

 

 

 

 

 

 

 

<apex:page standardController="opportunity" tabStyle="opportunity" extensions="mySecondController"> <apex:form > <apex:pageBlock title="opp line items" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="top" > <apex:commandButton value="Save" action="{!saveChanges}" rerender="main" status="ajaxStatus"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionStatus id="ajaxStatus" startText="Updating line items..."> </apex:actionStatus> <apex:pageBlockTable value="{!mySecondController}" var="oli" columns="8"> <apex:column headerValue="Name"> {!oli.transcript.PriceBookEntry.Product2.Name} </apex:column> <apex:column > <apex:facet name="header"><b>QUARTER</b></apex:facet> <apex:inputField value="{!oli.trainee.quantity}"/> </apex:column> <!--</apex:panelgrid>--> <!-- <apex:column headerValue="Quarter2" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column> <apex:column headerValue="Quarter3" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column> <!--<apex:column headerValue="Quarter4" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column>--> <apex:column headerValue="Sum of Products per quarter"> {!oli.transcript.Quantity} </apex:column> <apex:column headerValue="Quantity" footervalue="{!total.quantity}"> <apex:inputField value="{!oli.transcript.quantity}"/> </apex:column> <apex:column headerValue="Sales Price" > <apex:inputField value="{!oli.transcript.UnitPrice}"/> </apex:column> <apex:column headerValue="LineDesc" > <apex:inputField value="{!oli.transcript.description}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public class mySecondController { opportunity proj; opportunity []proj1; opportunitylineitem []oppli; opportunitylineitemschedule []o12; public opportunity tp { get; set; } public opportunitylineitem transcript { get; set; } public opportunitylineitemschedule trainee { get; set; } public mySecondController(opportunity tp1, opportunitylineitem trans1,opportunitylineitemschedule p) { tp = tp1; transcript = trans1; trainee = p; } public Opportunitylineitem total { get; private set; } public Opportunitylineitemschedule quart { get; private set; } public class myexception extends exception{} list<mySecondController> result=new list<mySecondController>(); list<mySecondController> result1=new list<mySecondController>(); public mySecondController(ApexPages.StandardController controller){ myexception e=new myexception('wromg feed'); this.proj = (opportunity)controller.getSubject(); proj1=[select id,amount_type__c from opportunity where id=:this.proj.id]; this.oppli=[select quantity,opportunityid,Id,PriceBookEntry.Product2.Name,UnitPrice,Description, PricebookEntryId from opportunitylineitem where opportunityid =:this.proj.id]; list<id>b=new list<id>(); for(opportunitylineitem o1235:this.oppli) b.add(o1235.id); this.o12 =[select scheduledate,quantity,id,opportunitylineitemid from opportunitylineitemschedule where opportunitylineitemid in:b]; this.total = new Opportunitylineitem(quantity = 0); this.quart=new opportunitylineitemschedule(quantity =0); list<id>list1=new list<id>(); try{ for(opportunity opportun:this.proj1){ if(opportun.amount_type__c=='One Time - Auto - Monthly'){ opportunitylineitem curTrans; for(Opportunitylineitem o3:this.oppli) { curTrans= o3; if((o3.quantity != null)) { total.quantity += o3.quantity; } opportunitylineitemschedule []olis10=[select scheduledate,quantity,id,opportunitylineitemid from opportunitylineitemschedule where opportunitylineitemid =:o3.id]; opportunitylineitemschedule curTrainingPath; list<opportunitylineitemschedule> li =new list<opportunitylineitemschedule>(); for(opportunitylineitemschedule olis:this.o12){ if(olis.opportunitylineitemid ==curTrans.id ){ curTrainingPath=olis; result.add(new mySecondController(opportun,curTrans,curTrainingPath)); } } } } } } catch(exception e1) { system.debug('<<<<<'+e1); } } public mySecondController[] getmySecondController() { return result; } public opportunitylineitem getol(){ return this.total; } public opportunitylineitemschedule get1ols() { return this.quart; } // Action Method called from page button public pagereference saveChanges() { upsert this.oppli; upsert this.o12; PageReference oppPage = new ApexPages.StandardController(this.proj).view(); oppPage.setRedirect(true); return oppPage; return null; } public opportunity getOpp() { return [select id, name,amount_type__c, (select id,PriceBookEntry.Product2.Name,Quantity,UnitPrice,Description,PricebookEntryId from OpportunityLineItems limit 5) from opportunity where id =:System.currentPageReference().getParameters().get('id')]; } }

 

 

Regards,

Suneil

Hello there,

 

I have a visualforce page which contains a table displaying opportunitylineitemss of a particular opportunity.

I have a couple of fields in the table in the visualforce page which i want to compare upon saving and if they are not having the same values then

I have a requirement which is that everytime i click save button in the page i want a pop up which says these two fields have different values confirm whether i want to save (yes or no) .

 

note-i have a controller in place from which the values are taken and displayed in the visualforce page. 

 

Any idea how to go about this problem?

 

thanks in advance

suneil

Hello there,

 

I have a custom button on opportunity standard page which when clicked displays a visualforce page.

This button should call the page only when a couple of fields on the opportunity page are correctly populated.Say field x and y.

Now I want to have a validation rule or some error message to be displayed on clicking the button whenever x and y are not properly filled.

 

Note- this custom button is present only on certain opportunity record types and not all.

 

Any suggestions would be highly appreciated.

 

Thanks in advance,

 

Suneil

Hi Ther,

 

I am trying to build a visualforce page which is rendered when a custom button on an opportunity page is clicked.

 The idea of the VF page is to have a table which lists all the opportunitylineitems(products) and opportunitylineitemschedules(quantity fiield).

I have been able to create this table in VF and have been able to succesfully show the lineitems and schedule quantity values in the page.However,what is happening now is that suppose an opportunitylineitem(product) contains three schedules,in the page i am getting three rows with product name and schedule quantity.What i want is that alongside this particular lineitem i should have these three lineitemschedule quantities in three columns in a single row instead of three rows.

 

Any help would be highly appreciated as this is an urgent requirement i have.Here's the controller code and VF page:

 

 

 

 

 

 

 

 

 

 

<apex:page standardController="opportunity" tabStyle="opportunity" extensions="mySecondController"> <apex:form > <apex:pageBlock title="opp line items" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="top" > <apex:commandButton value="Save" action="{!saveChanges}" rerender="main" status="ajaxStatus"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionStatus id="ajaxStatus" startText="Updating line items..."> </apex:actionStatus> <apex:pageBlockTable value="{!mySecondController}" var="oli" columns="8"> <apex:column headerValue="Name"> {!oli.transcript.PriceBookEntry.Product2.Name} </apex:column> <apex:column > <apex:facet name="header"><b>QUARTER</b></apex:facet> <apex:inputField value="{!oli.trainee.quantity}"/> </apex:column> <!--</apex:panelgrid>--> <!-- <apex:column headerValue="Quarter2" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column> <apex:column headerValue="Quarter3" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column> <!--<apex:column headerValue="Quarter4" footervalue="{!oli.Quantity}"> <apex:inputField value="{!oli.Quantity}"/> </apex:column>--> <apex:column headerValue="Sum of Products per quarter"> {!oli.transcript.Quantity} </apex:column> <apex:column headerValue="Quantity" footervalue="{!total.quantity}"> <apex:inputField value="{!oli.transcript.quantity}"/> </apex:column> <apex:column headerValue="Sales Price" > <apex:inputField value="{!oli.transcript.UnitPrice}"/> </apex:column> <apex:column headerValue="LineDesc" > <apex:inputField value="{!oli.transcript.description}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public class mySecondController { opportunity proj; opportunity []proj1; opportunitylineitem []oppli; opportunitylineitemschedule []o12; public opportunity tp { get; set; } public opportunitylineitem transcript { get; set; } public opportunitylineitemschedule trainee { get; set; } public mySecondController(opportunity tp1, opportunitylineitem trans1,opportunitylineitemschedule p) { tp = tp1; transcript = trans1; trainee = p; } public Opportunitylineitem total { get; private set; } public Opportunitylineitemschedule quart { get; private set; } public class myexception extends exception{} list<mySecondController> result=new list<mySecondController>(); list<mySecondController> result1=new list<mySecondController>(); public mySecondController(ApexPages.StandardController controller){ myexception e=new myexception('wromg feed'); this.proj = (opportunity)controller.getSubject(); proj1=[select id,amount_type__c from opportunity where id=:this.proj.id]; this.oppli=[select quantity,opportunityid,Id,PriceBookEntry.Product2.Name,UnitPrice,Description, PricebookEntryId from opportunitylineitem where opportunityid =:this.proj.id]; list<id>b=new list<id>(); for(opportunitylineitem o1235:this.oppli) b.add(o1235.id); this.o12 =[select scheduledate,quantity,id,opportunitylineitemid from opportunitylineitemschedule where opportunitylineitemid in:b]; this.total = new Opportunitylineitem(quantity = 0); this.quart=new opportunitylineitemschedule(quantity =0); list<id>list1=new list<id>(); try{ for(opportunity opportun:this.proj1){ if(opportun.amount_type__c=='One Time - Auto - Monthly'){ opportunitylineitem curTrans; for(Opportunitylineitem o3:this.oppli) { curTrans= o3; if((o3.quantity != null)) { total.quantity += o3.quantity; } opportunitylineitemschedule []olis10=[select scheduledate,quantity,id,opportunitylineitemid from opportunitylineitemschedule where opportunitylineitemid =:o3.id]; opportunitylineitemschedule curTrainingPath; list<opportunitylineitemschedule> li =new list<opportunitylineitemschedule>(); for(opportunitylineitemschedule olis:this.o12){ if(olis.opportunitylineitemid ==curTrans.id ){ curTrainingPath=olis; result.add(new mySecondController(opportun,curTrans,curTrainingPath)); } } } } } } catch(exception e1) { system.debug('<<<<<'+e1); } } public mySecondController[] getmySecondController() { return result; } public opportunitylineitem getol(){ return this.total; } public opportunitylineitemschedule get1ols() { return this.quart; } // Action Method called from page button public pagereference saveChanges() { upsert this.oppli; upsert this.o12; PageReference oppPage = new ApexPages.StandardController(this.proj).view(); oppPage.setRedirect(true); return oppPage; return null; } public opportunity getOpp() { return [select id, name,amount_type__c, (select id,PriceBookEntry.Product2.Name,Quantity,UnitPrice,Description,PricebookEntryId from OpportunityLineItems limit 5) from opportunity where id =:System.currentPageReference().getParameters().get('id')]; } }

 

 

Regards,

Suneil

Hi everyone,

I have to build a table that represents an activity summary for a month. That is, I have up to 31 columns for each days in the month and a dozen lines for each type of activity, and for each line and column I have an input field.
Is that possible generate dynamically the column on page load ?

I would like to avoid copying/pasting 31 times the same column and also I would like to avoid creating an accessor method for each column.

It brings my second question : is that possible, in an visualforce "{! }" markup to call methods of the controller by passing the method one or more parameter ?

For example, I'd like a method valueForColumn(Integer index) that returns the value of the column "index" and put one column on my VF page that will be reproduced as much as I need with the value changing depending on the index of the column.

Thanks in advance.