• Shravya Rama 9
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 17
    Replies
Hello,
In the following VF page, I use action support to refresh a page. But everytime the page refreshes, focus goes to top of the page. I want to set the focus to one of the field Automatik__c with ID = "FocusID" using script whenever the page refreshes. But its not working.
<script type="text/javascript">
    function addLoadEvent(func) { 
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
    
    function setFocus() {
        document.getElementById('{!$Component.FocusID}').focus();
    }
    addLoadEvent(setFocus);
</script>
             <apex:pageBlockSection >
                  <apex:inputField value="{!res.Automatik__c}"   >
                         <apex:actionSupport event="onchange" action="{!getRefresh}" id = "FocusID" >
            
                    </apex:actionSupport>
                 </apex:inputField>
                    <apex:inputField value="{!res.Navigation__c}" id="ButtonId" >
                   <apex:actionSupport event="onchange" action="{!getRefresh}" >
            
                    </apex:actionSupport>
                 </apex:inputField>
                
            </apex:pageBlockSection>
Can somebody suggest whats wrong with my code or anyother work around. Thank you.
 
Hello all,
Following is my workflow rule.
User-added image

By default, status is always "gebucht", so all the records created are valid for this WF rule. Later when the status is updated and is no longer "gebucht", the workflow is still firing the field updates and also these updated records are not being deleted from time based workflow queues.

I have been through some posts, but couldnt get to any final solution. Somebody Kindly suggest a solution for my problem. Thank you.
Hallo all,

1. I have a validation rule that Starttime field should always be greater than the current time.
2. I have a time based workflow rule which changes the status field, after 15 minutes from valid Start time field value.

I got a mail saying that the this workflow rule failed to fire because of validation rule. Is there any way to fire this workflow rule even when validation rules are not satisfied or any other work around for this.

 
Is there anyway to display images on standard edit page. I have tried embedding Vf page on pagelayout and also formula fields. But it displays only on display mode. Is there any work around?
Hallo
I want to count number of times a particular field called abholort is repeated and display it in the vf page table.
Apexcode:
public List<String> ShowSuggestions = new List<String>();

    public List<String> getSuggestions() {
        ShowSuggestions =  [select Abholort__c, COUNT(Name)  from Fahrzeuge__c
                            GROUP BY  Abholort__c ]; 
        return ShowSuggestions;               
        
    }
VF page
<apex:pageBlockTable value="{!Suggestions}" var="showsugg"   >
                     
                     
                     <apex:column value="{!showsugg.COUNT(Name)}"  />  
                     <apex:column value="{!showsugg.Abholort__c}"  /> 
                     
                 </apex:pageBlockTable>
I am getting an error of Illegal assignment from list to list. Can anybody let me know where am I wrong.

Thanks.

 
Hello all,
I have two fields Start and end with date & Time Data type. I want datetime to be on X axis and all the records on Y axis visualizing the start and end fields as bars. Something like the figure below.
User-added image

Can somebody suggest how to do this. I just want to visualize start and end fields in an intuitive way. Any other suggestions to do this are also welcome.
Thank you.
For some reason, getmycust() method is getting called as soon as the page loads. Can somebody please tell me where am I going wrong.
<apex:page standardController="Reservation__c" extensions="CarSharingClass">

<apex:commandButton value="Show Fahrzeuge"  action="{!showPanel}" / >

// I want to show the table only when the button is clicked.

<apex:pageBlockTable value="{!myCust}" var="showFahr" rendered="{!If(myCust != null && myCust.size>0 && isRendered==true ,true,false)}"  >
</apex:pageBlockTable>

</apex:page>
Class
public class CarSharingClass {

 public PageReference showPanel(){
        isRendered = true;
        
        return null;
    }
    public List<Fahrzeuge__c> getMyCust() { 

}

}


 
VF PAGE:
<apex:inputField label="Fahrer" value="{!res.Fahrer__c}"   />
<apex:actionRegion>
<apex:commandButton value="Retrieve User Details" rerender="out"  immediate="true"  >
<apex:actionSupport event="onclick" action="{!LoadingUserDetails}"   />
</apex:commandButton>
</apex:actionRegion>

<apex:pageBlockSection id="out"> 
<apex:inputField label="Contact Nummer" value="{!res.Contact_Number__c}" rendered="true" id="out" />             
</apex:pageBlockSection> 

<apex:inputField label="Starts at" value="{!Reservation__c.Start__c}"  required="true"/>
<apex:inputField label="Ends at" value="{!Reservation__c.End__c}" required="true"/>
APEX CLASS:

public pagereference LoadingUserDetails(){

currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('changeduser:'+currentuser);
res.Contact_Number__c = currentuser.phone ;

return null;
}
Rerendering works fine without validation rules but not with. so I chose immeadite = true wrapped in active region but still it doesnt work. Can somebody suggest a solution please.
 
I am making the current user's username and phone number as the default values for the lookup field Fahrer and text field Contact number through constructor. But when I change the lookup field to any other value, I want my contact number to also get updated. But my method is not getting called from the Fahrer look up field. Can anybody suggest a work around.

VF PAGE
<apex:inputField label="Fahrer" value="{!res.Fahrer__c}"   >
                    
<apex:actionSupport action="{!LoadingUserDetails}" rerender="out" />             
               
</apex:inputField>

 <apex:inputField label="Contact Nummer" value="{!currentuser.phone}" rendered="true" id="out" />
Class
 
public class CarSharingClass {

public string UserName = UserInfo.getUserId() ;
public Reservation__c res{get; set;}    
public user currentuser{get;set;}

public CarSharingClass (ApexPages.StandardController stdController) {
res.Fahrer__c = UserName;
currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('currentuser:'+currentuser);        
res.Contact_Number__c = currentuser.phone ;      

}

public void LoadingUserDetails(){

currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('changeduser:'+currentuser);
res.Contact_Number__c = currentuser.phone ;

}

}





 
if(res.Start__c < system.now()){
 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' Start Time should always be greater than current time.'));                    
            }

 if(res.end__c < system.now()){
 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' End Time should always be greater than current time.'));   
            }
