• Ozymandias
  • NEWBIE
  • 55 Points
  • Member since 2008

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 24
    Replies

I have a trigger on a custom object called "Time_Entry__c" that; when a record is created and *IF* there is a related contract associated with the Time Entry, it looks up the rates set-out on that contract record and uses the rates listed in the parent (Contract) record.

 

  Rate_1__c  (currency field)

  Rate_2__c  (currency field)

 

The look-up field on the Time_Entry__C object is called Contract__c

 

The related object is the Contract object in SF:  Contract__r

 

Contract__r has the two currency fields.

 

    CustomRate1__c

    CustomRate2__c

 

 

What I need is to have my trigger, look up the parent contract (if there is a value in Contract__c). and pull the two rates CustomRate1__c and CustomRate2__c and populate them into the Time Entry records Rate_1__c and Rate_2__c respectively.

 

Can anyone help with code for this trigger???

 

 

  • January 02, 2012
  • Like
  • 0

How do you create a standard object say 'Contact' record of a particular RecordType say 'InternalContact' from a VF page? When I create the contact using standard controller, the default Contact record gets created not the internalContact recordtype. How do we do this cast?

I have a custom object with a multi-select picklist field and I'm trying to create a VF page that allows users to search for the custom object records using values of the multi-select picklist as criteria.

 

To do this, I've created a container object in the controller, and bind an <apex:inputField> to the container object's multi-select picklist field, so that the VF page displays the standard multi-select component. It works fine for me, but if a user with a profile that doesn't have Create permission on that object opens the page, the multi-select picklist field is blank. Is it possible to display the multi-select picklist field regardless of the user's object permission?

I'm trying to use the Force.com Migration Tool to make a Developer Edition org an exact copy of what we've configured and developed in our Production org. Retrieving the metadata hasn't been an issue but I've hit some roadblocks while attempting to deploy everything to the Developer org. From the looks of it, the errors are mostly due to dependencies.

 

Has anyone successfully done this? If so, I'd appreciate it if you could share any tips or lessons learned as it would save me some time trying to figure it out. Let me know if you need additional info from me as well.

 

 

I've been trying to implement a custom component that makes use of the modal dialog described in this article. The modal dialog has input fields that are bound to the custom component controller. The component code kind've looks like this:

 

<apex:component controller="myCustomComponentController">
    ... YUI scripts...
    <div id="searchDialog">
       ...
       <apex:actionRegion>
           ...
           <apex:inputText value="{!searchField1}"/>
           <apex:inputText value="{!searchField2}"/>
           <apex:inputText value="{!searchField3}"/>
 
           <apex:commandButton value="Search" action="{!doSearch}" rerender="searchResults"/>
           ...
       </apex:actionRegion>

    </div>

</apex:component>

 

The issue I'm running into is that once I put the actionRegion in the modal dialog div, it doesn't seem to copy the values in the inputText fields to the controller when I click on the Search button. When I remove the modal dialog functionality (i.e. the search fields and buttons can be seen always), it works fine.

 

Does anyone have any idea why it behaves this way and if it is possible to fix it?

 

I'm currently using the inlineEditSupport component to allow users to edit certain fields in a pageBlockTable that displays a list of custom objects. It works fine, although I can't figure out how to make the standard pencil icon appear when you hover over a table cell that allows inline editing. Without this, it isn't obvious to the user that they could edit the cell by double-clicking on it.

 

Can anyone point me in the right direction?

Hi,

 

Hoping someone out there could shed some light on a problem I've been having on a VF page that displays data as pdf.

 

The VF page I'm working on is basically a query tool that retrieves data from the DB and displays them in a report. It should have 2 display modes: display on screen and display as pdf. I've tried to implement it by creating two VF pages using one controller. The 1st page has the form where users input the query criteria, and displays the query results in a pageBlock, and the 2nd page is just a page that displays the query results on a page with renderAs="pdf". The pdf page uses a different collection (a List of Lists) to display the results for pagination purposes.

 

The code looks somewhat like this:

 

 

public class MyController {
    
    public List<DataObject> queryResults {get; private set;}

    public List<List<DataObject>> queryResultsForPDF {get; private set;}

    public void runQuery() {
        ...
        // run SOQL query and marshall results into queryResults
        ...
    }
    
