Solved

Error while trying to Obtain and use Entity values by expression-CHelper.getEntityAttrib("Entity","ValueToReturn","filter","").

Hi, I am working on a Bizagi project and need to use business rule - "Obtain and use Entity values" using expression-CHelper.getEntityAttrib("Entity","ValueToReturn","filter",""). I followed the example given but couldn't get it right. My expression is:

var CreditGrade="<LoanAssessmentProcess.CreditHistoryReport.Creditassessment>";<LoanAssessmentProcess.CreditHistoryReport.RiskAssessment.Riskweight>=CHelper.getEntityAttrib("RiskScore","RiskRating","CreditGrade","");However, this doesn't return any value for RiskWeight. If I supply a value for CreditGrade in the expression itself (eg. CreditGrade=A), then I do get the corresponding risk rating. This means that the second line of my expression is correct but the first line which is used to get the value entered for credit assessment is not working. I was getting many more errors initially but resolved those, now I don't get any error during development or production but doesn't get any result either.Please note that attribute CreditAssessment in 1st line is a parameter entity, I thought that could be causing problem, so I tried the expression with a normal attribute from where entered value can be pulled but still it doesn't work.Please help. Thanks,Shilpa

Best Answer
photo

Dear Shilpa,

In order to solve your question, please refer to this example:

  • //Get the product from the parameter entity
  • ProdType = CHelper.getEntityAttrib("Producttype","idProducttype","Code = '1'","")
  • //Add the product to the first level table
  • Product = Me.newCollectionItem("PurchaseRequest.ProductsRequested")
  • Product.setXPath("Producttype",ProdType);
  • Product.setXPath("Quantity",10);

For further information, please check these articles:

Best Regards

Comments (4)

photo
0

Dear Shilpa,

In order to solve your question, please refer to this example:

  • //Get the product from the parameter entity
  • ProdType = CHelper.getEntityAttrib("Producttype","idProducttype","Code = '1'","")
  • //Add the product to the first level table
  • Product = Me.newCollectionItem("PurchaseRequest.ProductsRequested")
  • Product.setXPath("Producttype",ProdType);
  • Product.setXPath("Quantity",10);

For further information, please check these articles:

Best Regards

photo
1

Hola Juan, tengo un problema similar con el uso del getEntityAtrib. Estoy usando la siguiente expresión:

1) en este caso funciona

var nombre = CHelper.getEntityAttrib("OPFWD_ClienteBloqueado","Nombre","Rut = '10032010-k' ","");

2) en este caso no funciona

var rut = <OperacionesFWDHolding.vw_CuentaCliente.Rut>;

var nombre = CHelper.getEntityAttrib("OPFWD_ClienteBloqueado","Nombre","Rut = "+rut+" ","");

----------------------------------------------------------------------------------------------

Sólo funciona cuando le paso el rut fijo.

La tabla OPFWD_ClienteBloqueado es una entidad paramétrica.

Ya validé que en la variable "var rut" tenga un dato.

photo
2

Estimado Rommel,

Por favor no olvides las comillas simples en el segundo caso que presentas.

A continuación un ejemplo de este tipo de implementaciones; revisa las comillas simples en la variable Filtro.

  1. var Codigo = "texto";
  2. var Filtro = "sCodigo='"+Codigo+"'";
  3. var ID = CHelper.getEntityAttrib("Parametro","idParametro", Filtro);

Apreciamos plenamente tus observaciones y comentarios. Sin embargo, te pedimos por favor compartas tus mensajes sobre Bizagi BPM Suite en su propio foro dedicado en Español (en http://feedback.bizagi.com/suite/es/), donde tiene más visibilidad ya que ahí se reúne toda la comunidad BPM Suite, incluyendo expertos.

Saludos.

photo
1

Gracias Oswaldo, tu solución es correcta. Adjunto el código para compartirlo.

var rut = <OperacionesFWDHolding.vw_CuentaCliente.Rut>;

var bloqueado = CHelper.getEntityAttrib("OPFWD_ClienteBloqueado","Bloqueado","Rut='"+rut+"'","");

photo