Skip to main content

#Visualforce토론 중인 항목 22개

http://www.salesforce.com/us/developer/docs/pages/index.htm

Is there something I can add to my visualforce code to hide the Upload Files button. I made the relate list read only but that did not do anything #Visualforce  #Lightning Experience 

답변 4개
  1. 6월 9일 오후 5:54

    @larson vikky It is it sufficient to hide the UI button while still allowing uploads through API or other controlled channels

0/9000
Hi

I wrote One soap class i checked developer consloe its displyed country and state values .

//Generated by wsdl2apex

public class GlobalWhetherClass {

    public class GetWeather_element {

        public String CityName;

        public String CountryName;

        private String[] CityName_type_info = new String[]{'CityName','http://www.webserviceX.NET',null,'0','1','false'};

        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};

        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};

        private String[] field_order_type_info = new String[]{'CityName','CountryName'};

    }

    public class GetCitiesByCountry_element {

        public String CountryName;

        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};

        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};

        private String[] field_order_type_info = new String[]{'CountryName'};

    }

    public class GetWeatherResponse_element {

        public String GetWeatherResult;

        private String[] GetWeatherResult_type_info = new String[]{'GetWeatherResult','http://www.webserviceX.NET',null,'0','1','false'};

        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};

        private String[] field_order_type_info = new String[]{'GetWeatherResult'};

    }

    public class GetCitiesByCountryResponse_element {

        public String GetCitiesByCountryResult;

        private String[] GetCitiesByCountryResult_type_info = new String[]{'GetCitiesByCountryResult','http://www.webserviceX.NET',null,'0','1','false'};

        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};

        private String[] field_order_type_info = new String[]{'GetCitiesByCountryResult'};

    }

    public class GlobalWeatherSoap {

        public String endpoint_x = 'http://www.webservicex.com/globalweather.asmx';

        public Map<String,String> inputHttpHeaders_x;

        public Map<String,String> outputHttpHeaders_x;

        public String clientCertName_x;

        public String clientCert_x;

        public String clientCertPasswd_x;

        public Integer timeout_x;

        private String[] ns_map_type_info = new String[]{'http://www.webserviceX.NET', 'GlobalWhetherClass'};

        public String GetCitiesByCountry(String CountryName) {

            GlobalWhetherClass.GetCitiesByCountry_element request_x = new GlobalWhetherClass.GetCitiesByCountry_element();

            request_x.CountryName = CountryName;

            GlobalWhetherClass.GetCitiesByCountryResponse_element response_x;

            Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element>();

            response_map_x.put('response_x', response_x);

            WebServiceCallout.invoke(

              this,

              request_x,

              response_map_x,

              new String[]{endpoint_x,

              'http://www.webserviceX.NET/GetCitiesByCountry',

              'http://www.webserviceX.NET',

              'GetCitiesByCountry',

              'http://www.webserviceX.NET',

              'GetCitiesByCountryResponse',

              'GlobalWhetherClass.GetCitiesByCountryResponse_element'}

            );

            response_x = response_map_x.get('response_x');

            return response_x.GetCitiesByCountryResult;

        }

        public String GetWeather(String CityName,String CountryName) {

            GlobalWhetherClass.GetWeather_element request_x = new GlobalWhetherClass.GetWeather_element();

            request_x.CityName = CityName;

            request_x.CountryName = CountryName;

            GlobalWhetherClass.GetWeatherResponse_element response_x;

            Map<String, GlobalWhetherClass.GetWeatherResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetWeatherResponse_element>();

            response_map_x.put('response_x', response_x);

            WebServiceCallout.invoke(

              this,

              request_x,

              response_map_x,

              new String[]{endpoint_x,

              'http://www.webserviceX.NET/GetWeather',

              'http://www.webserviceX.NET',

              'GetWeather',

              'http://www.webserviceX.NET',

              'GetWeatherResponse',

              'GlobalWhetherClass.GetWeatherResponse_element'}

            );

            response_x = response_map_x.get('response_x');

            return response_x.GetWeatherResult;

        }

    }

}

but new requirement is whenever select the country then display the state values in visualforce page .

Thanks in advance