I also used  <apex:pageMessages/> in VF page.

Can anybody kindly let me know where am I wrong?
 
Hello all,

I have a field Previous__c which is generated from a field update formula and shows the previous value of another field currentfield__c. Previous__c is correctly shown in standard detailpage layout but its null when I try to display it using    
<apex:outputText value="{!object.Previous__c }"/>.  I have also tried apex:outputfield, but its still the same

Can anybody suggest Where am I going wrong?
 
Hallo all,
Is it possible to change the picklist value automatically, if current time exceeds the start time field(DateTime Datatype) value by 15 minutes. This condition should be automatically updated to all the records of the object.
Thank you.
Hallo all,
Is it possible to stop inserting current record when the new record insertion from the apex trigger fails. It should also throw an error on UI "The current record failed to created new records".
Hello All,
I have a custom childobject(Reservation) and a  lookup parent object(User). I am trying to prepopulate the look up field with the current user attributes. My lookup field accepts the values in the form of "UserFirstName UserLastName". So I tried to invoke the default values through constructor like below.

VisualForce Page:
<apex:page standardController="Reservation__c" extensions="ReservationClass" >
    <apex:sectionHeader title="New Reservation" />
    <apex:form >
       <apex:pageBlock>
        <apex:pageBlockSection >
            <apex:inputField value="{!order.User__c}"/>
  </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
Custom Controller
public class ReservationClass {
    public Reservation__c res{get; set;}
    public String FName = UserInfo.getFirstName()  ;
    public String Lname = UserInfo.getLastName();
    public string UserName = FName + ' ' + Lname ;

public ReservationClass (ApexPages.StandardController stdController) {
    res = (Reservation__c) stdController.getRecord();
    res.User__c =  userName ;
  }
}
The above code throws an error
"Invalid id: Shravya Rama
 An unexpected error has occurred. Your development organization has been notified."

 
Hallo all,

1. I have a validation rule that Starttime field should always be greater than the current time.
2. I have a time based workflow rule which changes the status field, after 15 minutes from valid Start time field value.

I got a mail saying that the this workflow rule failed to fire because of validation rule. Is there any way to fire this workflow rule even when validation rules are not satisfied or any other work around for this.

 
For some reason, getmycust() method is getting called as soon as the page loads. Can somebody please tell me where am I going wrong.
<apex:page standardController="Reservation__c" extensions="CarSharingClass">

<apex:commandButton value="Show Fahrzeuge"  action="{!showPanel}" / >

// I want to show the table only when the button is clicked.

<apex:pageBlockTable value="{!myCust}" var="showFahr" rendered="{!If(myCust != null && myCust.size>0 && isRendered==true ,true,false)}"  >
</apex:pageBlockTable>

</apex:page>
Class
public class CarSharingClass {

