DUPLICATE

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

DUPLICATE

Post by nlarson »

I have a process which I want to used to Duplicate a parent and any child references. In my BSV the children are uniquely owned by the parent. The process is below - When executing an error is thrown 'Value of ParentReference must be provided'

DUPLICATE ThisObjectives
DUPLICATE ThisObjectives.DeliverablesReference TO ThatObjectives.DeliverablesReference

I have tried some other variations to specify THATbo.attribute directly to no avail. So is this function only meant to work where the children are not owned by the parent? Or am I doing something wrong?
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Post by Rennur »

I have a PROCESS which duplicates my BO and multiple references for that object without a glitch.

Note: The multi reference attribute is a PEER many-one relationship. The child's matching attribute is blank (not linking back to parent)

My process,
GENERAL:
Process > Process Input > Select BO you want to duplicate (Objectives)
TEXTUAL RULES:
Rule 1 - DUPLICATE Objectives
Rule 2 - Duplicate ThisObjectives.DeliverablesReference TO ThatObjectives.DeliverablesReference

This works for me.

I guess the questions is has the DUPLICATE function got and issue with parent-child owner of relationship type?
hpl123
Posts: 2605
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Duplicate

Post by hpl123 »

I use the DUPLICATE successfully in the following way:

CREATE Invoice
DUPLICATE ThisEstimate.Items TO Invoice.Items

I start this process from the Estimate BO.
Henrik (V8 Developer Ed. - Windows)
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

Yes Ren that is exactly the question, and as hlp123 pointed out it is working fine without ownership. So...

Anyone have this working in a owner of/ owned by relationship? Just wondering is DUPLICATE...To... is working as intended, has a bug, is missing a feature, I am making a pilot error?
RafaMD
Posts: 52
Joined: Wed Mar 16, 2011 6:22 am
Location: Spain

Post by RafaMD »

It is possible. You have to duplicate the children and after asign the parent

Try this:

DUPLICATE ThisObjectives
FIND Deliverables WHERE Deliverables IN ThisObjetives.DeliverablesReference
DUPLICATE Deliverables EXCEPT Owner
ThatDeliverables.Owner=ThatObjetives
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Post by Rennur »

Hi Rafa,
Try this:

DUPLICATE ThisObjectives
FIND Deliverables WHERE Deliverables IN ThisObjetives.DeliverablesReference
DUPLICATE Deliverables EXCEPT Owner
ThatDeliverables.Owner=ThatObjetives
I'd like to to establish if there is a bug using the DUPLICATE function first before applying this workaround.
Anyone have this working in a owner of/ owned by relationship? Just wondering is DUPLICATE...To... is working as intended, has a bug, is missing a feature, I am making a pilot error?
I'll test this today.

Cheers
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Post by Rennur »

I have successfully duplicated Company BO with Contacts but did get an 'Value of ParentReference must be provided' error.

The ParentReference attribute in the Contacts object had the "Value must be provided' checkbox ticked.

Once I un-ticked the checkbox, the Company object and Contacts were duplicated.

Support, is the 'Value must be provided' checkbox ment to be omitted by AIM when DUPLICATE function is performed?
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

Thanks ren, I have had a busy week and had not gotten back to testing this. Would like to know if this is working as intended.
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

Finally got around to trying some alternate methods. Rafa that did not work for me, same issue. Support any input on this please?
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Post by Rennur »

DUPLICATE function works as intended as long as 'Value must be provided' in child references for the parent Object is un-checked.

Maybe this re-write of Rafa's process might work as an alternative.
DUPLICATE ThisObjectives
DUPLICATE Objectives
Duplicates the current original Objective in context. 'This' prefix is not required.

FIND Deliverables WHERE Deliverables IN ThisObjetives.DeliverablesReference
DUPLICATE Deliverables EXCEPT Owner
DUPLICATE ThisDeliverables EXCEPT Owner
Duplicates the found Deliverables
ThatDeliverables.Owner=ThatObjetives
INSERT ThatDeliverables IN ThatObjectives.DeliverablesReference
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

I have a work around, but it seems to prevent the last step in the process (view Thatobject). I will post it tomorrow, just need to see if I can figure out a way to Find Thatobject, then i should be able to get it into View.
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

Solved Using BATCHES OF. As previously noted this only applies to DUPLICATE-ing References when they are OWNED BY another BO, and the value of the child to parent where VALUE MUST BE PROVIDED is true

Code: Select all

DUPLICATE ThisObjectives 
LoggedInRegularUser.Variable_CopyID=ThatObjectives.ID 
FIND Deliverables WHERE Deliverables IN ThisObjectives.DeliverablesReference IN BATCHES OF 1 
DUPLICATE Deliverables 
ThatDeliverables.ParentReference=ThatObjectives 
One issue - if you want to show the newly copied record to the user after it is created you must create a second process and store a value to RegualrUser to act as a variable input for the second process. I do not know why VIEW does not work with the above, the log show it successfully executing, however the screen does not update.

Code: Select all

Proecess #1 
DUPLICATE 
DUPLICATE ThisObjectives 
LoggedInRegularUser.Variable_CopyID=ThatObjectives.ID 
FIND Deliverables WHERE Deliverables IN ThisObjectives.DeliverablesReference IN BATCHES OF 1 
DUPLICATE Deliverables 
ThatDeliverables.ParentReference=ThatObjectives
VeiwRegualrUser_VariableCopyID 


Process #2
FIND Goals WHERE Goals.ID=LoggedInRegularUser.Variable_CopyID 
VIEW Goals 
So a little cumbersome, but functional. It would be nice to know why VIEW will not work in a single process and I still think DUPLICATE TO should support OWNED BY and VALUE MUST BE PROVIDED, but I have what I need for now. Thanks all for the help!
nlarson
Posts: 597
Joined: Thu Apr 14, 2011 7:56 pm

Post by nlarson »

ugh... why can't we EDIT our own @#$%$%$ forum posts...

The above first sentance should read:

Solved Using BATCHES OF. As previously noted this only applies to DUPLICATE-ing Reference lists when the the Relationship is OWNED BY another bo AND the VALUE MUST BE PROVIDED option is true AND the MULTIPLE ALLOWED option is false
Post Reply