Raj
답변 1개
  1. 6월 6일 오전 7:34

    Hi, 

     

    You'll need a Visualforce page with an Apex controller that calls your GlobalWhetherClass — using a <apex:actionSupport> to re-render the cities list when country changes.  

     

    public class WeatherController {

    public String selectedCountry { get; set; }

    public String citiesResult { get; set; }

    public List<SelectOption> getCountries() {

    return new List<SelectOption>{

    new SelectOption('India', 'India'),

    new SelectOption('United States', 'United States'),

    new SelectOption('United Kingdom', 'United Kingdom')

    // Add more as needed

    };

    }

    public void fetchCities() {

    if (String.isNotBlank(selectedCountry)) {

    GlobalWhetherClass.GlobalWeatherSoap svc = new GlobalWhetherClass.GlobalWeatherSoap();

    citiesResult = svc.GetCitiesByCountry(selectedCountry);

    }

    }

    }

     

    <apex:page controller="WeatherController">

    <apex:form>

    <apex:pageBlock title="Weather Lookup">

    <apex:pageBlockSection>

    <apex:selectList value="{!selectedCountry}" size="1">

    <apex:selectOptions value="{!countries}"/>

    <apex:actionSupport event="onchange"

    action="{!fetchCities}"

    reRender="citiesBlock"/>

    </apex:selectList>

    </apex:pageBlockSection>

    <apex:pageBlockSection id="citiesBlock">

    <apex:outputText value="{!citiesResult}" escape="false"/>

    </apex:pageBlockSection>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

     

     

    • User selects a country from the dropdown
    • onchange fires fetchCities() via actionSupport
    • Controller calls GetCitiesByCountry on your SOAP class
    • Result re-renders in citiesBlock without a full page refresh

     

    Make sure

    http://www.webservicex.com is added to your Remote Site Settings

    (Setup → Remote Site Settings) — otherwise the callout will be blocked. 

      

    Hope this helps!

0/9000
Hi, 

I am trying to access visual force page through base url as below. But I am receiving an error message saying "Your account has been disabled

Your company administrator has disabled access to the system for you. Please contact your administrator for more information "

But when go to Visual force page and click on Preview its working. Any  thoughts why its happenning so. 
답변 6개
0/9000
Hi, I'm trying to have all pictures and pdfs in the attachment of a record displayed in a Visualforce page when a user klick on a button"View all files". I keep getting the Error:

"System.ListException: List index out of bounds: 0

Class.displayImageExtension.getFileId: line 15, column 1"

I'm an administrator and just beginning to code. Please help. Thank you.

here is my Code:

Controller:

Public Class displayImageExtension {

    String recId;

    

    public displayImageExtension(ApexPages.StandardController controller) {

        recId = controller.getId();    

    }

    

    public List<String> getFileId() {

        String[] fileId = new List<String>();

        List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId order By LastModifiedDate DESC ];

        if( attachedFiles != null && attachedFiles.size() > 0 ) {

        for (Integer i=0 ; i < attachedFiles.size(); i++) {   

            

            fileId[i] = attachedFiles[i].Id;

            }      

        }

        return fileId;

            

    }

}

Visualforce page:

<apex:page standardController="Account" extensions="displayImageExtension">

<apex:form >

<apex:image url="/servlet/servlet.FileDownload?file={!FileId}"/>

</apex:form>

</apex:page>
답변 3개
  1. 2016년 5월 9일 오후 6:33
    Hi Suchawalee,

    What you are doing is trying to access 0 index of an empty List which is giving you IndexOutOfBoundException.

    Change the line,

    fileId[i] = attachedFiles[i].Id;

    with

    fieldId.add(attachedFiles[i].Id);

    Example :

     

    List<String> li = new List<String>();

    System.debug(li.isEmpty()); // true

    Also on page you must iterate the list,

     

    <apex:page standardController="Account" extensions="displayImageExtension">

    <apex:form >

    <apex:repeat value="{!FileId}" var="v">

    <apex:image url="/servlet/servlet.FileDownload?file={!v}"/>

    </apex:repeat>

    </apex:form>

    </apex:page>

    Hope it helps!

     
0/9000
Hi Everyone,

 I have created a google map to show a route between 2 points

and it is working fine

but I want to set the zoom level according to these 2 points so I can see complete route 

