Hi,
I need to add some file as secondary link to an item. Item doesn't have any file links. When I use ReassignComponentsToDifferentItems (ItemService) example, I add file and it becomes PRIMARY link (if an item had already primary file link [but mine doesn't have], the just added one will became secondary file link). And now I want use the following method to switch just added PRIMARY link file to SECONDARY link file:
Item UpdateAndCommitItem (
Item rev,
Long primary,
Long [] secondary,
Long [] stdComp,
Attmt [] Attachments,
PropInst [] UserDefinedProperties,
Integer activeInputs
);
So I am invoking:
itemService.UpdateAndCommitItem(latestItem, primaryFileId, new[] { primaryFileId }, null, null, null, 1);
Value | Meaning |
1 | 'secondary' field is active. |
2 | 'Attachments' field is active. |
4 | 'UserDefinedProperties' field is active. |
And I still get an error:
1387 | RestrictionsOccurred |
What am I doing wrong???? Please help me !!! I have no idea what to do with that 😕
Thanks in advance for any suggestions,
Mike
Solved! Go to Solution.
Solved by jackywen. Go to Solution.
Hello Mike, did you call the ItemService.EditItem(...) API before you call UpdateAndCommitItem? The item must be editable before it is updated. If you did, could you post the detail restriction message?
Regards,
Jacky
Hi Jacky,
You are my Hero ! 🙂 Thanks a lot... when EditItem is invoked first, it is working now. I need to keep in mind that there is some common flow for editing items... first mark to edit and then update and commit. On the other hand there could be some meaning ful exception for that - not only 1387 - RestrictionsOccurred.
You wrote that I could provide detail restriction message... is it possbile to get such message after getting only plain exception (in this case with number 1387)?