You need to sign in to do that
Don't have an account?
Mayank Mohan
Einstein Vision API visualforce page code : Getting error "Error: Unknown property 'String.label' "
I am getting the above error while creating Visualforce page through code provided by Salesforce in Trailhead for Einstein.This was downlaoded from Github provided through link provided by Salesforce. Not sure what the error is and not able to resolve. Any help will be great. Stuck in the trailhead.
The stage is for Trailhead Module : Get Smart with Salesforce Einstein Quick Start: Einstein Image Classification: Create the Visualforce Page
<apex:page Controller="VisionController">
<apex:form >
<apex:pageBlock >
<apex:image url="https://einstein.ai/images/generalimage.jpg">
</apex:image>
<br/>
<apex:repeat value="{!AccessToken}" var="accessToken">
Access Token:<apex:outputText value="{!accessToken}" /><br/>
</apex:repeat>
<br/>
<apex:repeat value="{!callVisionUrl}" var="prediction">
<apex:outputText value="{!prediction.label}" />:<apex:outputText value="{!prediction.probability}" /><br/>
</apex:repeat>
</apex:pageBlock>
<!-- <apex:pageBlock > -->
<!-- <apex:repeat value="{!callVisionContent}" var="prediction"> -->
<!-- <apex:outputText value="{!prediction.label}" />:<apex:outputText value="{!prediction.probability}" /><br/> -->
<!-- </apex:repeat> -->
<!-- </apex:pageBlock> -->
</apex:form>
</apex:page>
The stage is for Trailhead Module : Get Smart with Salesforce Einstein Quick Start: Einstein Image Classification: Create the Visualforce Page
<apex:page Controller="VisionController">
<apex:form >
<apex:pageBlock >
<apex:image url="https://einstein.ai/images/generalimage.jpg">
</apex:image>
<br/>
<apex:repeat value="{!AccessToken}" var="accessToken">
Access Token:<apex:outputText value="{!accessToken}" /><br/>
</apex:repeat>
<br/>
<apex:repeat value="{!callVisionUrl}" var="prediction">
<apex:outputText value="{!prediction.label}" />:<apex:outputText value="{!prediction.probability}" /><br/>
</apex:repeat>
</apex:pageBlock>
<!-- <apex:pageBlock > -->
<!-- <apex:repeat value="{!callVisionContent}" var="prediction"> -->
<!-- <apex:outputText value="{!prediction.label}" />:<apex:outputText value="{!prediction.probability}" /><br/> -->
<!-- </apex:repeat> -->
<!-- </apex:pageBlock> -->
</apex:form>
</apex:page>
Please try below code: Note: I had the same issue - found an error in VisionController apex class line 6. Changed code from Worked fine after that.
Please let us know if this helps.
Mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
All Answers
Please try below code: Note: I had the same issue - found an error in VisionController apex class line 6. Changed code from Worked fine after that.
Please let us know if this helps.
Mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra
Thanks for posting an answer. I changed the code in the Predict visualforce step to the code you gave and then also tried correcting the error you spotted in the VisionController apex class but still am running into the same String.label error.
If you have any advice I would love to hear.
Have you been able to resolve this issue? I have the same error message! If you did, would you mind sharing you solution please?
Thank you!