do you have any idea how to do this

 

<apex:page standardController="sustain_app__EnergyConsumption__c" extensions="Rg_DistanceCalculator">

<html>

<head>

<style>

⌗map-layer {

max-width: 1500px;

min-height: 550px;

}

.lbl-locations {

font-weight: bold;

margin-bottom: 15px;

}

.locations-option {

display:inline-block;

margin-right: 15px;

}

.btn-draw {

background: green;

color: ⌗ffffff;

}

</style>

<script src="https://code.jquery.com/jquery-3.2.1.js"></script>

</head>

<body>

<div id="map-layer"></div>s

<script>

var map;

var waypoints;

function initMap() {

console.log('Init Method..! ');

var mapLayer = document.getElementById("map-layer");

var centerCoordinates = new google.maps.LatLng(39.888250,-83.088370);

var defaultOptions = { center: centerCoordinates, zoom: 8,scrollwheel: true, }

map = new google.maps.Map(mapLayer, defaultOptions);

var directionsService = new google.maps.DirectionsService;

var directionsDisplay = new google.maps.DirectionsRenderer;

directionsDisplay.setMap(map);

var addressArray = {!listOfAddresses}; // Use this format to fill addressArray

var start =addressArray[0];

var end = addressArray[1];

console.log('Start : ',start);

console.log('end : ',end);

setTimeout(function(){

drawPath(directionsService, directionsDisplay,start,end);

}, 2000);

}

function drawPath(directionsService, directionsDisplay,start,end) {

console.log('Drawing Path !!!!!');

console.log(start+' '+end);

directionsService.route({

origin: start,

destination: end,

optimizeWaypoints: true,

travelMode:'DRIVING'

}, function(response, status) {

if (status === 'OK') {

directionsDisplay.setDirections(response);

} else {

console.log('Problem in showing direction due to ' + status);

}

});

}

</script>

<script src="https://maps.googleapis.com/maps/api/js?key=*********************************************callback=initMap">

</script>

</body>

</html>

</apex:page>

Thank You

Rahul​​​​​​​
답변 2개
  1. 3월 16일 오전 11:49

    Hello,  Just add map.fitBounds(response.routes[0].bounds); inside your drawPath function's success callback, right after you set the directions. This uses the route's built-in coordinates to automatically snap the camera to the perfect zoom level that keeps both points on screen. Also, keep an eye on your script URL 

0/9000
Hi, i created a static resource to attach my logo in salesforce.then i copied the url and inserted in vf page .

i used the following code

<img src="https://ayush--recruitmen--c.visualforce.com/resource/1659528741000/ayushLogo?" style="width:250px;height:50px;" />.

My logo is not visible .it showing like this in preview . can anyone tell me why it is not visible. the image which i attached was jpeg format.

how to insert logo in vfpage?

thanks in advance
답변 4개
  1. 2022년 8월 8일 오전 9:33
    Hi Suji,

    Please follow below concepts

    apex:image A graphic image, rendered with the HTML <img> tag.

    Example

    <apex:image id="theImage" value="/img/myimage.gif" width="220" height="55"/>

    The example above renders the following HTML:

    <img id="theImage" src="/img/myimage.gif" width="220" height="55"/>

    Resource Example

    <apex:image id="theImage" value="{!$Resource.myResourceImage}" width="200" height="200"/>

    The example above renders the following HTML:

    <img id="theImage" src="<generatedId>/myResourceImage" width="200" height="200"/>

    Zip Resource Example

    <apex:image url="{!URLFOR($Resource.TestZip, 'images/Bluehills.jpg')}" width="50" height="50" />

    The example above renders the following HTML:

    <id="theImage" src="[generatedId]/images/Bluehills.jpg" width="50" height="50"/>

    if you need any assistanse, Please let me know!!

    Kindly mark my solution as the best answer if it helps you.

    Thanks

    Mukesh
0/9000

There are only 23 calendar days left to prepare for the Spring '26 Release ! 

 

Check out Salesforce Spring ‘26 Release: What to Expect and How to Prepare ahead of time to ensure the following features don't break; 

 

  • Calculate Tax-Only and Product-Only Price Adjustments
  • Escape the Label Attribute of <apex:inputField> Elements to Prevent Cross-Site Scripting in Visualforce Pages
  • Update Instanced URLs in API Traffic
  • Migrate to a Multiple-Configuration SAML Framework
  • Restrict User Access to Run Flows

 

