Thanks in advance!.", "answerCount": 7, "upvoteCount": 0, "datePublished": "2021-09-09T10:59:08.000Z", "author": { "@type": "Person", "name": "Juan Antonio Cantarero", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000EeK30QAF", "affiliation": { "@type": "Organization", "name": "--" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi Juan, You cant able to do in professional edition. You need to develop in developer edition and then deploy it to your professional org. please refer the below link. https://help.salesforce.com/s/articleView?id=000323569&type=1 Thanks, Ankaiah  ", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4PckSAF", "datePublished": "2021-09-09T14:24:16.000Z", "author": { "@type": "Person", "name": "Ankaiah Bandi", "url": "https://trailblazers.salesforce.com/profileView?u=0054S000000ukEbQAI", "affiliation": { "@type": "Organization", "name": "P99soft Pvt Ltd" } } } ] } }
Skip to main content
Dear, 

I want to perform some customs validations in the Opportunity but I can't use the "validation rules" functionality. The approach I would like to use is to create a custom VisualPage at the top of the Opportunity details page. When this VisualPage is loaded I run a "window.onload = function()". On this function I can perform any validation I want and in case of error, an alert is shown. 

But my problem is that I don't know how to get the Opportunity field values from javascript. Below is my code. I hope you can give some light here:

 

<apex:page standardcontroller="Opportunity">

<apex:form id="formId">

<!-- No Opportunity fields are placed here -->

<apex:image value="/img/msg_icons/confirm16.png" style="vertical-align:top;" id="Warning_icon"/>

</apex:form>

<script>

var Original_Amount__c = '{!Opportunity.Original_Amount__c}'; //THIS DO NOT WORKS

window.onload = function()

{

var Original_Amount__c = document.getElementById({!Opportunity.Original_Amount__c}); //THIS DO NOT WORKS

//Validations with Original_Amount__c value....

};

</script>

</apex:page>

Thanks in advance!.
7 answers
0/9000