here i explained you in detail so you get easily what i fixed ,
Use the link https://localhost:8443/example/control/FormWidgetExamples here you find a heading Examples Lookup Fields (first of type popup, second layered) . When you open the layered lookup and click on find and selecting any value the values of the fields "name" & "partyIdTo" is shown, but if you open layered lookup inside the layered lookup and select a value then the value shown in the first layered lookup field and finally selecting a value from the list the value of "name" filed is missing in the main form from where the lookup called.
It is because the target value of the first lookup is replaced by the target value of the second lookup, that's why we have to use this(obj_caller.target = $(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).parentTarget.id) in the set_values(value, value2) you can also see the changes after applying my patch.
Yet, It is not needed for target2 because it is used only once so its value is not replaced , but in future we can use it if needed .
I think now it will clear you what i fixed.
So we have to uncomment that line for working it properly. Here is the patch for that.