Hey All,
I am trying to put together a simple script to populate an image url based upon a integer value. I essentially want 1 image if the value is greater than 0 and a default image if the value = 0. I tried using the below script but it did not work (I have replaced the actual URL with place holder text for demonstration purposes only).
Now, if I set the "highest score" equal to XX, the script will work for leads with a highest score field value = XX.
Once I have this part figured out, I will also need to add an OR statement to check if "highest score 2" > 0
Sanford Whiteman - Hoping you can help me out.
Thanks in advance.
-JF
Solved! Go to Solution.
Sounds like you're getting empty strings, not just "0" strings. As long as those fields both exist (even if empty) on every Opportunity object, this works for empty strings and numeric values.
#set( $targetOpp = $OpportunityList[0] )
#foreach ( $oppScoreField in ["Highest_Score__c", "Highest_Score_2__c"] )
#if( $targetOpp[$oppScoreField].isEmpty() )
#set( $targetOpp[$oppScoreField] = 0 )
#else
#set( $targetOpp[$oppScoreField] = $convert.parseNumber($targetOpp[$oppScoreField]) )
#end
#end
#if( $targetOpp.Highest_Score__c > 0 || $targetOpp.Highest_Score_2__c > 0 )
One or both fields is > 0.
#else
Neither field is > 0.
#end
Note that I use the square brackets [0] syntax as get() is just OOP chaff.