function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how to assign a value fetched from the constructor to a visualforce field

on executing a class I am getting the value from external system , that value is in the constructor  .... but i need to assign that particular value to a visualforce page field   


Thanks in advance 


You need to create one property in apex class


for e.g.


public with sharing class SampleClass()


 public string ExternalValue{get;  set;}


 public SampleClass()


   // Your code to fetch value from external system.

   // suppose "test" is the value returned from your external system.

   string s = 'test';

   ExternalValue = s;




Now you can bind "ExternalValue" to the VF page.