• SirishaM
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 25
    Replies
Hi,

I have a button which creates  a record . I also want to delete the created record by testing some condition before refreshing page.
But when I click the button, it checks the condition and deletes the previous records accordingly but not the latest record .

The record shows the creation time properly but I dont know why it does not remove the record. Is it because my function executes on  oncomplete  event ?

Any ideas ?

Sirisha

Hi,

I want to execute a function after the button action method is executed. I am using the oncomplete function to do that
My problem is

The oncomplete method executes on only previous records not on the new record added by the button. I cud not understand the reason and struggling with it for long time.

Also ,Please see my other  link for more information..

Waiting for help..

Sirisha

Hi,

I wrote a custom button which takes to Attachments page --> Attaches the file --> Returns to the previous page

I created a PageReference using URL-- https://na5.salesforce.com/p/attach/NoteAttach  to  Attach File.

Is there a way to check a condition after going to the page and just before saving the file ?

Or atleast

I want to check some condition and delete the records using oncomplete field in <apex:commandButton> but can I use the
method in the custom controller for that or do I need write only Java script function ?

I am facing this problem for 2 days but cud n't find solution so far.

Any help is greatly aprreciated..

Thanks,
Sirisha

Hi ,

I wrote the folowing SOQL query on Attachment
Code:
for(Attachment attms: [select LastModifiedDate from Attachment where parentId= :asub.Id])
if(attms.LastModifiedDate < asst.Due_Date__c)
{
delete attms;
}

 Where asub and asst are my Custom objects. I am checking if the attachment is added after the deadline and then I delete the attachment if it is .

I did this because I can  not check the deadline before attaching the file.

My problem is it is does not do this . Even though the apex class gets saved with out any error. It does not delete the file based on the condition.

Kindly help where I am going wrong..

Sirisha


Hi,

Is it possible to write a trigger on NotesAndAttachments of any object ? I want to check some deadline before attaching a file.
Kindly help.

Sirisha
Hi,

I have created a VF page with custom extension in which I will be taken to a new page when I click a "Attach File"
button.

My problem is once I am taken to new page , I want to check a condition before I save the file. So I want to overrde the "Attach File" button in Save page of Notes and Attachment section . Is that possible ?

I can not write a VF page for  the rendered page ..so how can I overwrite the button?

Thanks,
Sirisha

Hi,

I have an object and I allow the user to update the object only before some deadline. My problem is I wrote a trigger
which restricts the update of the object based on the deadline. But the relatedlists of the object get updated even after the
deadline.

One of my related lists is Notesandattachments . I was able to add attachments even after the deadline. Is there a way to restrict the update of attachments ?

Kindly help.

Thanks,
Sirisha

Hi,

I used try and catch statements in Controller extension to catch DML errors.

How can I disply the error message ? I know that I can get the message from e.getMessage() where "e" is the exception.
But  how do I display it on the current page . I tried using ApexPages but cud not succeed.

Thanks in advance!

Sirisha
Hi,

I wrote a "before insert"  trigger for finding duplicates in my custom object and I also wrote a VF page for the same object.
My VF page has a custom extension.

Even though trigger does not allow the duplicates but it does not display the error message on VF page
.Do I need to change anything in page to display the errors ?

Thanks,
Sirisha
Hi,

I want to change the header name of a page I created . I used PageReference to create the page using the URL.
Can anybody please tell me how to change the header of a page ?

Thanks,
Sirisha

Hi,

I created a button with different name for "New Note" under the Notes and Attachments section. My problem is
In the action method for the button when I copy the parent_id using

secondPage.getParameters().put('parent_id',exmsub.Id);

--it copies 18 bit record id an displays the "Data not available " error

but if I remove the last 3 bits of the record-id manually , it displays the page properly.
How do I supply only 15 bit record id for the record I am displaying.

This problem did not arise when I was renaming the Attach File button.

Can anybody tell me where  I am going wrong?

Thanks,
Sirisha
Hi,

All of a sudden my S-control started giving "Insufficient privileges" error message , even though I am the administrator.
Did any thing chane regarding the S-control ?

I am actually displaying the S-control using the following code

Code:
<apex:tab label="WhiteBoard" name="WhiteBoard" id="tabWB">
<apex:scontrol controlname="Whitecanvas" subject="Whitecanvas" width="800" height="600"/>
</apex:tab>

 


Sirisha

Hi,

I saw that there is  "Notes" related list under all standard and custom objects but when I am  trying to use it , it gives
it is not a valid relationship name . Can I use the "notes" related list of any object in  Visualforce page ?

Thanks
Sirisha
Hi,

 I am trying to relabel the "new note" button using a new command button. Can anybody pls tell me what action method should I use to get the same functionality as " New Note" and "Attach File" .

Sirisha
Hi,

I have a query regarding the Notes & Attachments.
I want to remove "New Note" button or atleast rename it to something which is relevant to my application. Is this possible ? If not, any ideas of how to implement a button which has the functionality of the "Attachment"  button.

Thanks
Sirisha
Hi,

I wrote a VF page using the same yahoo tool bar used in blog application.
 
My page is sometimes loading properly sometimes it is not.

This is the code I used:
Code:
<apex:page showHeader='true' standardcontroller="Assignment__c">
<apex:form>
<apex:pageBlock>
<!-- Skin CSS file -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/skin.css" ></link>

<!-- Utility Dependencies -->
<script src="http://yui.yahooapis.com/2.3.0/build/utilities/utilities.js"></script>

<!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
<script src="http://yui.yahooapis.com/2.3.0/build/container/container-min.js"></script>
<script src="http://yui.yahooapis.com/2.3.0/build/menu/menu-min.js"></script>
<script src="http://yui.yahooapis.com/2.3.0/build/button/button-beta-min.js"></script>

<!-- Source file for Rich Text Editor-->
<script src="http://yui.yahooapis.com/2.3.0/build/editor/editor-beta-min.js"></script>



<div class="yui-skin-sam" style="display:none" id="editor" align="center" ><p />
<h2>Assignment Description </h2>
<apex:pageBlockSection>
<apex:inputField value="{!Assignment__c.Course__c}" />
<apex:inputField id="Duedate" value="{!Assignment__c.Due_Date__c}" />
</apex:pageBlockSection>

<apex:inputtextarea id="Description" cols="500" rows="50" value="{!Assignment__c.Description__c}"/>
<apex:commandButton value="Save" action="{!Save}" onClick="beforeTextSave()"/>
<p />
</div>


<script type="text/javascript" >
var myEditor;
window.onload = function init() {
myEditor = new YAHOO.widget.Editor('{!$component.Description}', {
height: '400px', width: '722px', dompath: true, animate: true });
myEditor.render();
document.getElementById('editor').style.display='';
}
function beforeTextSave() {
document.getElementById('{!$component.Description}').value = myEditor.getEditorHTML();
}

</script>
</apex:pageBlock>
</apex:form></apex:page>

 
where Assignment is my custom object,
 Description,duedate are custom fields

Can anybody please tell me whats wrong in the code ?

Thanks,
Sirisha
Hi ,

I am using a yahoo text editor( similar to the blog application example in visualforce) to edit one textarea field.
But when I save and it does not show the data in the format .

For example when  I print text in italics
it prints <i> your text </i>

I know it is some style sheet problem. Does anyone know which style sheet to use to display formatted text ?

Thanks,
Sirisha
Hi

Is there a way to block the look up window ? I am using the <inputField> in Visualforce page for a lookup field but I dont want user to see the various values for that filed. (Say for eg Student Id) .


Thanks,
Sirisha
Hi ,

I have a object which has autonumber field whose format is S-{00000}
Can I give input to this field through a inputText field in Visualforce page ?

Even though I am giving the value in same format value through inputText ..it is giving error saying Invalid field value when I am trying to insert this value into object.


Thanks,
Sirisha


Hi ,

I am new to Visual force and I need help in page navigation setup .

I have 2 objects -Assignment, Assignment_Submission.
I created two pages namely "apage" for Assignment  object and "bpage" for Assignment_Submission object.
Assignment_Submission has a lookup relation with Assignment.

Before the user starts the assignment I want to store the time at which he starts the assignment. The time field is in Assignment_Submission object.  I dont want user to see the  Assignment before saving the time at which he started as the assignment is a time bound one.

Is it possible to do this using just visual force ? I dont know how to write the custom controller for this.
Or is there a way to write a trigger which fires when one sees the record. Pls help if anybody knows how to do it.