    public PageReference viewAsPDF() {
        runQuery();
        ...
        // split queryResults into separate batches and insert into queryResultsForPDF
        ...
        return Page.MyReportPDF;
    }
}
<!-- MyReport VF Page -->
<apex:page controller="MyController">
...
<apex:commandButton action="{!runQuery}" value="Display on screen" rerender="report_block"/>
<apex:commandLink action="{!viewAsPDF}" value="Display as PDF" target="_blank"/>

<apex:pageBlock id="report_block">
... displays report data from queryResults
</apex:pageBlock>

</apex:page>

<!-- MyReport PDF Page -->
<apex:page controller="MyController" renderAs="pdf">

<apex:pageBlock id="report_block">
... displays report data from pdfQueryResults
</apex:pageBlock>

</apex:page>

 

The report displays fine in the on screen display. However, when I try to do the view as PDF, the data always comes out as empty. I've gone through the debug logs and queryResultsForPDF does get initialized, but for some reason, when the pdf VF page retrieves it, it always comes out as empty (Hope this makes sense)

 

It seems like the controller instance variables I set in viewAsPDF() aren't reflected in the pdf VF page. Can anyone point out what I'm doing wrong?

 

 

Hi,

 

I'm trying to get our company's users to use Default Account and Sales Teams to share their records. However, I just found out that our standard users only see Read Only when they try to set Contact and Opportunity Access. I, having a System Administrator profile, can see both Read Only and Read/Write. Our standard user profile has read, create, edit & delete access on Accounts, Contacts and Opps.

 

I can't seem to find anything else on the Profiles or any documentation that shows how to allow a user to set Read/Write on Contacts and Opps on Default Account Teams. Can anyone point me in the right direction?

 

Thanks.

My company stores a bunch of consultant records in Salesforce (think of them as the products that we "sell"), and I'm trying to generate a visualforce page that shows their image along with the other details. The consultant headshots are stored outside Salesforce but I'm able to create an image field and display them in the browser with no problem. When it comes to rendering the page as pdf though, the images come out broken.

 

I've already added the server that houses the images in the Remote Site Settings, but still no success. I'm wondering if it's because the site i'm connecting to is an https site, or should it still work regardless of that? Another thing is that the image URLs we're using have a blank character (e.g. https://foo.bar.com/HR/Image%20Library/foobar.jpg). Would that have any effect?

 

Here's a snippet of my vf page in case any of you can point out what I'm doing wrong:

 

 

<apex:page controller="myController" renderAs="pdf">	
...
...
<apex:pageBlock >
<apex:pageBlockTable value="{!consultants}" var="cons">
<apex:column headerValue="Image">
<apex:image value="{!cons.Image_URL__c}"/>
</apex:column>
<apex:column value="{!cons.Name}"/>
...
...
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

Hi folks. I have a requirement to pre-populate certain fields (phone, fax, mobile phone), based on the record type, when creating a new Lead. Currently, this is done through an s-control, but I intend to re-implement it using visualforce. Can anyone give me any pointers on how to do this? I can't seem to find any good examples for this particular case.
I've been trying to migrate configuration changes to some standard objects from one sandbox instance to another using the Eclipse Force.com plugin. For example, I've added a few additional picklist values to a Task field and want to duplicate them on another sandbox without manually doing it through the browser UI. I've tried deploying the changes in the following ways:

1. Through the Force.com -> Deploy to Server... wizard.
2. Using Compare With -> Each Other to manually copy the xml from one sandbox to another.

For both of these procedures, the other sandbox always ignores changes to the object metadata that I'm trying to push to it. Is there any step that I'm missing?
We've implemented some Profile based access control in our instance (e.g. only certain profiles can edit closed opportunities) and currently, the way this is done is that the profile ids are hard-coded in S-controls that control the flow of the UI.

I'm trying to see if hardcoding can be eliminated by creating a custom object where a profile can be linked to a list of permissions. However, I've hit a snag when creating the linkage between the custom object and profile since the UI doesn't allow me to create a lookup field for profiles.

Has anyone here tried something similar? Is it possible to create a lookup field to profile in a custom object, 'cause it appears to be possible on the User object.
I'm trying to create an email whose body is hardcoded in an Apex class and I'm running into some problems trying to get the URL for the details page of a Task object. I intend to include a link to this object in the email, similar to what you can do when you create an Email Template using the web UI. I've experimented with the PageReference class but all I've been able to get was a relative URL...server URL wasn't included.

