• bibbi84
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi,

 

my issue is this : I have a simple pageblocktable with some records,when I remove one specific row from the table ... this work well for a moment, then my page is automatically reloaded with the complete pageblocktable and all the rows.

 

My wish is not delete a record, but to make impossible the view of a row.

 

This is the code of my controller: 

public with sharing class e2cprovasearchcontroller2 {

	public List<E2C_Email__c> emailsmod;
	
	
	public List<E2C_Email__c> getEmailsmod (){

	String id='500T0000004QpWr';

	this.emailsmod=[Select id,subject__c,FromName__c,Read__c,CreatedDate,CcAddress__c from E2C_Email__c where Case__c=:id ORDER BY CreatedDate DESC];

	return this.emailsmod;

	}


}

 

 

This is the code of my page : 

	<script
		src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" />
<script src="https://ajax.microsoft.com/ajax/jquery.ui/1.8.5/jquery-ui.js"/>
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/base/jquery-ui.css" />	
	
<script type="text/javascript"> 
	
	//modifico il selettore in modo da non avere conflitti con jquery.
	
 $j = jQuery.noConflict();
 	 
        
 function hiderows(){
 
 var prova= $j('#subject'+ 'a0TT0000003BMmGMAW').parent();
 
 var prova2=$j('#subject'+ 'a0TT0000003BMmGMAW').closest("tr");
 
 
prova2.remove();

 
 }       
        
</script>


	<apex:form >

		<apex:outputpanel >

			<apex:commandbutton value="prova" onclick="hiderows()" />

		</apex:outputpanel>



	</apex:form>
	<apex:outputpanel layout="block" style="overflow:auto;height:200px">
		<apex:pageBlock id="pb" mode="maindetail">
			<apex:pageBlockTable value="{!Emailsmod}" var="e" columns="5"
				cellspacing="5" onRowClick="show(this)">

				<apex:column headerValue="From" width="22%">
					<span id="from{!e.id}"> {!e.FromName__c} </span>
				</apex:column>
				<apex:column headerValue="Subject">
					<span id="subject{!e.id}"> {!e.Subject__c} </span>
				</apex:column>
				<apex:column headerValue="Date" width="7%">
					<span id="date{!e.id}"> <apex:outputText value="{0,date,dd/MM/yy hh:mm}">
						<apex:param value="{!e.CreatedDate}" />
					</apex:outputText> </span>
				</apex:column>

			</apex:pageBlockTable>
		</apex:pageBlock>


	</apex:outputpanel>

 

 

Thanks to all,

 

F.P.

Hi,

 

i am developing an application that is comparable to a email client.  I have a pageblocktable with the emails and various field of the single mail.

I have a formula field too. I use this field to call some images and use it to create the "outlook flag follow up"(on a object "Email__c" there is a field "flagstatus__c" and formula field "flag__c" ):

  1. If the flagstatus__c is  "NULL" -> GRAY FLAG 
  2. If the flagstatus__c is  "TO_DO"-> RED FLAG
  3. If the flagstatus__c is "COMPLETE" -> CHECK FLAG
CASE(FlagStatus__c , "TO_DO",IMAGE("/resource/FlagRed",""), "COMPLETE", IMAGE("/resource/FlagCompleted",""),IMAGE("/resource/FlagNull",""))

 

 

I have no button to rerender the value of this field but i call a remoteaction after click on the flag(now is in outputtext, but i think that with an outputfield i have the same result). The remote action update the value but this it is not rendered on the table in the page.

How i can render the value without using a button (with the option "rerender=")? The problem is that the remote action is asynchronous?

 

This is a part of the table :

 

<apex:pageBlockTable id="maintable" style="cursor:pointer" value="{!Emails}" var="e" columns="5" cellspacing="5"  onRowClick="show(this)" >


 <apex:column onclick="setRemoteFlagState('{!e.Id}');"   headerValue="State" width="4%"  >
				    	
				    	
				    	 <apex:outputText escape="false" value="{!e.Flag__c}"/>
				    	  	
				    </apex:column>



