• Tal One1
  • NEWBIE
  • 5 Points
  • Member since 2011

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

Hi,

I've been trying to update case comments to be private, i.e. - so they won't appear in the self service portal.

I used the following code:

 

for(Case_Comment comment: queriedComments)

comment.IsPublished=False;

update queriedComments;

 

But the comments keep on being public (the checkbox is checked). It is important to note that when I manually click on Make Private, the comment is indeed unpublished.

 

Any help would be welcome,

Thanks,

Tal

So I've got a VF page that uses a pageBlockTable to display Standard Rate, Discount %, and Discounted Rate for a series of items.  Both the Discount % and the Discounted Rate are editable.  I'd like to be able to let the user change one and have the other calculated for them (using the Standard Rate for the calculation).  I'd also like to do this on the page rather than in the database using triggers or other such methods, so the user has the option of canceling and abandoning any changes.

 

I've got a couple of JavaScript functions that look like they should do the trick, but they're not.  I'm pretty sure it's because they aren't properly referencing the row in the pageBlockTable, but I'm not certain.  Can anyone tell me how to fix this page so I can get what I'm after?

 

 

<apex:page controller="DiscountRateController" action="{!displayRecords}"> 
<script type="text/javascript">
  function updateRate(){
    rate=document.getElementByID("rate").value;
    discPct = document.getElementByID("discPcrnt").value;
    document.getElementByID("discRate").value = rate - (rate * (discPct/100)));
  }
  function updatePcrnt(){
    rate=document.getElementByID("rate").value;
    discRate = document.getElementByID("discRate").value;
    document.getElementByID("discPcrnt").value = (((rate - discRate)/rate) * 100);
  }
</script>
  <apex:form id="discountRates">
    <apex:pageBlock id="discountRatespb">
      <apex:pageBlockButtons >
        <apex:commandButton action="{!edit}" value="Edit" 
            rendered="{!NOT isEditable}" />
        <apex:commandButton action="{!save}" value="Save" 
            rendered="{!isEditable}" />
        <apex:commandButton action="{!cancel}" value="Cancel" 
            rendered="{!isEditable}" />
      </apex:pageBlockButtons>
      <apex:pageBlockTable value="{!selectedRates}" var="sR">
        <apex:column value="{!sR.Item__c}" />
        <apex:column id="rate" value="{!sR.Rate__c}" />
        <apex:column headerValue="Discount %">
          <apex:outputField value="{!sR.Discount__c}" rendered="{!NOT isEditable}" />
          <apex:inputField id="discPcrnt" value="{!sR.Discount__c}" 
            rendered="{!isEditable}" onchange="updateRate();"/>
        </apex:column>
        <apex:column headerValue="Discounted Rate">
          <apex:outputField value="{!sR.Discounted_Rate__c}" 
rendered="{!NOT isEditable}" /> <apex:inputField id="discRate" value="{!sR.Discounted_Rate__c}" rendered="{!isEditable}" onchange="updatePcrnt();"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

Any hints would be appreciated.

 

 

Thanks,

Jonathan

 

 

 

I know we have options for:

trigger.isBefore
trigger.isAfter
trigger.isInsert
trigger.isUpdate
trigger.isDelete
trigger.isUpsert

but is there a way to distinguish in the trigger whether it is before or after the Workflow has been evaluated, such as

trigger.isBeforeWorkflow
trigger.isAfterWorkflow

Would this be a good idea?
By default, the focus is set to the first available inputField. In my case, the first input is a date field. Every time I go to the page, the focus is set to that field and the calendar pops up, covering items below it.

How do I remove the auto-focus? screenshot: