Service Appointments

Appointmen tNumber: {!sa.AppointmentNumber}

Account: {!sa.AccountId}

Work Type: {!sa.WorkTypeId}

Due Date: {!sa.DueDate}

Description: {!sa.Description}

Service Territory: {!sa.ServiceTerritoryId}

Address: {!sa.Address} {!sa.City}

Created By: {!sa.CreatedById}

Print This View ", "answerCount": 1, "upvoteCount": 0, "datePublished": "2026-01-12T19:11:51.000Z", "author": { "@type": "Person", "name": "Michelle Johnson", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000E7gaaQAB", "affiliation": { "@type": "Organization", "name": "Ashberry Water Conditioning" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "hy @Michelle Johnson https://trailblazers.salesforce.com/profileView?u=0053A00000E7gaaQAB , The error happens because the page is calling itself using the same Visualforce URL, which creates a circular reference. You also have two apex:page tags, which is not allowed. Use only one apex:page, keep the standardController with recordSetVar, and remove the self-referencing link logic. For list view printing, you don’t need to reload the same page with a parameter; instead, render the list once and trigger window.print() directly, or use a separate Visualforce page purely for printing. That will avoid the cyclic reference and the error.", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000mjSbW0AU", "datePublished": "2026-01-18T11:07:50.000Z", "author": { "@type": "Person", "name": "shefali tanwar", "url": "https://trailblazers.salesforce.com/profileView?u=005KX000003vIqEYAU", "affiliation": { "@type": "Organization", "name": "Trail Guild" } } } ] } } Skip to main content

Hello, 

 

I'm not a developer but I'm trying to create custom print button for a Service Appointment list view. Unfortunately, the Service Appointment object doesn't have Printable View button. I found a code online, although, I'm getting an error: 

Error: Cyclic page or component references '/apex/PrintServiceAppointmentList' are not allowed

 

 

If someone can kindly give me some tips on the code below, I would appreciate it. Thank  you! 

 

<apex:page> 

<apex:page standardController="ServiceAppointment" recordSetVar="s" applyHtmlTag="false" showHeader="false" sidebar="false"> 

    <apex:slds />  

    <apex:outputPanel rendered="{!NOT(ISNULL(paramPrint))}"> 

        <script> 

            window.print(); // Triggers the print dialog 

        </script> 

    </apex:outputPanel> 

    <apex:outputPanel rendered="{!ISNULL(paramPrint)}"> 

        <div class="slds-scope"> 

            <h1 class="slds-text-heading_large">Service Appointments</h1> 

            <apex:repeat value="{!s}" var="sa"> 

                <div class="slds-box slds-m-bottom_small"> 

                    <p><b>Appointmen tNumber:</b> {!sa.AppointmentNumber}</p> 

                    <p><b>Account:</b> {!sa.AccountId}</p> 

                    <p><b>Work Type:</b> {!sa.WorkTypeId}</p> 

                    <p><b>Due Date:</b> {!sa.DueDate}</p> 

                    <p><b>Description:</b> {!sa.Description}</p> 

                    <p><b>Service Territory:</b> {!sa.ServiceTerritoryId}</p> 

                    <p><b>Address:</b> {!sa.Address} {!sa.City}</p> 

                    <p><b>Created By:</b> {!sa.CreatedById}</p> 

               </div> 

            </apex:repeat> 

        </div> 

        <!-- Button to view printable version -->  

       </apex:outputPanel> 

     <a href="/apex/PrintServiceAppointmentList?paramPrint=1" target="CarlosPMsUpcoming" class="slds-button slds-button_brand">Print This View</a> 

</apex:page> 

</apex:page> 

 

 

@Salesforce Developers

 

#Salesforce Developers

 

 

1 risposta
  1. 18 gen, 11:07

    hy @Michelle Johnson, The error happens because the page is calling itself using the same Visualforce URL, which creates a circular reference. You also have two apex:page tags, which is not allowed. Use only one apex:page, keep the standardController with recordSetVar, and remove the self-referencing link logic. For list view printing, you don’t need to reload the same page with a parameter; instead, render the list once and trigger window.print() directly, or use a separate Visualforce page purely for printing. That will avoid the cyclic reference and the error.

0/9000