• Shakespeare
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi Everybody,

 

I have a custom object. Through Create --> Object, I have checked the option of History Tracking for Object and some of the Fields. Then from the Layouts of the object I have add the History Tracking list to my custom object page also. Now that I have done that all as mentioned in the Help, I am surprised that where to find the tracking logs. Where the user should go to find tracked history to audit the changes on a particular record.

 

Thanks & Regards,
Shakespeare

Hi, I have created a simple multi line editor. My business requirement is that I have to add every edited row (item) as a new item in the database. On save event, I get the new items from the screen and in another similar object, I fetch older items from DB and then compare them using a loop. If any row (item) is different, found updated, I insert that into DB. I have wrote the following code (simplified) to achieve this functionality. Unfortunately it gives me the following exception. Would somebody please suggest me some solution to this problem. Thanks,

Shakespeare

 

Code:

<apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" reRender="pixelReqTable"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> <apex:column headerValue="Advertiser"> <apex:inputField value="{!aPixelReq.Advertiser__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

======================================================= public class PixelReqFormController { List<PixelReqForm__c> pixelReqList; public List<PixelReqForm__c> getPixelReq () { return pixelReqList; } public PageReference save() { string contractID = ApexPages.currentPage().getParameters().get('contractID'); //Call to comparer method. If some item is found to be updated, only that item(s) will be

// returned and will be inserted into db as new records. pixelReqList = comparePixReqObjs (pixelReqList); if (pixelReqList != null && pixelReqList.size() > 0) { insert pixelReqList; } else { ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.INFO, 'There were no changes to save.'); ApexPages.addMessage(myMsg); } return null; } public List<PixelReqForm__c> comparePixReqObjs (List<PixelReqForm__c> newList) { List<PixelReqForm__c> updateableList = new List<PixelReqForm__c>(); List<PixelReqForm__c> oldList; PixelReqForm__c pixelReqObj; //getting older pixel list from DB oldList = [SELECT isDeleted__c, Agency__c, Advertiser__C, BCN__c, Value__C, Web_Page_Name__c, Web_Page_URL__c, OAS_System__c, Pixel_Usage__c, Tag_Security__c, Tag_Type__c, Special_Requests__c, ContracID__c FROM PixelReqForm__c where ContracID__c = :ApexPages.currentPage().getParameters().get('contractID') AND isDeleted__c = false order by agency__c desc]; //Comparing older and newer list for differences. If used has updated something, it will be

//saved as a new record. Otherwise no save operation will be done.

for (Integer i=0; i<oldList.size(); i++) { if (newList[i].Agency__c != oldList[i].Agency__c) { //initializing the object with new values, giving me the subject error. pixelReqObj = new PixelReqForm__c (Agency__c = newList[i].Agency__c,

Advertiser__c = newList[i].Advertiser__c); updateableList.add(pixelReqObj); } } return updateableList; } }

 

 

Hi,

 

I have a simple multi line editor and I have to show a success message to the use when ajax call makes the insert/update. I have used <apex:pageMessages/> and message class in controller. Unfortunatley message is not displayed. Here is my code. Can somebody would help me please.

 

Regards,
Shakespeare

<apex:page controller="PixelReqFormController" showHeader="false" id="pixelReqPage"> <apex:pageMessages/> <script> function checkIsDelete() { if (confirm()) { saveRecord (); return true; } else { return false; } saveRecord (); } </script> <apex:form id="pixelReqForm"> <apex:actionFunction action="{!save}" name="saveRecord" reRender="pixelReqTable" /> <apex:pageMessages rendered="true" id="msg2"/> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" id="btnSave" rerender="pixelReqTable" status="outStatus" onclick="checkIsDelete()"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Delete" id="isDeleteColumn"> <apex:inputCheckbox value="{!aPixelReq.isDeleted__c}" id="isDelete"/> </apex:column> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page> -------------------------------------- public class PixelReqFormController { public PageReference save() { for (integer i = 0; i < pixelReqList.size(); i++) { if (pixelReqList[i].ContracID__c == '' || pixelReqList[i].ContracID__c == null) { pixelReqList[i].ContracID__c = ApexPages.currentPage().getParameters().get('contractID'); } } upsert pixelReqList; ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.INFO, 'Pixel Request Saved Successfully'); ApexPages.addMessage(myMsg); reset (); return null; } public PageReference reset() { pixelReqList = [SELECT isDeleted__c, Agency__c FROM PixelReqForm__c where ContracID__c = :ApexPages.currentPage().getParameters().get('contractID') AND isDeleted__c = false return null; } }

 

