Skip to main content

I am using the snippet below to highlight table cell values based on the value of that cell. Is it possible to extend the if statement to also look at another set of values from a different table column? 

so if value === “my value” AND value2 === “my value2”



var field = argumentsa0], &nbsp; &nbsp;value = argumentsa1],<br />&nbsp; &nbsp;$ = skuid&#46;$;<br />&nbsp; &nbsp;&nbsp;<br />if(field&#46;metadata&#46;accessible){ <br />&nbsp; &nbsp; if(value === "MQL - Customer/W Oppty"){<br />&nbsp; &nbsp; &nbsp; &nbsp; &#47;&#47;RED&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; field&#46;element&#46;css({'background-color':'#ff0000','min-height':'10px','text-align':'center'});<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; if(value === "Passed to Sales"){<br />&nbsp; &nbsp; &nbsp; &nbsp; &#47;&#47;GREEN&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;field&#46;element&#46;css({'background-color':'#00cc00','min-height':'10px','text-align':'center'});<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; else if(value === "Qualifying" ){<br />&nbsp; &nbsp; &nbsp; &nbsp; &#47;&#47;YELLOW&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;field&#46;element&#46;css({'background-color':'#ffff00','min-height':'10px','text-align':'center'});<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; &nbsp;skuid&#46;ui&#46;fieldRenderersRfield&#46;metadata&#46;displaytype]pfield&#46;mode](field,value);<br />}&nbsp;

Josef,

You can get the other field’s value using something like this:


&nbsp;(field.model.getFieldValue(field.row,'my_value2__c',true) 


Your ‘if’ would look like:


if(value === "Passed to Sales" &amp;&amp; (field.model.getFieldValue(field.row,'my_value2__c',true)) { 


Look here for an example of a custom field render that calculates a total:

https://community.skuid.com/t/row-action-with-inline-snippet-to-update-field

Thanks,

Bill


<br>