• sd ass
  • 0 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 4
I'm trying to update a field on an object where we have a field capturing data and time named Scheduled Time. I want to update another field X on the same record when the system time matches the time in the scheduled time field. I'm trying to use process builder or flow here but none of them have worked so far as there is no record update.
My VF Page:
<apex:page controller="MyController" renderAs="{!isPDF}" applyBodyTag="false" >

    body { font-family: 'Arial Unicode MS'; }

        size: letter;
            content: "My Content";
            font-family: Helvetica, Arial, sans-serif;
            font-size: 24px;
            font-weight: bolder;
            content: "Yours Sincerely,";
            font-family: Helvetica, Arial, sans-serif;
            font-size: 10px;
body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 14px;
    <div align="right"><strong>Date</strong>: {!DAY(Today())} {!CASE(MONTH(Today()), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 12, 'December', 'Unknown')} {!YEAR(Today())}</div>
    <div align="left">Dear,</div>
 <p>My Text</p>

    <p>My Text</p>    


The above VF page renders as PDF, a custom button PDF is created for it.


This shoes a PDF of the VF page req when the button is clicked. Now I need the same pdf in print view (CTRL+P) when the pdf button is clicked.
So I have changed window.open to window.print("apex/Letter?Id={!Letter__c.Id}","_blank"); , but the print view which i got is of the current page not the pdf rendered.

Can anyone just help or guide me on how to generate print view when my pdf button is clicked

I've been having some problems with replacing a Standard controller view with a Visualforce page following this: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_tabs.htm

The problem is, it's breaking a lot of my apex classes. For example, anything that uses:

Which will throw this error:
Id value is not valid for the Property__c standard controller
Is there another way to get record ids using visualforce pages? We use these frequently

Here is one example of a code that is breaking:

public class ControllerCreateProposalView {
        public Id lId;
        public String convertedId;
        public ControllerCreateProposalView(ApexPages.StandardController stdController){
            lId = ApexPages.CurrentPage().getParameters().get('id');
            System.Debug('#######leadId:' + lId);
        public PageReference convert(){
            Property__c l = [SELECT Id, name, Primary_Contact__c, Primary_Contact__r.id,Store_Number__c, Last_Sale_Date__c, Square_Footage__c, Last_Sale_Price__c, Anchor_GLA__c, CAP_Rate__c, Year_Built__c, Lot__c, Year_Renovated__c, Occupancy__c, Zoning__c, External_ID_APN__c, Number_of_Buildings__c, Number_of_Retail_Units__c, Loan_Balance__c, Maturity_Date__c, Interest_Rate__c, Term__c, Original_Lease_Term__c, Options__c, Term_Remaining_on_Lease__c, Gross_Leasable_Area__c, Type_of_Ownership__c, Parking__c, Parking_Ratio__c, Lease_Type__c, Date_Reported__c, Loan_Amount__c, Loan_Type_bcc__c, LTV__c, Lender__c, Lender_Type__c, Amortization__c, Recourse__c, Current_Interest_Rate__c, Payment__c, Prepayment__c, Proposal_date__c FROM Property__c WHERE Id=:lId LIMIT 1];
            Proposal__c c=new Proposal__c(Name=l.Name, Property__c=l.Id, Client__c=l.Primary_Contact__c, Square_Footage__c=l.Square_Footage__c, CAP_Rate__c=l.CAP_Rate__c, Lot__c=l.Lot__c, Loan_Balance__c=l.Loan_Balance__c, Maturity_Date__c=l.Maturity_Date__c, Term__c=l.Term__c, Original_Lease_Term__c=l.Original_Lease_Term__c, Options__c=l.Options__c, Term_Remaining_on_Lease__c=l.Term_Remaining_on_Lease__c, Anchor_GLA__c=l.Anchor_GLA__c, Occupancy__c=l.Occupancy__c, Number_of_Buildings__c=l.Number_of_Buildings__c, Number_of_Retail_Units__c=l.Number_of_Retail_Units__c, Gross_Leasable_Area__c=l.Gross_Leasable_Area__c, Type_of_Ownership__c=l.Type_of_Ownership__c, Parking__c=l.Parking__c,Parking_Ratio__c=l.Parking_Ratio__c, Year_Built__c=l.Year_Built__c, Lease_Type__c=l.Lease_Type__c, Date_Reported__c=l.Date_Reported__c, Loan_Amount__c=l.Loan_Amount__c, Loan_Type__c=l.Loan_Type_bcc__c, LTV__c=l.LTV__c, Lender__c=l.Lender__c, Interest_Rate__c=l.Interest_Rate__c, Lender_Type__c=l.Lender_Type__c, Amortization__c=l.Amortization__c, Recourse__c=l.Recourse__c, Current_Interest_Rate__c=l.Current_Interest_Rate__c, Payment__c=l.Payment__c, Prepayment__c=l.Prepayment__c);
            insert c;
           l.Sales_Status__c = 'Proposal';
           update l;
            convertedId = c.Id;
            String cID=l.Primary_Contact__r.id;
            System.Debug('<>PROPOSAL<> :' + l );
            System.Debug('<>CEYEDEE<><>cID<><>CEYEDEE<> :' + cID );
                  //update contact stage
            List<Contact> contacts=[SELECT Id, Sales_Status__c FROM Contact WHERE id=:cID];
    System.Debug('<>LIST<><>contacts<><>LIST<> :' + contacts );
            for(Contact i: contacts)
            update i;
            String sServerName = ApexPages.currentPage().getHeaders().get('Host');
            sServerName = 'https://'+sServerName+'/';
            System.Debug('#######sServerName :' + sServerName );
            String editName='/e?retURL=%2F'+convertedId;
            PageReference retPage = new PageReference(sServerName + convertedId+editName);
            System.Debug('#######retPage :' + retPage );
            return retPage;
        public PageReference back(){
                String sServerName = ApexPages.currentPage().getHeaders().get('Host');
            sServerName = 'https://'+sServerName+'/';
            System.Debug('#######sServerName :' + sServerName );
            PageReference retPage = new PageReference(sServerName + lId);
            System.Debug('#######retPage :' + retPage );
            return retPage;

Are there any alternatives to

I have a simple formula field, below, which evaluates correctly when viewing it in the page layout.


if (User__r.Profile.Name = 'System Administrator', 'FIXED TRUE', User__r.Profile.Name)


The problem I have is when I try and lookup / reference the field in SOQL, i get a different result to what i see in the page layout, SOQL below:


select name, isActive__c from Incentive_Plan__c where user__c =:UserId


For the simple formula field logic above, the SOQL query returns the value 'PT1 ', I have no idea where it is getting this value from !


Hope someone can explain this behaviour.



  • July 04, 2012
  • Like
  • 1