• PedroL
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hello,

 

I need to create records to check the SLA on our daily batch operations. The SLAs times are stored in its own object using a string to indicate HH:MM and a picklist value to specify the timezone for the client. Each day I need to generate the expected SLA record based on the date and the time stored in SLA times object to compare against the actual. Ideally, I should be able to create a datetime instance specifying the relevant time zone. However, the only options avaialble in Apex are GMT or current user locale.

 

Is there a way to accomplish the same using what's available in Apex?

 

I could store the time offset from our default time zone (EST) in the SLA object. However, I would need to deal with the periods when Europe and North America switch daylights savings at different dates.

 

Thanks,

 

Pedro

  • October 25, 2011
  • Like
  • 0

 

Hello,

 

I have been working on creating a configuration page with two lists where the user would select from the available options and then reorder if necessary how those options should be displayed. I ended up implementing it using jquery but I ran into browser issues and SF recommended it keeping it all in Visualforce.

 

However, I wanted to understand what was happening so I decided to do a simple test with very limited functionality (based on a sample SF provided me).

 

Basically I have an input field and from the you can choose to add it to the list (I do this using jquery). My problem is that when I hit the Save button the method is not running. I does if I don't add anything to the list.

 

Any help is greatly appreciated.

 

Thanks,

 

Pedro

 

 

<apex:page Controller="C05423993">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"/>
    <apex:form title="Customize" styleClass="oRight">
        <apex:pageBlock title="Case Views">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" id="saveButton" value="Save"/>
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>
            <apex:inputText value="{!OptionTextbox}" id="textbox"/>
            <script>
                var textBox ='{!$Component.textbox}';
            </script>         
            <div class="duelingListBox" id="duel">
                <table class="layout">
                    <tr>
                         <td class="buttonCell">
                            <div class="text">Add</div>
                            <div class="text">
                                <a href="javascript&colon;addAccountsJS();">
                                    <img src="/s.gif" alt="Add"  class="rightArrowIcon" title="Add"/>
                                </a>
                            </div>
                            <div class="text">
                                <a href="javascript&colon;removeAccountsJS();">
                                    <img src="/s.gif" alt="Remove"  class="leftArrowIcon" title="Remove"/>
                                </a>
                            </div>
                            <div class="duelingText">Remove</div>
                        </td>
                    </tr>
                </table>
            </div>
            <apex:selectList value="{!OptionIndex}" size="10" id="List">
                <apex:selectOptions value="{!Options}" />
            </apex:selectList>
            <script>
                var list ='{!$Component.List}';
            </script>
        </apex:pageBlock>
    </apex:form>
   
    <script>
   
        var j$ = jQuery.noConflict();
        var selectListB = j$(esc(list));                  
               
        function esc(myid) {
            return '#' + myid.replace(/(:|\.)/g,'\\\\$1');
        }
 
        function addAccountsJS(){
            alert(j$(esc(textBox)).attr('type'));
            selectListB.append("<option selected='true' value='" + j$(esc(textBox)).attr("value") + "'>" + j$(esc(textBox)).attr("value") + "</option>");
        }
        function removeAccountsJS(){
            j$(esc(textBox)).attr('value','');
            alert('Remove');     
        }
 
    </script>   
</apex:page>
public class C05423993 { private Integer rowID = 0; public String OptionTextbox { get; set; } public String OptionIndex { get; set; } public List<SelectOption> Options { get { System.debug('Executing Getter'); if (Options == null) { Options = new List<SelectOption>(); } return Options; } private set; } public PageReference AddEntry() { Options.add(new SelectOption(String.valueOf(rowID++), OptionTextbox)); return null; } public PageReference RemoveEntry() { Integer position = -1; for (SelectOption so : Options) { position++; if (so.getValue() == OptionIndex) { Options.remove(position); break; } } return null; } public PageReference Save() { pagereference newPage = new PageReference('/500T0000002o01S'); newPage.setRedirect(true); System.debug(OptionTextbox); System.debug(Options); return newPage; } public PageReference Cancel() { System.debug(OptionTextbox); return null; } }

 