Any ideas will be helpful.

Thanks,
Sirisha

I've got a nice S-Control that lets me see all my time entries for the week on one page. I see a view of the data and if I hit the edit button on an entry, I flip to an edit form.

I want to rebuild this in VisualForce and I'm struggling around how to produce that pattern.

In JS I had a Div with the HTML for displaying the record, and when I hit the edit button, I replaced the complete contents of the DIV with an edit form. On save, I replace the contents again, back to the view HTML.

If I'm displaying a list of entries in VF, I can easily display them as outputText or inputFields. And I know how to rerender elements. But any ideas on the best way to flip between view and edit modes?

Thanks!

Steve
 
I need to handle exception and show my person message(like record is deleted) when user try to fetch data which is already deleted.
 
I wrote code like this in extention controller.
 
Code:
  public MyControllerExtension(ApexPages.StandardController stdController) {
     
      try {               
     
     
      this.acct  = [select id, name, site,Account_Manager__c,RecordTypeId,Dealer_ID__c,OwnerId from Account where id =
                       :System.currentPageReference().getParameters().get('id')];
      this.profile=[Select p.Name From Profile p where p.Id=:UserInfo.getProfileId()];
       } catch (System.QueryException e) {       
        
             ApexPages.addMessages(e);           
        }       
     
      init();
    }

 And page is like this.
Code:
<apex:page standardController="Account" extensions="MyControllerExtension" action="{!doRedirect}">
<apex:pageMessages />

       <apex:detail relatedList="true" relatedListHover="true"subject="{!account.id}"/>

   </apex:page>

Now this page shows message which is not user readable.Istead of standard message,I need to diaply like"record is deleted and it will be in recyclebin for 30 days"
 
How I can show this meesage instead of standard message in visual force page?
 
Any help will be great.
Hi,

I have created a VF page with custom extension in which I will be taken to a new page when I click a "Attach File"
button.

My problem is once I am taken to new page , I want to check a condition before I save the file. So I want to overrde the "Attach File" button in Save page of Notes and Attachment section . Is that possible ?

I can not write a VF page for  the rendered page ..so how can I overwrite the button?

Thanks,
Sirisha

Hi,

I have an object and I allow the user to update the object only before some deadline. My problem is I wrote a trigger
which restricts the update of the object based on the deadline. But the relatedlists of the object get updated even after the
deadline.

One of my related lists is Notesandattachments . I was able to add attachments even after the deadline. Is there a way to restrict the update of attachments ?

Kindly help.

Thanks,
Sirisha

Hi

I have written this following piece of code for invoking controller method from Javascript but it does not work. I am not sure what I am missing in it,
Code:
<apex:outputPanel rendered="{!contractSummary}">
            <p><span style="padding:100px;"></span><apex:commandButton action="{!viewContractSummary}" value="View Contract Summary" styleClass="btn"/>
            <span style="padding:5px;"/><apex:commandButton value="Remove Term" onclick="validateRemove()"></apex:commandButton></p>
              <apex:actionFunction name="removeContractTerms" action="{!removeContractTerms}"></apex:actionFunction>
            <script>
                function validateRemove()
                {
                    var answer = confirm("Would you like to remove this Term from the Contract—")
                    if(answer)
                    {
                      var contractTermsId = document.getElementById('{!$Component.contractTermsId}')
                      removeContractTerms()
                    
                    }
                    else
                    {
                        alert("No"+contractTermsId)
                    }
                
                }
            </script>
       </apex:outputPanel>


Controller
 public PageReference removeContractTerms()
       {     
           delete contract_terms;
           return viewContractSummary();
           
       
       }  

  /* This method takes the user to the contract summary page */
       public PageReference viewContractSummary()
       {
        
            PageReference contSumPr = Page.contract_summary;
            contSumPr.getParameters().put('contractId', System.currentPageReference().getParameters().get('contractId'));
            contSumPr.setredirect(true);
            return contSumPr;
        
       }

 I tried both ways to call the Controller method - using the apex:actionFunction Name directly and also by using setTimeout(removeContractTerms,1000)

Can  anyone please look into this?

Thanks
Jina

Hi,

