Hi, i´m facing a refreshvariable problem, this code call a rule caled rule!slc_obtenerPolizas(idSiniestro: ri!siniestro.idSiniestro)
local!refrescarPolizas: false, /*REGLA QUE OBTIENE LAS POLIZAS*/ /*Y COBERTURAS*/ local!polizas: a!refreshVariable( value: rule!SLC_obtenerPolizas(idSiniestro: ri!siniestro.idSiniestro), refreshOnVarChange: local!refrescarPolizas ),
rule expression is this:
a!localVariables( local!polizas: rule!SLC_GetObtenerPolizasByDeclaracionID(idSolicitud: ri!idSiniestro).data, local!ramos: a!forEach( items: local!polizas, expression: a!update( fv!item, "ramos", rule!SLC_GetObtenerCoberturaByPolizaID(idPoliza: fv!item.idSiniestroPoliza).data ) ), local!ramos )
which call a two api, we cast json into CDT.
a!localVariables( /* 1. First, configure the integration object to return successfully */ local!integrationResponse: a!refreshVariable( value: rule!CT_SLC_getCoberturaConsultarxPolizaID( idPoliza: ri!idPoliza, usuario: loggedInUser() ), refreshAlways: true ),
Even local!refrescarPolizas is changing value by button, my rule rule!SLC_obtenerPolizas is not refreshing.
I tried using unconvetional code like:
local!polizas: if( local!refrescarPolizas, rule!SLC_obtenerPolizas(idSiniestro: ri!siniestro.idSiniestro), rule!SLC_obtenerPolizas(idSiniestro: ri!siniestro.idSiniestro) ),
and it works, however i wanna know why my refreshvariable is not working. Thanks in advance for your reply
Discussion posts and replies are publicly visible
refreshOnVarChange fires only when the watched value actually changes. Setting local!refrescarPolizas to true again won't trigger it. Fix by toggling, or better, incrementing a counter.
a!save(local!refrescarContador, local!refrescarContador + 1)