Hello,

 

I wrote a simple trigger to add a post on the project object whenever a new case is logged under that project. The trigger is working fine whenever I use a standard user but when it is a portal user creating the case, I'm getting the exception:

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Entity is read-only: FeedItem: []

 

Thanks,

 

Pedro

 

Hello,

 

I'm trying to reproduce the search functionality to customize some specific filtering for cases. I have been successful in getting the search to return the desired list and displaying and paging through the list of cases. I’m still missing an important part which will allow the user to drill down on a case (by clicking on the case link in the list) and return back to the search results.

 

Whenever I hit the back button to go back to the previous page, I’m returned to the original Visualforce page which contains the blank filtering criteria and of course, no results. This is to be expected and the constructor for the controller is being executed and a new search is performed.

 

Ideally I would like to return to the same search page result from where the case was called, including the appropriate page. I’ve noticed that the standard search keeps some parameters on the URL on the search page as well as on the detail page for the case selected.

 

Any ideas on how this is accomplished?

 

Thanks,

 

Pedro

  • April 25, 2011
  • Like
  • 0

Hello,

 

I would like to override the default edit page for Cases as we are using them extensible with many records types. Instead of letting the user create a case and select any records type, we are restricting where they might actually create the cases from. For this we are creating custom button that will call the appropriate Visualforce page.

 

I would like to know how to set the record type in the visualforce page as I will have one button per record type. To avoid creating many buttons, I would also like to determine where the calling record so I can set up some default data. For example, if the case is being created from the Contact, I would like to set the Contact and Account information.

 

Thanks,

 

Pedro

  • April 01, 2010
  • Like
  • 0

Hello,

 

I'm trying to reproduce the same functionality I would have with a related list selected on a page layout but filtering the values that actually make up the list. I have found some examples for creating such a list using extensions for the standard controller. I have been able to create and filter the list but I'm missing some functionality such as: (1) the buttons that are usually displayed next to the title of the list, (2) the icon next to the title of the list and (3) the option to display the selection boxex next to each item on the list for multi-record actions.

 

Is it possible to expose this functionality without writing a whole lot of code?

 

Thanks,

 

Pedro

  • February 11, 2010
  • Like
  • 0

Hello,

 

I need to create records to check the SLA on our daily batch operations. The SLAs times are stored in its own object using a string to indicate HH:MM and a picklist value to specify the timezone for the client. Each day I need to generate the expected SLA record based on the date and the time stored in SLA times object to compare against the actual. Ideally, I should be able to create a datetime instance specifying the relevant time zone. However, the only options avaialble in Apex are GMT or current user locale.

 

Is there a way to accomplish the same using what's available in Apex?

 

I could store the time offset from our default time zone (EST) in the SLA object. However, I would need to deal with the periods when Europe and North America switch daylights savings at different dates.

 

Thanks,

 

Pedro

  • October 25, 2011
  • Like
  • 0

A need to create a Datetime value in a given user's timezone.  There are method for the current user and methods for GMT but no method for the current user.

 

Anyone know of a convenient way to do this.  I can get there timezone from the user record.  It will be a string like "America/New_York".  I supposed a could build a table with all the offsets, look up the offset, then construct a datetime in GMT and add the appropriate number of hours.

 

Anyone know of a better way to do this?

 

-Ken

 

Hello,

 

I'm trying to reproduce the same functionality I would have with a related list selected on a page layout but filtering the values that actually make up the list. I have found some examples for creating such a list using extensions for the standard controller. I have been able to create and filter the list but I'm missing some functionality such as: (1) the buttons that are usually displayed next to the title of the list, (2) the icon next to the title of the list and (3) the option to display the selection boxex next to each item on the list for multi-record actions.

 

Is it possible to expose this functionality without writing a whole lot of code?

 

Thanks,

 

Pedro

  • February 11, 2010
  • Like
  • 0