I wrote a "before insert"  trigger for finding duplicates in my custom object and I also wrote a VF page for the same object.
My VF page has a custom extension.

Even though trigger does not allow the duplicates but it does not display the error message on VF page
.Do I need to change anything in page to display the errors ?

Thanks,
Sirisha
Hi,

I want to change the header name of a page I created . I used PageReference to create the page using the URL.
Can anybody please tell me how to change the header of a page ?

Thanks,
Sirisha

Hi,

I created a button with different name for "New Note" under the Notes and Attachments section. My problem is
In the action method for the button when I copy the parent_id using

secondPage.getParameters().put('parent_id',exmsub.Id);

--it copies 18 bit record id an displays the "Data not available " error

but if I remove the last 3 bits of the record-id manually , it displays the page properly.
How do I supply only 15 bit record id for the record I am displaying.

This problem did not arise when I was renaming the Attach File button.

Can anybody tell me where  I am going wrong?

Thanks,
Sirisha
Hi,

All of a sudden my S-control started giving "Insufficient privileges" error message , even though I am the administrator.
Did any thing chane regarding the S-control ?

I am actually displaying the S-control using the following code

Code:
<apex:tab label="WhiteBoard" name="WhiteBoard" id="tabWB">
<apex:scontrol controlname="Whitecanvas" subject="Whitecanvas" width="800" height="600"/>
</apex:tab>

 


Sirisha

Hi,

I have a query regarding the Notes & Attachments.
I want to remove "New Note" button or atleast rename it to something which is relevant to my application. Is this possible ? If not, any ideas of how to implement a button which has the functionality of the "Attachment"  button.

Thanks
Sirisha
Hi,

I wrote a VF page using the same yahoo tool bar used in blog application.
 
My page is sometimes loading properly sometimes it is not.

This is the code I used:
Code:
<apex:page showHeader='true' standardcontroller="Assignment__c">
<apex:form>
<apex:pageBlock>
<!-- Skin CSS file -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/skin.css" ></link>

<!-- Utility Dependencies -->
<script src="http://yui.yahooapis.com/2.3.0/build/utilities/utilities.js"></script>

<!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
<script src="http://yui.yahooapis.com/2.3.0/build/container/container-min.js"></script>
<script src="http://yui.yahooapis.com/2.3.0/build/menu/menu-min.js"></script>
<script src="http://yui.yahooapis.com/2.3.0/build/button/button-beta-min.js"></script>

<!-- Source file for Rich Text Editor-->
<script src="http://yui.yahooapis.com/2.3.0/build/editor/editor-beta-min.js"></script>



<div class="yui-skin-sam" style="display:none" id="editor" align="center" ><p />
<h2>Assignment Description </h2>
<apex:pageBlockSection>
<apex:inputField value="{!Assignment__c.Course__c}" />
<apex:inputField id="Duedate" value="{!Assignment__c.Due_Date__c}" />
</apex:pageBlockSection>

<apex:inputtextarea id="Description" cols="500" rows="50" value="{!Assignment__c.Description__c}"/>
<apex:commandButton value="Save" action="{!Save}" onClick="beforeTextSave()"/>
<p />
</div>


<script type="text/javascript" >
var myEditor;
window.onload = function init() {
myEditor = new YAHOO.widget.Editor('{!$component.Description}', {
height: '400px', width: '722px', dompath: true, animate: true });
myEditor.render();
document.getElementById('editor').style.display='';
}
function beforeTextSave() {
document.getElementById('{!$component.Description}').value = myEditor.getEditorHTML();
}

</script>
</apex:pageBlock>
</apex:form></apex:page>

 
where Assignment is my custom object,
 Description,duedate are custom fields

Can anybody please tell me whats wrong in the code ?

Thanks,
Sirisha
Hi ,

I am using a yahoo text editor( similar to the blog application example in visualforce) to edit one textarea field.
But when I save and it does not show the data in the format .

For example when  I print text in italics
it prints <i> your text </i>

I know it is some style sheet problem. Does anyone know which style sheet to use to display formatted text ?

Thanks,
Sirisha
Hi

Is there a way to block the look up window ? I am using the <inputField> in Visualforce page for a lookup field but I dont want user to see the various values for that filed. (Say for eg Student Id) .


Thanks,
Sirisha