Below code used for validating the object values on various criteria. User has to select the Display Type = "Detail Page Button" , Behavior = "Execute Javascript" ,Content Source = "On click JavaScript" and finally we need to write our validation logic inside region .
if("{!testObject.RecordType}" == "Test Record Type")
{
if("{!testObject.StageName__c}" == 'Lead' || "{!testObject.StageName__c}" == 'Trusted Listing' || "{!testObject.StageName__c}" == 'Signed Listing' || "{!testObject.StageName__c}" == 'Escrow')
{
if("{!testObject.Field1__c}" != 0.00 && "{!testObject.Field2__c}" != 0)
{
window.location.href="/apex/TestPage?id="+"{!testObject.Id}";
}
else
{
alert('Field1__c and/or Field2__c are not defined');
}
}
else
{
alert('Deal Stage is either Closed , Closed Lost or Cancelled')
}
}
else
{
alert('Deal should have Record Type Test Record Type One');
}
if("{!testObject.RecordType}" == "Test Record Type")
{
if("{!testObject.StageName__c}" == 'Lead' || "{!testObject.StageName__c}" == 'Trusted Listing' || "{!testObject.StageName__c}" == 'Signed Listing' || "{!testObject.StageName__c}" == 'Escrow')
{
if("{!testObject.Field1__c}" != 0.00 && "{!testObject.Field2__c}" != 0)
{
window.location.href="/apex/TestPage?id="+"{!testObject.Id}";
}
else
{
alert('Field1__c and/or Field2__c are not defined');
}
}
else
{
alert('Deal Stage is either Closed , Closed Lost or Cancelled')
}
}
else
{
alert('Deal should have Record Type Test Record Type One');
}
No comments:
Post a Comment