In the Document Object Connection, i have created a custom field such as :
SELECT CASE
WHEN INSTR(a.KEY_REF,'EMP_NO=')>0 THEN Company_Person_API.Get_Person_ID(regexp_substr(a.KEY_REF,'[^^|=]+',1,2),regexp_substr(a.KEY_REF,'[^^|=]+',1,4))
WHEN INSTR(a.KEY_REF,'PERSON_ID=')>0 THEN regexp_substr(a.KEY_REF,'[^^|=]+',1,2)
ELSE '' END FROM IFSAPP.ENHANCED_DOC_REFERENCE_OBJECT a where a.objid = :objid
So i can fetch the person ID in this field, and then I have created a custom tab in the Personal File that links to this custom field so i am able to retrieve all the documents pertaining to an employee wherever the document is located.
It works, however performance is very low… is there a way to index my custom field PersonID? The Indexed box is grey ... Or has anyone found a more elegant solution ?
Best answer by Amila Samarasinghe
Hi @ludovic.rougean
That is because there can be more than one records of PersDocument for each Pers LU and in that case you cannot directly define keys as column mappings as SEQ_NO is missing in Pers LU. Here you can write a custom db method which takes target lu keyref as input and output source lu keyref and give the method signature for Transformation method column. However I am not sure it will work as there can be multiple source lu key refs
Also I can suggest another way by playing with Editable field. You can define the rule as below.
Target - PersDocument
Source - Pers
Editable - Source
This will take care of the transformation from parent to child. However since the editable field is set as source, any new documents getting attached to child will actually be saved in parent (source). So the documents attached to any child will be shown in parent as well. One downside is then that document will again be shown in all the Childs as well due to OCT rule. Play it with yourself and see.
Indexes can only be added to persistent fields. As a solution to your problem, did you try defining object connection transformation (OCT) rules. However in order to do that, you need to identify each and every object where personal files can be attached so then you can try to define a OCT rule between that object and person file object so the document will be shown in the attachment panel of personal file object as well.
That is because there can be more than one records of PersDocument for each Pers LU and in that case you cannot directly define keys as column mappings as SEQ_NO is missing in Pers LU. Here you can write a custom db method which takes target lu keyref as input and output source lu keyref and give the method signature for Transformation method column. However I am not sure it will work as there can be multiple source lu key refs
Also I can suggest another way by playing with Editable field. You can define the rule as below.
Target - PersDocument
Source - Pers
Editable - Source
This will take care of the transformation from parent to child. However since the editable field is set as source, any new documents getting attached to child will actually be saved in parent (source). So the documents attached to any child will be shown in parent as well. One downside is then that document will again be shown in all the Childs as well due to OCT rule. Play it with yourself and see.