How to refer to join ID in API

I want to call a parent table in a child process form. 
Was planning to use an API call as such: 

../API/bdm/businessData/nds.model.ParentTable?q=findByPersistenceId&p=0&c=1000&f=persistenceId={{x}}

Where x is the ChildTable's link to the parent: ParentTable_PID. 

How do I set a js variable to call the ParentTable_PID of ChildTable to be used to find the correct record within the API?

Or is there a smarter way to go about this? 

 

Thanks

Hi,

Without knowing the details of your use case, it is not very easy to suggest "the best option". 

 

I see 2 possible designs from the top of my head (there are probably more):

If only the form has to be aware of the parent object:

Then the approach you suggest seems good to me. I.e fetch the parent object by issuing a query based on a unique criteria (either Id of the parent or an id of the child if you created a custom query on the parent object type e.g findParentFromChildUniqueAttribute(...) )

If the child process has to be aware of the parent object:

Initialize a business data referencing the parent object by executing a findBy query. This way that variable will be included into the context of the case and into all human tasks context hence directly available in the form. 

Let me know if you succeed in setting up your form. 

Captain Bonita

I stored a linking ID in both tables tables and used it to call the parent object from the child process using a findBy query. 
Thanks for the advice!