Has anyone here done something similar? Appreciate it if anyone can point me in the right direction.

I have a company that has as many as 20 different SalesForce orgs/instance, each with their own Chatter.  We are trying to do a merge into one singular org and would like to keep all past Chatter activity (posts, groups, files, follows, etc) from each of the other 20 old instances.  Is there a simple way to import (and merge) everything into a single org?  If there is no "easy" way to do this, is it possible to do it through the REST API (using a standard Java application)?

 

Notes/Constraints:

This is a one-time process - there is no need to check for duplicate messages

A user may exist on multiple orgs and the user on the master org should have all Chatter-related data from their other accounts

A user will be identified by their email address

All files hosted within each Chatter instance should be moved over to the master instance.

 

Data Export does not appear to be the way to go since it appears to match on internal IDs rather than the email address field we have to match on

The migration tool appears to be mainly for migrating data from Dev to Prod - if this is the correct tool for this task, I'll take another look at it.  It would have to be smart enough to match Chatter activity based on the email, though.

 

  • July 17, 2012
  • Like
  • 0

I have a custom object with a multi-select picklist field and I'm trying to create a VF page that allows users to search for the custom object records using values of the multi-select picklist as criteria.

 

To do this, I've created a container object in the controller, and bind an <apex:inputField> to the container object's multi-select picklist field, so that the VF page displays the standard multi-select component. It works fine for me, but if a user with a profile that doesn't have Create permission on that object opens the page, the multi-select picklist field is blank. Is it possible to display the multi-select picklist field regardless of the user's object permission?

I'm trying to use the Force.com Migration Tool to make a Developer Edition org an exact copy of what we've configured and developed in our Production org. Retrieving the metadata hasn't been an issue but I've hit some roadblocks while attempting to deploy everything to the Developer org. From the looks of it, the errors are mostly due to dependencies.

 

Has anyone successfully done this? If so, I'd appreciate it if you could share any tips or lessons learned as it would save me some time trying to figure it out. Let me know if you need additional info from me as well.

 

 

I have a trigger on a custom object called "Time_Entry__c" that; when a record is created and *IF* there is a related contract associated with the Time Entry, it looks up the rates set-out on that contract record and uses the rates listed in the parent (Contract) record.

 

  Rate_1__c  (currency field)

  Rate_2__c  (currency field)

 

The look-up field on the Time_Entry__C object is called Contract__c

 

The related object is the Contract object in SF:  Contract__r

 

Contract__r has the two currency fields.

 

    CustomRate1__c

    CustomRate2__c

 

 

What I need is to have my trigger, look up the parent contract (if there is a value in Contract__c). and pull the two rates CustomRate1__c and CustomRate2__c and populate them into the Time Entry records Rate_1__c and Rate_2__c respectively.

 

Can anyone help with code for this trigger???

 

 

  • January 02, 2012
  • Like
  • 0

Dear all,

 

I'm sure there's an obvious workaround for this, but I'm not able to find it.

 

I'd like to create a table/repeat with multiple levels on a visualforce page, as below:

 

  • Product A

Sub-Category 1

Sub-Category 2

Sub-Category 3

  • Product B

Sub-category1...

 

I've achieved this by having a nested <rapex:repeat> tab on the visualforce page.

 

I also need to have an input field against the sub-category level settings, which can then pass values back to the controller (on submit, or similar). However, I'm having difficulties working out how to do so. It seems that I can either create a "flat" list and pass input values back, or have nested lists, but then be unable to do so.

 

Is it possible? Could somebody point me in the right direction? I've tried using maps, but it seems like the values of a map aren't changeable from the visualforce page?

 

With thanks,

Andy

 

 

How do you create a standard object say 'Contact' record of a particular RecordType say 'InternalContact' from a VF page? When I create the contact using standard controller, the default Contact record gets created not the internalContact recordtype. How do we do this cast?

Hi,

 

How do I find the history of owners for a Case?

I can see it in the "Case History" related list.

 

Any ideas?

I've been trying to implement a custom component that makes use of the modal dialog described in this article. The modal dialog has input fields that are bound to the custom component controller. The component code kind've looks like this:

 

