Skip to main content
rafaelb
March 8, 2023
Question

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

  • March 8, 2023
  • 3 replies
  • 0 views

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.

3 replies

March 8, 2023

1. Save the status ID in case table

2. If you are using latest version of Appian  Create a Case Record and add status reference as a related record  and add status coulmn to case record

3. if you are using old version of Appian, create a View by joining case and status table, then create a record with that view 

Refer Appian documentation here for more details https://docs.appian.com/suite/help/23.1/record-type-relationships.html

komalj3844
March 8, 2023

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

abhayd3663
March 8, 2023

Best option is to use the record relationship.