#Salesforce Developer #Flow #Salesforce Admin #Sales Cloud #Salesforce #TrailblazerCommunity #Salesforce Platform #SAML #Visualforce

 

@* Salesforce Administrators * @Trailblazer Community Cove @* Salesforce Platform * @* Customer Success * @* Salesforce Developers * @Architect Trailblazers @Salesforce Flow Automation

댓글 2개
  1. 2025년 12월 17일 오후 12:32

    Hello, Spring ’26 Release—now’s the time to prepare. 

    Review upcoming changes early to prevent broken

0/9000
Peter Keane 님이 #Experience Cloud에 글을 올렸습니다

I have a problem with accessing individual products on our Marketplace site. It’s built on experience cloud.

The external site is presented in an iframe wrapped in a visualforce page. As a result when a specific products url is clicked rather than go to that product it returns to the home page.

For example to get to the product page for Google Workspace, its link is

https://www.aitechsourcing.com?bf_redirect=%252Fgoogle-google-workspace

However when that is clicked the home page not the product page is returned. That page is

https://AITechSourcing.com

.

Can anyone offer me recommendations on how to have the specific product pages available to display when their link is clicked?

Thanks.

Pete

#Experience Cloud #VisualForce Page #Visualforce #Iframe Src #Iframe
댓글 2개
  1. 2024년 12월 28일 오전 6:22

    Hi Pete,

    Here are a few recommendations that might help resolve this issue:

    1. Check URL Encoding: Ensure that the URL parameters are correctly encoded. Sometimes, special characters in URLs can cause unexpected behavior.
    2. Verify X-Frame-Options: Ensure that the external site allows being displayed in an iframe. Some websites set the X-Frame-Options HTTP header to prevent being embedded in iframes. You can check this by inspecting the network requests in your browser's developer tools.
    3. Use Apex:iframe: If you're not already using it, consider using the apex:iframe component instead of a standard iframe. This component is designed for embedding external content in Visualforce pages and might handle URL parameters better1.
    4. Update Visualforce Page: Ensure that your Visualforce page is correctly configured to handle URL parameters. You might need to adjust the URL handling logic in your Visualforce page to ensure it correctly parses and redirects to the desired product page.
    5. Test in Different Browsers: Sometimes, browser-specific behaviors can cause issues with iframes. Test the behavior in different browsers to see if the issue persists.
0/9000
We have a customer experience with a custom login page.  I have updated the guest user profile to have access to the apex classes and visualforce pages upon login.  When I test as a user (incog window) and try to login I get this error :

Error:

Your login attempt has failed. Make sure the username and password are correct.

I then click forgot my password and reset the password and it logs me in.  When I log out and then try and log back in it throws the same error:

Error:

Your login attempt has failed. Make sure the username and password are correct.

I have double and tripple checked the apex class and visualforce access for both the guest user profile and the actual user profile and it still isn't working.  

Does anyone have any idea what might be going on?
답변 4개
  1. 1월 29일 오전 5:45

    ADP TotalSource is a game-changer for managing HR efficiently, and I’ve seen firsthand how it simplifies payroll processing and benefits administration for small businesses. Throughout this post, we covered key aspects like ADP TotalSource Login, ADP TotalSource Features, Payroll and Benefits Management, HR Compliance, and Employee Self-Service. 

     

0/9000
Hey folks,

I'm using  style="-fs-table-paginate: paginate;" on my apex:pageBlockTable and it is successfully adding my header row to each page of my PDF, BUT, it is also showing the footer facet on every page, which I do not want. I want the total row to appear only on the final page. Any tips on how to achieve this would be most appreciated. Here is a cut-down version of my page.