</apex:pageBlockTable>

 This is the remote action

 @RemoteAction
    global static String setFlagState(String emailId) {
    	List<E2C_Email__c> emails = [select FlagStatus__c from E2C_Email__c where Id = :emailId];
    	
    	if (emails.size() > 0) {
    		
    		if (emails.get(0).FlagStatus__c=='NULL'){
    		
    		emails.get(0).FlagStatus__c='TO_DO';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		else if (emails.get(0).FlagStatus__c=='TO_DO'){
    		
    		emails.get(0).FlagStatus__c='COMPLETE';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		else{
    		
    		emails.get(0).FlagStatus__c='NULL';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		
    		System.debug('stato email '+emails[0].read__c);
    		return emails[0].Read__c;
    	} else {
    		System.debug('Nessuna Email corrispondente');
    		return null;
    	}
    }

 This is the javascript code:

		function setRemoteFlagState(emailId) {
				    Visualforce.remoting.Manager.invokeAction(
				        '{!$RemoteAction.E2CViewEmail_ProvaController4.setFlagState}',
				        emailId, 
				        function(result, event){
				            if (event.status)
				                if (result.replace != null) {
				      
				      alert(result);
				      
				            } else if (event.type === 'exception') {
				                document.getElementById("responseErrors").innerHTML = event.message;
				            } else {
				                document.getElementById("responseErrors").innerHTML = event.message;
				            }
				            
				           
				        }, 
				        {escape: true}
				    );
		}   
        

 

Hi,

 

 

i am using the Email Services to create my application. Now i have a question, is possible to open an outlook email from apex?

I would to click on a button and open a mail in outlook.

 

 

Thanks to all,

 

F.P.

Hi,

 

this is my situation: I developed a custom visualforce page and I put it in a Standard Object Page (Case) as an Inline visualforce page.

On the inline visualforce page there is a button, when i click the button opens a modal pop-up made in jquery. 

The problem is that when the popup is open, it's possible to move it only by limits of the inline visualforce page, and not on all the browser page. It's possible refer to the Case Standard Page and move the modal popup on it??

 

Hi, 

 

i have some problems with the insert of many records of a custom object from a single visualforce page.

Now i explain the question : i have a custom Object ( Elaborato__c ) and i had build a controller extension for it. Well, when i try to create ( and save ) more than a Elaborato__c from a single visualforce page, i have an error :

 

first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]  

 

 

The reason,  i think( cause i see the view state of the page ), is that i create only one Elaborato__c and after the first Insert, the Id of the sObject remain the same for the second record too.

 

Now, one possible solution is make all with a custom controller, but by this way i lose all the advantages of using the Standard Controller of Elaborato__c.

 

public with sharing class ProvaDocenteController {

public List<Elaborato__c> lista;
	public Elaborato__c elaborato;
	public Docente__c docente{get;set;}
    public String email{get;set;}
    public String password{get;set;} 
    private boolean logged=false; 
    
    
     public ProvaDocenteController(ApexPages.StandardController controller){
    	
         
    	
    	this.elaborato = (Elaborato__c) controller.getRecord();
    	
    	
    	this.elaborato.titolo__c='Inserisci titolo';
    	this.elaborato.descrizione__c='Inserisci Descrizione';
    	this.elaborato.cdl__c='Ingegneria informatica';
    }
    
    
  
   
			
    
    public void save() {
    	
    	
    insert (elaborato);
    
    
	this.elaborato.titolo__c='Inserisci titolo';
	this.elaborato.dataProposta__c=System.today();
	this.elaborato.descrizione__c='Inserisci Descrizione';
	this.elaborato.cdl__c='Ingegneria informatica';
		

	}

	public List<Elaborato__c> getlista(){
		this.lista=new list<Elaborato__c>();
		if(this.logged!=false)
			this.lista=[SELECT name,titolo__c,descrizione__c,materia__r.nome__c,dataproposta__c, dataAssegnazione__c,dataArchiviazione__c,stato__c 
 			FROM Elaborato__c WHERE Docente__c=:this.docente.id  ORDER BY LastModifiedDate DESC  LIMIT 10 ];
		
		return lista;
	}

}

 

 

<apex:page sidebar="false" showHeader="false"
    standardController="Elaborato__c" extensions="ProvaDocenteController" 
    >

    <apex:composition template="UninaTemplate">

        <apex:define name="header">
            <apex:include pageName="header" />
        </apex:define>

        <apex:define name="body">

       
            <apex:form title="Pagina per l'inserimento di un elaborato ">
                <apex:pageblock title="Inserisci Proposta Elaborato">
                    <apex:pageblocksection id="mainsection">
                        <apex:inputfield value="{!Elaborato__c.titolo__c}" />
                        <apex:inputfield value="{!Elaborato__c.dataProposta__c}" />
                        <apex:inputfield value="{!Elaborato__c.descrizione__c}" />
                        <apex:inputfield value="{!Elaborato__c.Materia__c}" />
                        <apex:commandButton value="Save" action="{!save}"
                            rerender="mainsection,listaelab" />
                    </apex:pageblocksection>

                    <apex:pageblocksection collapsible="false">
                        <apex:pageBlockTable value="{!lista}" columns="10" width="80%"
                            var="e" id="listaelab">
                            <apex:column headerValue="Numero Elaborato"
                                title="Numero Elaborato" value="{!e.name}" />
                            <apex:column headerValue="titolo" title="titolo"
                                value="{!e.titolo__c}" />
                            <apex:column headerValue="descrizione" title="descrizione"
                                value="{!e.descrizione__c}" />
                            <apex:column headerValue="titolo" title="materia"
                                value="{!e.Materia__c}" />
                            <apex:column headerValue="Data Proposta" title="Data Proposta"
                                value="{!e.dataProposta__c}" />
                            <apex:column headerValue="Data Assegnazione"
                                title="Data Assegnazione" value="{!e.dataAssegnazione__c}" />
                            <apex:column headerValue="Data Archiviazione"
                                title="Data Archiviazione" value="{!e.dataArchiviazione__c}" />
                            <apex:column headerValue="Stato" title="Stato"
                                value="{!e.stato__c}" />
                        </apex:pageBlockTable>
                    </apex:pageblocksection>

                    </apex:pageBlock>
            </apex:form>
        </apex:define>
    </apex:composition>
</apex:page>

 

 I cut some lines of code from the controller, but i think that the problem is in the function save(). 

 

 

The question is : is possible to make more insert from a single page using the extension of a standard controller?

 

 

Thanks to all,

 

Fabrizio

Hi,

 

 

i am using the Email Services to create my application. Now i have a question, is possible to open an outlook email from apex?

I would to click on a button and open a mail in outlook.

 

 

Thanks to all,

 

F.P.

Hi, 

 

i have some problems with the insert of many records of a custom object from a single visualforce page.

Now i explain the question : i have a custom Object ( Elaborato__c ) and i had build a controller extension for it. Well, when i try to create ( and save ) more than a Elaborato__c from a single visualforce page, i have an error :

 

first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]  

 

 

The reason,  i think( cause i see the view state of the page ), is that i create only one Elaborato__c and after the first Insert, the Id of the sObject remain the same for the second record too.

 

Now, one possible solution is make all with a custom controller, but by this way i lose all the advantages of using the Standard Controller of Elaborato__c.

 

public with sharing class ProvaDocenteController {

public List<Elaborato__c> lista;
	public Elaborato__c elaborato;
	public Docente__c docente{get;set;}
    public String email{get;set;}
    public String password{get;set;} 
    private boolean logged=false; 
    
    
     public ProvaDocenteController(ApexPages.StandardController controller){
    	
         
    	
    	this.elaborato = (Elaborato__c) controller.getRecord();
    	
    	
    	this.elaborato.titolo__c='Inserisci titolo';
    	this.elaborato.descrizione__c='Inserisci Descrizione';
    	this.elaborato.cdl__c='Ingegneria informatica';
    }
    
    
  
   
			
    
    public void save() {
    	
    	
    insert (elaborato);
    
    
	this.elaborato.titolo__c='Inserisci titolo';
	this.elaborato.dataProposta__c=System.today();
	this.elaborato.descrizione__c='Inserisci Descrizione';
	this.elaborato.cdl__c='Ingegneria informatica';
		

	}

	public List<Elaborato__c> getlista(){
		this.lista=new list<Elaborato__c>();
		if(this.logged!=false)
			this.lista=[SELECT name,titolo__c,descrizione__c,materia__r.nome__c,dataproposta__c, dataAssegnazione__c,dataArchiviazione__c,stato__c 
 			FROM Elaborato__c WHERE Docente__c=:this.docente.id  ORDER BY LastModifiedDate DESC  LIMIT 10 ];
		
		return lista;
	}

}

 

 

<apex:page sidebar="false" showHeader="false"
    standardController="Elaborato__c" extensions="ProvaDocenteController" 
    >

    <apex:composition template="UninaTemplate">

        <apex:define name="header">
            <apex:include pageName="header" />
        </apex:define>

        <apex:define name="body">

       
            <apex:form title="Pagina per l'inserimento di un elaborato ">
                <apex:pageblock title="Inserisci Proposta Elaborato">
                    <apex:pageblocksection id="mainsection">
                        <apex:inputfield value="{!Elaborato__c.titolo__c}" />
                        <apex:inputfield value="{!Elaborato__c.dataProposta__c}" />
                        <apex:inputfield value="{!Elaborato__c.descrizione__c}" />
                        <apex:inputfield value="{!Elaborato__c.Materia__c}" />
                        <apex:commandButton value="Save" action="{!save}"
                            rerender="mainsection,listaelab" />
                    </apex:pageblocksection>

                    <apex:pageblocksection collapsible="false">
                        <apex:pageBlockTable value="{!lista}" columns="10" width="80%"
                            var="e" id="listaelab">
                            <apex:column headerValue="Numero Elaborato"
                                title="Numero Elaborato" value="{!e.name}" />
                            <apex:column headerValue="titolo" title="titolo"
                                value="{!e.titolo__c}" />
                            <apex:column headerValue="descrizione" title="descrizione"
                                value="{!e.descrizione__c}" />
                            <apex:column headerValue="titolo" title="materia"
                                value="{!e.Materia__c}" />
                            <apex:column headerValue="Data Proposta" title="Data Proposta"
                                value="{!e.dataProposta__c}" />
                            <apex:column headerValue="Data Assegnazione"
                                title="Data Assegnazione" value="{!e.dataAssegnazione__c}" />
                            <apex:column headerValue="Data Archiviazione"
                                title="Data Archiviazione" value="{!e.dataArchiviazione__c}" />
                            <apex:column headerValue="Stato" title="Stato"
                                value="{!e.stato__c}" />
                        </apex:pageBlockTable>
                    </apex:pageblocksection>

                    </apex:pageBlock>
            </apex:form>
        </apex:define>
    </apex:composition>
</apex:page>

 

 I cut some lines of code from the controller, but i think that the problem is in the function save(). 

 

 

The question is : is possible to make more insert from a single page using the extension of a standard controller?

 

 

Thanks to all,

 

Fabrizio