Pass a rule/expression output to an interface + show related data

Hi! I was creating a PO interface and I want two of the fields to appear automatically:

1) Field 1: NomProv (supplier name)

- In this case, I have a record type in which a "NomProv" value (and also, the NIF number, an extra field) is assigned to each username ("usuario"). It is an static record, and I want it to make relations between the fields, and obtain the "NomProv" for each username ("usuario")

To obtain the nomProv for each user logged in,  I created the following rule expression:

In this case, I´m logged in as carlos.paz.pelaez@pwc.com, so it returns the value "Proveedor 2" as a test output (works fine for me)

But the fact is that I want to pass this test output ("Proveedor 2") to a field in my interface so that the user cannot change it. But I dont know how to pass the rule expression output to the text field! Also, I tried to pass the value as a local variable, but it is not allowed:

2) Field 2: NIF

- After passing the suppliers name ("Proveedor 2"), I want the NIF text component to be generated automatically using the relation between nomProv and NIF (each nomProv has one NIF associated in the record . type). To make it easier to understand, my idea was to do another query (I pass the nomProv value, which is saved in a rule input of the interface---> returns the NIF as an output --> i save it into the interface) , but I would like to listen to your recommendations. How can I do it?

Any help would be useful. Thanks for your time!

  Discussion posts and replies are publicly visible

Parents
  • Just call this expression rule you have created, in an interface and save it in a local variable and use it in the Proveedor text field "value" parameter by indexing the field.

    For NIF you can either create a new queryRecord Expression or use the created one and add the relationship using relatedRecordData()

    You can take reference from below:

    local!Proveedor: property(rule!CPF_ObtenorNomProveedor(),"data",null),
    /*Create another query record rule for NIF and pass the proveeder value as below*/
    local!NIF: property(rule!NIFQuery(Proveedor: property(local!proveedor, recordType!CPFMaestroProvedores.nomProv, null)),"data",null),
    /*in the value parameter of Proveedr field*/
    value: property(local!proveedor, recordType!fieldName, null),
    /*Value parameter of NIF field*/
    value: property(local!NIF, recordType!fieldName,null)

  • Thanks! I understand the idea and makes sense to me! I´m trying but it seems like the call to the expression rule is returning a rule value:

    I put it in the display value but, logically, the field is in blanck (null value):

    *The local variable usuario was just for check that the function loggedinUser is returning me the correct username

  • 0
    Certified Senior Developer
    in reply to carlosp5114

    Can you please make sure that the rule itself is returning any data for this user and paste the rule expression here?

Reply Children