Hi,

I have a multi line editor with first column as checkboxes. On Save button I am deleting the checked items. I have worte a javascript function that will give me a confirm message if I have checked some item. My problem is, that records gets deleted even if I click on the cancel button of th message. I believe the ajax call is its reason, if I am right is there a way to stop the ajax call in VF pages if user selects Cancel option from javascript. Or there is some other solution.

 

Shakespeare

 

<apex:page controller="PixelReqFormController" showHeader="false" id="pixelReqPage"> <script> function checkIsDelete() { var table = document.getElementById('pixelReqPage:pixelReqForm:pixelReqPageBlock:pixelReqTable'); var rowsCount = table.rows.length; var checkbox; for (var i=0; i < rowsCount-1; i++) { checkbox = document.getElementById'pixelReqPage:pixelReqForm:pixelReqPageBlock:pixelReqTable:'+i+':isDelete'); alert (checkbox.checked); if (checkbox.checked) { if (confirmDelete()) { return true; } else { return false; } } } }

 

function confirmDelete()
    {
        var isDelete = confirm("Are you sure you want to delete the checked item(s)?");
        if (isDelete )
        {
            return true;           
        }
        return false;   
    } </script> <apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" rerender="pixelReqTable" status="outStatus" onclick="checkIsDelete()" /> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Delete" id="isDeleteColumn"> <apex:inputCheckbox value="{!aPixelReq.isDeleted__c}" id="isDelete"/> </apex:column> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> <apex:column headerValue="Advertiser"> <apex:inputField value="{!aPixelReq.Advertiser__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

Hi, I am trying to make an attachment page on one of my custom pages. I am unable to find any totorial for this particular purpose. Can somebody please refer me to some tutorial that associates an attachment to the custom objects and controls.

 

I came accross teh follwoing example of uploading attachments. I am unable to run this code because I dont find any option to create the extension for the standardController-Document

 

    

<apex:page standardController="Document" extensions="documentExt"> <-- Upload a file and put it in your personal documents folder--> <apex:messages /> <apex:form id="theForm"> <apex:pageBlock> <apex:pageBlockSection> <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> /*** Controller ***/ public class documentExt { Appendix D: Standard Component Reference inputFile public documentExt(ApexPages.StandardController controller) { Document d = (Document) controller.getRecord(); d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents } }

 

Can someone please help me in:

1- How can I associate an attachments to my records when I am working with a custom controller (some code or step by step tutorial).

2- How can I add an extension when I am using a standard controlle

Hi Everybody,

 

I have created a new visualforce page that I want to invoke through a custom link on Contracts or Opportunity page. When I try to add this page as a link through Setup --> Customize --> Contracts --> Buttons & Links. On Custom Button or Link Edit page when I select Content Source dropdown as visualforce page, my newly created visualforce page is not displayed in the Content dropdown.

As per my understanding, my visualforce page the working correctly when accessed through its link should appear in the Content dropdown when when user selects Content Source as visualforce page.

 

Regards,

Shakespeare 

 

Hi Everybody,

 

I have a custom object. Through Create --> Object, I have checked the option of History Tracking for Object and some of the Fields. Then from the Layouts of the object I have add the History Tracking list to my custom object page also. Now that I have done that all as mentioned in the Help, I am surprised that where to find the tracking logs. Where the user should go to find tracked history to audit the changes on a particular record.

 