<apex:page renderAs="PDF" controller="PaymentAdviceController" applyBodyTag="false" applyHtmlTag="false" showHeader="false">

    <head>

       <style>

        @page {

             margin: 1in;

             size: 25in 15in;

             @bottom-center {

                font-family: Dialog;

                content: "Page " counter(page) " of " counter(pages);

            }

           }

        .col1 {width:160px; text-align:left;}

        .col2 {width:1800px; text-align:center;}

        .col3 {width:220px; text-align:right;}

        .headerRow .TableTitleCenter {

            background-color: ⌗ff5b5b;

            font-family: Dialog;

            text-align:center;

            padding:4px;

        }

        .headerRow .TableTitle {

            background-color: ⌗ff5b5b;

            font-family: Dialog;

            padding:4px;

        }

        .tableCell{

            page-break-inside: avoid;

        }

       </style>

    </head>

    <apex:panelGrid columns="3" columnClasses="col1,col2,col3">

        <img src="{!$Resource.DDLogo}" height="143px" width="223px" align="left" />

        <apex:panelGrid columns="2" width="100%" style="font-weight:bold;font-family: Dialog;font-size:25px">Telstra Commissions Payment Advice</apex:panelGrid>

        <apex:panelGrid columns="1" width="100%" style="font-style:bold;font-family: Dialog;">

            <apex:outputText value="{0, date,  dd/MM/yyyy}" >Date Processed: <apex:param value="{!dateFriday}" /></apex:outputText>

        </apex:panelGrid>

    </apex:panelGrid>

    <apex:pageBlock>

        <apex:pageBlockTable value="{!Payments}" var="payment" border="1px" width="100%" cellpadding="0px" style="-fs-table-paginate: paginate;">

            <apex:column headerValue="Account Number" headerClass="TableTitleCenter" style="font-family: Dialog;text-align:center;font-size:13px;padding:4px;">

                <apex:outputText value="{!payment.Expected_Commission__r.Project__r.Account__r.AccountNumber}" style="tableCell" />

                <apex:facet name="footer">

                    <div style="font-family: Dialog;font-size:13px;text-align:right;font-weight:bolder;background-color: ⌗ebebeb;padding:4px;">&nbsp;</div>

                </apex:facet>

            </apex:column>

            <apex:column headerValue="Total Ex GST" headerClass="TableTitleCenter" style="font-family: Dialog;font-size:13px;text-align:right;padding:4px;">

            <apex:outputText value="{0, number, Currency}" style="tableCell"><apex:param value="{!payment.Dealer_CN_to_be_raised_Ex__c}" /></apex:outputText>

                <apex:facet name="footer">

                    <div style="font-family: Dialog;font-size:13px;text-align:right;font-weight:bolder;background-color: ⌗ebebeb;padding:4px;">${!exclGST}</div>

                </apex:facet>

            </apex:column>

            <apex:column headerValue="Total Inc GST" headerClass="TableTitleCenter" style="font-family: Dialog;font-size:13px;text-align:right;padding:4px;" >

                <apex:outputText value="{0, number, Currency}" style="tableCell"><apex:param value="{!payment.Dealer_Total_Inc_GST__c}" /></apex:outputText>

                <apex:facet name="footer">

                    <div style="font-family: Dialog;font-size:13px;text-align:right;font-weight:bolder;background-color: ⌗ebebeb;padding:4px;">${!inclGST}</div>

                </apex:facet>

            </apex:column>

            <apex:column headerValue="Credit Note Number" headerClass="TableTitleCenter" style="font-family: Dialog;text-align:center;font-size:13px;padding:4px;">

                <apex:outputText value="{!payment.Credit_Note__c}" style="tableCell" />

                <apex:facet name="footer">

                    <div style="font-family: Dialog;font-size:13px;text-align:right;background-color: ⌗ebebeb;padding:4px;">&nbsp;</div>

                </apex:facet>

            </apex:column>

        </apex:pageBlockTable>

    </apex:pageBlock>

    <br/>

    <apex:outputText style="font-family: Dialog;font-size:12px" value="Some trailing text here:"/>

    <br/>

</apex:page>
답변 3개
  1. 2월 2일 오전 7:26

    Hello, 

    To stop the footer from repeating, you should

    remove the <apex:facet name="footer"> tags from inside the table and place your totals in a separate <div> or <table> immediately following the </apex:pageBlockTable>.

    This works because the -fs-table-paginate property specifically forces <thead> and <tfoot> elements (which facets generate) to repeat on every page break; moving the data outside the table context ensures it only renders once at the very end of your data list.

0/9000