I’ve used some of the samples for conditional formatting based on values, and I think I’m missing some small bit.
I’ve added the code below.
On the first field, referencing the custom field, it will always return “false”. That field is in the extended “CROpportunityHeader” which is the class for the view “Opportunity”. Slightly interesting point, if I intentionally misspell the custom field name it does the same thing, leading to believe that I need to do something to indicate it’s in a DAC Extension.
On the second colored field, when I reference “CuryAmount” rather than the custom field it seems to works as expected.
template>
<style>
[data-has-value="true"] input {
background-color: #d4edda !important;
color: #155724 !important;
}
[data-has-value="false"] input {
background-color: #2bb14a !important;
color: #155724 !important;
}
[data-rating="green"] input {
background-color: #155724 !important;
}
[data-rating="red"] input {
background-color: #721c24 !important;
}
</style>
<field append="#phF_form_PXLayoutRule0" name="UsrTCAPParentOpportunityID" data-has-value.bind="Opportunity.UsrTCAPParentOpportunityID.value == null ? 'true' : 'false'"></field>
<template modify="#fsHeader_C">
<field name="UsrTEKMarginDollars" data-rating.bind="Opportunity.CuryAmount.value >= 1000 ? 'green' : 'red'"></field>
</template>
</template>
Code from the .ts:
export interface CROpportunity_AcuPro extends CROpportunityHeader { }
export class CROpportunity_AcuPro{
UsrTCAPParentOpportunityID: PXFieldState<PXFieldOptions.CommitChanges>;
UsrTEKMarginDollars: PXFieldState<PXFieldOptions.Disabled>;
}