Thanks & Regards,
Shakespeare

Hi, I have created a simple multi line editor. My business requirement is that I have to add every edited row (item) as a new item in the database. On save event, I get the new items from the screen and in another similar object, I fetch older items from DB and then compare them using a loop. If any row (item) is different, found updated, I insert that into DB. I have wrote the following code (simplified) to achieve this functionality. Unfortunately it gives me the following exception. Would somebody please suggest me some solution to this problem. Thanks,

Shakespeare

 

Code:

<apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" reRender="pixelReqTable"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> <apex:column headerValue="Advertiser"> <apex:inputField value="{!aPixelReq.Advertiser__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

======================================================= public class PixelReqFormController { List<PixelReqForm__c> pixelReqList; public List<PixelReqForm__c> getPixelReq () { return pixelReqList; } public PageReference save() { string contractID = ApexPages.currentPage().getParameters().get('contractID'); //Call to comparer method. If some item is found to be updated, only that item(s) will be

// returned and will be inserted into db as new records. pixelReqList = comparePixReqObjs (pixelReqList); if (pixelReqList != null && pixelReqList.size() > 0) { insert pixelReqList; } else { ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.INFO, 'There were no changes to save.'); ApexPages.addMessage(myMsg); } return null; } public List<PixelReqForm__c> comparePixReqObjs (List<PixelReqForm__c> newList) { List<PixelReqForm__c> updateableList = new List<PixelReqForm__c>(); List<PixelReqForm__c> oldList; PixelReqForm__c pixelReqObj; //getting older pixel list from DB oldList = [SELECT isDeleted__c, Agency__c, Advertiser__C, BCN__c, Value__C, Web_Page_Name__c, Web_Page_URL__c, OAS_System__c, Pixel_Usage__c, Tag_Security__c, Tag_Type__c, Special_Requests__c, ContracID__c FROM PixelReqForm__c where ContracID__c = :ApexPages.currentPage().getParameters().get('contractID') AND isDeleted__c = false order by agency__c desc]; //Comparing older and newer list for differences. If used has updated something, it will be

//saved as a new record. Otherwise no save operation will be done.

for (Integer i=0; i<oldList.size(); i++) { if (newList[i].Agency__c != oldList[i].Agency__c) { //initializing the object with new values, giving me the subject error. pixelReqObj = new PixelReqForm__c (Agency__c = newList[i].Agency__c,

Advertiser__c = newList[i].Advertiser__c); updateableList.add(pixelReqObj); } } return updateableList; } }

 

 

Hi,

 

I have a simple multi line editor and I have to show a success message to the use when ajax call makes the insert/update. I have used <apex:pageMessages/> and message class in controller. Unfortunatley message is not displayed. Here is my code. Can somebody would help me please.

 

Regards,
Shakespeare

<apex:page controller="PixelReqFormController" showHeader="false" id="pixelReqPage"> <apex:pageMessages/> <script> function checkIsDelete() { if (confirm()) { saveRecord (); return true; } else { return false; } saveRecord (); } </script> <apex:form id="pixelReqForm"> <apex:actionFunction action="{!save}" name="saveRecord" reRender="pixelReqTable" /> <apex:pageMessages rendered="true" id="msg2"/> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" id="btnSave" rerender="pixelReqTable" status="outStatus" onclick="checkIsDelete()"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Delete" id="isDeleteColumn"> <apex:inputCheckbox value="{!aPixelReq.isDeleted__c}" id="isDelete"/> </apex:column> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page> -------------------------------------- public class PixelReqFormController { public PageReference save() { for (integer i = 0; i < pixelReqList.size(); i++) { if (pixelReqList[i].ContracID__c == '' || pixelReqList[i].ContracID__c == null) { pixelReqList[i].ContracID__c = ApexPages.currentPage().getParameters().get('contractID'); } } upsert pixelReqList; ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.INFO, 'Pixel Request Saved Successfully'); ApexPages.addMessage(myMsg); reset (); return null; } public PageReference reset() { pixelReqList = [SELECT isDeleted__c, Agency__c FROM PixelReqForm__c where ContracID__c = :ApexPages.currentPage().getParameters().get('contractID') AND isDeleted__c = false return null; } }

 

