In some scenarious, documents may be linked to other documents.
When documents are created using DocumentFactory service, it may receive a parentId argument.
await _documentFactory.CreateAsync("myForm", new MyModel {}, parentId);
You can access the parent id from DocumentContext service.
public class MyForm : FormBase<MyModel> {
public override async Task FlowResumeAsync([NotNull] MyFormModel model)
{
var parentId = _documentContext.Document.ParentId;
// retrieve chained documents
var children = from document in _store.Documents where document.ParentId == parentId select document;
}
}
In the form Angular component, you can then retrieve the document chain.
onBind(data: RecipientModel) {
// retrieve children
data.children.forEach(c=> …);
// retrieve parent recursively
let parent = data.parent;
while (parent) {
parent = parent.parent;
}
}
/***
* get full document info
*/
onChainExpand(id: number) {
this._ documentInfo.get(id).subscribe((d: DocumentModel) => …);
}
In some scenarious, documents may be linked to other documents.
When documents are created using DocumentFactory service, it may receive a parentId argument.
You can access the parent id from DocumentContext service.
In the form Angular component, you can then retrieve the document chain.