• Ashish P.
  • NEWBIE
  • 0 Points
  • Member since 2012
  • Business Analyst
  • Biogen Idec

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 7
    Replies

how to edit a picklist from a visualforce page and is there any contoller or apex class needed for customising the picklist in visualforce. If yes can anyone please illustrate it with an example.

 

Thank you in advance

how to edit a picklist from a visualforce page and is there any contoller or apex class needed for customising the picklist in visualforce. If yes can anyone please illustrate it with an example.

 

Thank you in advance

how to edit a picklist from a visualforce page and is there any contoller or apex class needed for customising the picklist in visualforce. If yes can anyone please illustrate it with an example.

 

Thank you in advance

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

 

 

I have to write a trigger that updates the filed when the record type field is filled. Following is the trigger I wrote but dont know why it is not working. can any one help:

 

trigger name on Object__c (after insert, after update, before insert, before update) {
// for food test date = abc last test date

// query for all record type = food test

}

 

Can any one please help me to write a trigger:

 

I have to write a trigger that can Pick the latest date of inspection form record type (FSE) and update it to the filed (FSE last performed date)

how to edit a picklist from a visualforce page and is there any contoller or apex class needed for customising the picklist in visualforce. If yes can anyone please illustrate it with an example.

 

Thank you in advance

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

I had created a visualforce page name resolutin and has a field name status

        Status field has nine picklist option includind closed

The is a resolution controler class i had created.

 

following is the visualforce page page block section that has status field:

 

<apex:pageBlockSectionItem />

<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>

 

AND FOLLOWING IS THE CASE CONTOLLER:

 

//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();

if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;

this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;

resultSize = 0;

 

 

I have to write a trigger that updates the filed when the record type field is filled. Following is the trigger I wrote but dont know why it is not working. can any one help:

 

trigger name on Object__c (after insert, after update, before insert, before update) {
// for food test date = abc last test date

// query for all record type = food test

}

 

Hi all i have this trigger where i want to update some values on an opp based on values in the opps line items but im getting the "maximum trigger depth exceeded" error but i dont really know how to resolve it, can anyone see what i can do here?

 

trigger opportunitySubTotalSummaryTrigger2 on Opportunity (after insert, after update)
{
    list<id> OppIds = new list<id>();
    list<Opportunity> oppsWithLineItems = new list<Opportunity>();
    list<Opportunity> oppsToUpdate = new list<Opportunity>();
    
    for(Opportunity o : trigger.new)
    {
        if(o.HasOpportunityLineItem == true)
            OppIds.add(o.id);        
    }
    
    oppsWithLineItems = [Select o.System_Revenue_2__c, System_Margin_2__c, CS_Revenue_2__c, CS_Margin_2__c, PS_Revenue_2__c, PS_Margin_2__c, o.Name, o.Id, (Select Id, OpportunityId, SortOrder, PricebookEntryId, CurrencyIsoCode, Quantity, TotalPrice, UnitPrice, ListPrice, ServiceDate, Description, Unit_Cost_Price__c, Unit_List_Price__c, Vendor_Quote_Reference__c, Vendor_Registration__c, Total_Cost_Price__c, Total_List_Price__c, Total_Sell_Price__c, Total_Product_Margin__c, Margin_percent__c, Test_Type__c, Type__c, CS_Revenue__c, CS_Margin__c, System_Revenue__c, PS_Margin__c, PS_Revenue__c, System_Margin__c, Other_Revenue__c, Other_Margin__c From OpportunityLineItems) From Opportunity o where o.HasOpportunityLineItem = true and id in :oppIds];
    
    for(Opportunity o : oppsWithLineItems)
    {
        for(OpportunityLineItem oli : o.OpportunityLineItems)
        {
            o.System_Revenue_2__c += oli.System_Revenue__c;
        }
    }
    update(oppsWithLineItems);
}

 

Thanks All