Hi,

I have a multi line editor with first column as checkboxes. On Save button I am deleting the checked items. I have worte a javascript function that will give me a confirm message if I have checked some item. My problem is, that records gets deleted even if I click on the cancel button of th message. I believe the ajax call is its reason, if I am right is there a way to stop the ajax call in VF pages if user selects Cancel option from javascript. Or there is some other solution.

 

Shakespeare

 

<apex:page controller="PixelReqFormController" showHeader="false" id="pixelReqPage"> <script> function checkIsDelete() { var table = document.getElementById('pixelReqPage:pixelReqForm:pixelReqPageBlock:pixelReqTable'); var rowsCount = table.rows.length; var checkbox; for (var i=0; i < rowsCount-1; i++) { checkbox = document.getElementById'pixelReqPage:pixelReqForm:pixelReqPageBlock:pixelReqTable:'+i+':isDelete'); alert (checkbox.checked); if (checkbox.checked) { if (confirmDelete()) { return true; } else { return false; } } } }

 

function confirmDelete()
    {
        var isDelete = confirm("Are you sure you want to delete the checked item(s)?");
        if (isDelete )
        {
            return true;           
        }
        return false;   
    } </script> <apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form" id="pixelReqPageBlock"><br></br> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" rerender="pixelReqTable" status="outStatus" onclick="checkIsDelete()" /> </apex:pageBlockButtons> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="Delete" id="isDeleteColumn"> <apex:inputCheckbox value="{!aPixelReq.isDeleted__c}" id="isDelete"/> </apex:column> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> <apex:column headerValue="Advertiser"> <apex:inputField value="{!aPixelReq.Advertiser__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

Hi, I am trying to make an attachment page on one of my custom pages. I am unable to find any totorial for this particular purpose. Can somebody please refer me to some tutorial that associates an attachment to the custom objects and controls.

 

I came accross teh follwoing example of uploading attachments. I am unable to run this code because I dont find any option to create the extension for the standardController-Document

 

    

<apex:page standardController="Document" extensions="documentExt"> <-- Upload a file and put it in your personal documents folder--> <apex:messages /> <apex:form id="theForm"> <apex:pageBlock> <apex:pageBlockSection> <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> /*** Controller ***/ public class documentExt { Appendix D: Standard Component Reference inputFile public documentExt(ApexPages.StandardController controller) { Document d = (Document) controller.getRecord(); d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents } }

 

Can someone please help me in:

1- How can I associate an attachments to my records when I am working with a custom controller (some code or step by step tutorial).

2- How can I add an extension when I am using a standard controlle

Hi Everybody,

 

I have created a new visualforce page that I want to invoke through a custom link on Contracts or Opportunity page. When I try to add this page as a link through Setup --> Customize --> Contracts --> Buttons & Links. On Custom Button or Link Edit page when I select Content Source dropdown as visualforce page, my newly created visualforce page is not displayed in the Content dropdown.

As per my understanding, my visualforce page the working correctly when accessed through its link should appear in the Content dropdown when when user selects Content Source as visualforce page.

 

Regards,

Shakespeare 

 

Code:
try{
   update o;
   }catch (System.DmlException e){
    
     System.debug('DML Issue: ' + e);
     
     o.Price_Due_Date__c = System.today();
     update o;
       
      }


I try to update Opportunity object and set proper stage. However it may throw exception because this stage cannot be set if field "Price_Due_Date__c" is empty. (validation rule)

Question: Why in debug log I cannot see the message "DML Issue: ..." in case exception was thhrown and Today's date was set?

-Aki
  • June 28, 2008
  • Like
  • 0