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
Ryan Avent 14Ryan Avent 14 

Issue with VF page parameter

Im trying to dynamicly pull in a custom labbel into my vf page (the page is called in my lwc via apex). during testing i am attempting to call the vf page just passing params in the url however all i see is a blank screen (no errors in the debug log)

Neither the dynamic custom label or the test outhput are showing data, can anyone see what i am doing wrong here?

User-added image

 

VF PAGE

<apex:page showHeader="false" sidebar="false" controller="LabelTranslatorController" language="{!language}" standardStylesheets="false"  >
 <apex:outputText>{!$Label[label]}</apex:outputText>
  <apex:outputText>{!exampleText}</apex:outputText>
</apex:page>
CONTROLER
public with sharing class LabelTranslatorController {

    public String language { get; set; }
    public String label { get; set; }
    public String exampleText { get; set; }

        
    public LabelTranslatorController() {
            Map<String, String> reqParams = ApexPages.currentPage().getParameters();
            language = reqParams.get(language);
            label = reqParams.get(label);
            exampleText = reqParams.get(exampleText);

    }
}

 

Example VF page URL

https://[SF org]/apex/Custom_Label_Translator?language=en_US&label=Process_Object_Create_Error&exampleText=this is an example
 


APEX

@AuraEnabled(cacheable=false)
    global static string getLabelTranslator(String label) {

        try {

            PageReference r = Page.Custom_Label_Translator;// the vf page
            r.getParameters().put('language',  UserInfo.getLocale());
            r.getParameters().put('label', label);
            r.getParameters().put('exampleText', 'this is an exampple');


            string resp = r.getContent().toString();
            
            return r.getContent().toString();
        } catch(Exception e){
            system.debug('Error - ' +  e.getMessage());
            system.debug('Error - ' +  e.getCause());

            return label;
        }  
    }