<apex:component controller="myCustomComponentController">
    ... YUI scripts...
    <div id="searchDialog">
       ...
       <apex:actionRegion>
           ...
           <apex:inputText value="{!searchField1}"/>
           <apex:inputText value="{!searchField2}"/>
           <apex:inputText value="{!searchField3}"/>
 
           <apex:commandButton value="Search" action="{!doSearch}" rerender="searchResults"/>
           ...
       </apex:actionRegion>

    </div>

</apex:component>

 

The issue I'm running into is that once I put the actionRegion in the modal dialog div, it doesn't seem to copy the values in the inputText fields to the controller when I click on the Search button. When I remove the modal dialog functionality (i.e. the search fields and buttons can be seen always), it works fine.

 

Does anyone have any idea why it behaves this way and if it is possible to fix it?

 

I'm currently using the inlineEditSupport component to allow users to edit certain fields in a pageBlockTable that displays a list of custom objects. It works fine, although I can't figure out how to make the standard pencil icon appear when you hover over a table cell that allows inline editing. Without this, it isn't obvious to the user that they could edit the cell by double-clicking on it.

 

Can anyone point me in the right direction?

Hi,

 

Hoping someone out there could shed some light on a problem I've been having on a VF page that displays data as pdf.

 

The VF page I'm working on is basically a query tool that retrieves data from the DB and displays them in a report. It should have 2 display modes: display on screen and display as pdf. I've tried to implement it by creating two VF pages using one controller. The 1st page has the form where users input the query criteria, and displays the query results in a pageBlock, and the 2nd page is just a page that displays the query results on a page with renderAs="pdf". The pdf page uses a different collection (a List of Lists) to display the results for pagination purposes.

 

The code looks somewhat like this:

 

 

public class MyController {
    
    public List<DataObject> queryResults {get; private set;}

    public List<List<DataObject>> queryResultsForPDF {get; private set;}

    public void runQuery() {
        ...
        // run SOQL query and marshall results into queryResults
        ...
    }
    
    public PageReference viewAsPDF() {
        runQuery();
        ...
        // split queryResults into separate batches and insert into queryResultsForPDF
        ...
        return Page.MyReportPDF;
    }
}
<!-- MyReport VF Page -->
<apex:page controller="MyController">
...
<apex:commandButton action="{!runQuery}" value="Display on screen" rerender="report_block"/>
<apex:commandLink action="{!viewAsPDF}" value="Display as PDF" target="_blank"/>

<apex:pageBlock id="report_block">
... displays report data from queryResults
</apex:pageBlock>

</apex:page>

<!-- MyReport PDF Page -->
<apex:page controller="MyController" renderAs="pdf">

<apex:pageBlock id="report_block">
... displays report data from pdfQueryResults
</apex:pageBlock>

</apex:page>

 

The report displays fine in the on screen display. However, when I try to do the view as PDF, the data always comes out as empty. I've gone through the debug logs and queryResultsForPDF does get initialized, but for some reason, when the pdf VF page retrieves it, it always comes out as empty (Hope this makes sense)

 

It seems like the controller instance variables I set in viewAsPDF() aren't reflected in the pdf VF page. Can anyone point out what I'm doing wrong?

 

 

Hi,

 

I'm trying to get our company's users to use Default Account and Sales Teams to share their records. However, I just found out that our standard users only see Read Only when they try to set Contact and Opportunity Access. I, having a System Administrator profile, can see both Read Only and Read/Write. Our standard user profile has read, create, edit & delete access on Accounts, Contacts and Opps.

 

I can't seem to find anything else on the Profiles or any documentation that shows how to allow a user to set Read/Write on Contacts and Opps on Default Account Teams. Can anyone point me in the right direction?

 

Thanks.

Hi folks. I have a requirement to pre-populate certain fields (phone, fax, mobile phone), based on the record type, when creating a new Lead. Currently, this is done through an s-control, but I intend to re-implement it using visualforce. Can anyone give me any pointers on how to do this? I can't seem to find any good examples for this particular case.
I've been trying to migrate configuration changes to some standard objects from one sandbox instance to another using the Eclipse Force.com plugin. For example, I've added a few additional picklist values to a Task field and want to duplicate them on another sandbox without manually doing it through the browser UI. I've tried deploying the changes in the following ways:

1. Through the Force.com -> Deploy to Server... wizard.
2. Using Compare With -> Each Other to manually copy the xml from one sandbox to another.

For both of these procedures, the other sandbox always ignores changes to the object metadata that I'm trying to push to it. Is there any step that I'm missing?