Categories
Field Trigger is not working
I have a business requirement to get value from Account (Standard Object) and set it into Child Object under account (FGS Loyalty Enrollment)
>>set the DCL field (Parent Party Number) value if ParentCC field is not null.
if parentCC != null, set attribute ('ParentPartyNumber, parent)
if parentCC == null, set attribute ('ParentPartyNumber, null)
Currently trigger returns value only for 1st row. Not returns value on 2nd Row, even logs are printing.
Script:
def vo = newView('OrganizationProfile')
def vc = vo.createViewCriteria()
def vcr = vc.createRow()
def vci = vcr.ensureCriteriaItem('CustomerCode_c')
vci.setOperator('=')
vci.setValue(ParentCCNo_c)
vc.insertRow(vcr)
vo.appendViewCriteria(vc)
vo.executeQuery()
while(vo.hasNext())
{
def CO = vo.next()
if(ParentCCNo_c != null)
{
def parent = CO.getAttribute('PartyNumber')
println("PartyNumber: "+ PartyNumber_c + " ParentPartyNumber : "+ CO.PartyNumber_c
+" ParentCCNo_c: " + ParentCCNo_c +"CC: " +CustomerCode_c );
setAttribute('ParentPartyNumber_c',parent)
return true
}
else
{
setAttribute('ParentPartyNumber_c',null)
}
}