Get PK from a reference table to insert into an entity with FK to that table

Certified Associate Developer

Hi all,

This is my uses case. I have a reference table with 2 columns (id(PK) and description)  with all the possible statuses: 1 - Ongoing; 2 - Completed, .....

I need to insert an entity case, that it has a FK to that statuses. For instance, idCase = 1, idStatus = 1.

So my question is, what is the best approach to map the value (Ongoing, Completed, ...)  into my case CDT?

My initial approach is to have a CONSTANT with the status values: "Ongoing", "Completed" and get the id by a query rule to the table status.

Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • Certified Senior Developer

    Hi Rafael,

    I would suggest to set status Id into the constant and map it to case cdt based on your workflow status. 

    cons!STATUS_ID

    Description

    1.Ongoing

    2.Completed

    3.Rejected

    values

    1

    2

    3

    Eg if the flow is in progress

    {idCase:1,

    idStatus:cons!STATUS_ID[1]}

    For Records 

    you can create view for Case 

    put join for status table where statusId=idstatus

Reply
  • Certified Senior Developer

    Hi Rafael,

    I would suggest to set status Id into the constant and map it to case cdt based on your workflow status. 

    cons!STATUS_ID

    Description

    1.Ongoing

    2.Completed

    3.Rejected

    values

    1

    2

    3

    Eg if the flow is in progress

    {idCase:1,

    idStatus:cons!STATUS_ID[1]}

    For Records 

    you can create view for Case 

    put join for status table where statusId=idstatus

Children
No Data