Retrieve a value from a field

Hello,
I have a question
how can I retrieve a value from a field of a cdt and also put it in another table when I make a call in the process model?

Thanks

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Create an expression rule will return a dictionary of the cdt fields for the second table. Pass your first cdt to that rule. Use index or property function or dot operator to get the value of a field from your first cdt and put it in a field in your second cdt.

    Call the expression rule from the script task inside a process model in the custom outputs section and save it into a process variable of type cdt for second table. Use write to data store smart service to write the data from the second table cdt to your table.

    For eg., your expression rule will look something like:

    {

    id:ri!firstCDT.id,

    name:ri!firstCDT.name,

    age:ri!firstCDT.age

  • Thank you for the answer.
    In both cdts I have the field id, but in the first cdt it is called "id"
    and in the second "idSo".
    The process model with a form is filled in and sent.
    Then the data is saved in the two tables and the process is finished.
    in the first table a value is generated that is saved in "id", because also
    I need that value to be saved in the other table in the "idSo" field
  • 0
    Certified Lead Developer
    in reply to Alastr

    Hi Alastr,

    You will need to use two write to datastore smart service for this in your process model. One for first table and the next for second table.

    Inside the properties of write to datastore smart service of the first table, in the data->output tab, save stored values parameter to the cdt of first table. Then, after the write to data store smart service of the first table add a script task and add a input parameter there of type cdt of second table. Then expand that input parameter and go to the field idSo. There, in the value parameter, assign firstTableCDT.id and in the saveInto parameter assign secondTableCDT.idSo, then in the second write to datastore smart service, write the data to second table.

  • I have the expression rule...but do not do this part

    "Call the expression rule from the script task inside a process model in the custom outputs section and save it into a process variable of type cdt for second table. Use write to data store smart service to write the data from the second table cdt to your table."

    with(
    a!queryEntity(
    entity: cons!CPRO_CT_DS_docs,
    query: a!query(
    filter: a!queryFilter(
    field: "doc",
    operator: "=",
    value: ri!doc
    ),
    pagingInfo: a!pagingInfo(1,-1)
    )
    ).data

    Now with the value "[Document: 7917]" from the table "docs" It is necessary to recover the "id"

    associated with that document And entered in the field "idSolic" of the other cdt. but this in a script task

Reply
  • I have the expression rule...but do not do this part

    "Call the expression rule from the script task inside a process model in the custom outputs section and save it into a process variable of type cdt for second table. Use write to data store smart service to write the data from the second table cdt to your table."

    with(
    a!queryEntity(
    entity: cons!CPRO_CT_DS_docs,
    query: a!query(
    filter: a!queryFilter(
    field: "doc",
    operator: "=",
    value: ri!doc
    ),
    pagingInfo: a!pagingInfo(1,-1)
    )
    ).data

    Now with the value "[Document: 7917]" from the table "docs" It is necessary to recover the "id"

    associated with that document And entered in the field "idSolic" of the other cdt. but this in a script task

Children
No Data