 public PageReference showPanel(){
        isRendered = true;
        
        return null;
    }
    public List<Fahrzeuge__c> getMyCust() { 

}

}


 
VF PAGE:
<apex:inputField label="Fahrer" value="{!res.Fahrer__c}"   />
<apex:actionRegion>
<apex:commandButton value="Retrieve User Details" rerender="out"  immediate="true"  >
<apex:actionSupport event="onclick" action="{!LoadingUserDetails}"   />
</apex:commandButton>
</apex:actionRegion>

<apex:pageBlockSection id="out"> 
<apex:inputField label="Contact Nummer" value="{!res.Contact_Number__c}" rendered="true" id="out" />             
</apex:pageBlockSection> 

<apex:inputField label="Starts at" value="{!Reservation__c.Start__c}"  required="true"/>
<apex:inputField label="Ends at" value="{!Reservation__c.End__c}" required="true"/>
APEX CLASS:

public pagereference LoadingUserDetails(){

currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('changeduser:'+currentuser);
res.Contact_Number__c = currentuser.phone ;

return null;
}
Rerendering works fine without validation rules but not with. so I chose immeadite = true wrapped in active region but still it doesnt work. Can somebody suggest a solution please.
 
I am making the current user's username and phone number as the default values for the lookup field Fahrer and text field Contact number through constructor. But when I change the lookup field to any other value, I want my contact number to also get updated. But my method is not getting called from the Fahrer look up field. Can anybody suggest a work around.

VF PAGE
<apex:inputField label="Fahrer" value="{!res.Fahrer__c}"   >
                    
<apex:actionSupport action="{!LoadingUserDetails}" rerender="out" />             
               
</apex:inputField>

 <apex:inputField label="Contact Nummer" value="{!currentuser.phone}" rendered="true" id="out" />
Class
 
public class CarSharingClass {

public string UserName = UserInfo.getUserId() ;
public Reservation__c res{get; set;}    
public user currentuser{get;set;}

public CarSharingClass (ApexPages.StandardController stdController) {
res.Fahrer__c = UserName;
currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('currentuser:'+currentuser);        
res.Contact_Number__c = currentuser.phone ;      

}

public void LoadingUserDetails(){

currentuser=[Select Id,phone from User where Id=:res.Fahrer__c limit 1];
system.debug('changeduser:'+currentuser);
res.Contact_Number__c = currentuser.phone ;

}

}





 
if(res.Start__c < system.now()){
 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' Start Time should always be greater than current time.'));                    
            }

 if(res.end__c < system.now()){
 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' End Time should always be greater than current time.'));   
            }
I also used  <apex:pageMessages/> in VF page.

Can anybody kindly let me know where am I wrong?
 
Hello all,

I have a field Previous__c which is generated from a field update formula and shows the previous value of another field currentfield__c. Previous__c is correctly shown in standard detailpage layout but its null when I try to display it using    
<apex:outputText value="{!object.Previous__c }"/>.  I have also tried apex:outputfield, but its still the same

Can anybody suggest Where am I going wrong?
 
Hallo all,
Is it possible to change the picklist value automatically, if current time exceeds the start time field(DateTime Datatype) value by 15 minutes. This condition should be automatically updated to all the records of the object.
Thank you.
Hallo all,
Is it possible to stop inserting current record when the new record insertion from the apex trigger fails. It should also throw an error on UI "The current record failed to created new records".
Hello All,
I have a custom childobject(Reservation) and a  lookup parent object(User). I am trying to prepopulate the look up field with the current user attributes. My lookup field accepts the values in the form of "UserFirstName UserLastName". So I tried to invoke the default values through constructor like below.

VisualForce Page:
<apex:page standardController="Reservation__c" extensions="ReservationClass" >
    <apex:sectionHeader title="New Reservation" />
    <apex:form >
       <apex:pageBlock>
        <apex:pageBlockSection >
            <apex:inputField value="{!order.User__c}"/>
  </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
Custom Controller
public class ReservationClass {
    public Reservation__c res{get; set;}
    public String FName = UserInfo.getFirstName()  ;
    public String Lname = UserInfo.getLastName();
    public string UserName = FName + ' ' + Lname ;

public ReservationClass (ApexPages.StandardController stdController) {
    res = (Reservation__c) stdController.getRecord();
    res.User__c =  userName ;
  }
}
The above code throws an error
"Invalid id: Shravya Rama
 An unexpected error has occurred. Your development organization has been notified."