CS 21.1 REST API Doc Upload is not triggering webreport

I am using CS 21.1 and I have enabled webreport trigger in the parent folder and it will update the docname based on the metadata value. The category have mandatory attributes.

When i tried to upload doc through REST API, its not triggering the webreport. Looks like some scenarios like (classic view drag and drop and REST API upload) is not triggering the webreport. Is anyone have soln for this issue.

Classic View

Add Document - webreport trigger is working

Drag and Drop Document - webreport trigger is not working

Smart View

Add Document - webreport trigger is working

Drag and Drop Document - webreport trigger is working

REST API

Add Document - webreport trigger is not working

Comments

  • Hard to believe, can you make the WR Trigger send an email set you your email with the standard trigger information and nothing related to your code. If the REST API Upload runs and you get an email then the trigger has run a check if the newly formed Dataid is coming in email. If you are unsure what I am talking about go to the tag and search for Trigger there is a lot of TRIGGER tags.OT includes that for debugging. Then you start looking at your logic and see why it works sometimes and not always.

    Possible problems are "Chicken & Egg situations" like in you spend on inherited categories on the Node to run your logic. Better callback programmers always process the outcome based on the NodeID, so in your case, if the WR_TRIGGERID was written to a DB table or file then you could have a scheduled WR change its name or whatever....I wouldn't know but obviously a OT ticket also can be raised


  • I was also wondering how you determined that the trigger didn't work. I can also hardly believe that. I expect earlier that your WebReport expected something different than what is delivered by CS.

    In stead of emails, I prefer to just log the execution of the WR to see what happens.

    I would expect that the category data is not there yet when the WebReport is triggered.

    On which action does your WR get triggered? I remember I had to use VersionAdded to make it work correctly.

  • @Appu & Hans, Thanks for your response.

    I have created blank webreport with output destination as an email and subject included [LL_REPTAG_TRIGGERID /].

    I have received email notification for Classic View "Add document" and Smart View "Add Document" and Smart View "Drag and Drop" document.

    But I haven't received email notification for Classic View "Drag and Drop" and REST API call for document upload with Category attributes.

    FYI: For testing purpose I have selected all Trigger event in the parent folder.

    Reproducible Steps:

    1) Create a parent Folder and assign category (one attribute should be mandatory)

    2) Drag and drop file into parent folder and enter mandatory attribute value and add the document through classic view drag and drop

    or

    Upload document with category attribute value through REST API.

    Note: Already I have created OT Ticket for this issue but I haven't received any response yet.

  • Appu Nair
    edited November 19, 2021 #5

    I have actually put a screencap in this in another discussion when setting up the Trigger you have to be very careful like Multiple selects on the Folder. For e.g, most of the WR triggers are POST NODE events

    so in your case, if you Put a Trigger on the Folder you should make sure that Add Version is checked from that and down. In OT everything is a NodeAlloc and NodeCreate and the AddVersion is another thing that happens on Versionable(Doc) objects. Even Metadata updates have their own callback post events.I wouldn't know what is OT providing as WR Triggers unless I looked.

    If I were you I would enable thread logs and connect logs and send OT the logs. When a callback is encountered you will see the callback running .So if you don't see your successful log as in Classic that gives you some clues.

    as far as DnD OT has an option saying the user could fill that at their own pace there are other code streams at play. So check your settings and involve OT.


    I am trying to show you what I typically do to get all events.Mind you the blue things on my screenshot has to be painfully entered you probably have that but just in case you have to multiple select what you want happening when a Document is added to a Container


  • @Appu, I have tried all trigger events and its not working. Looks like its bug, the event will not trigger only if you have folder with mandatory category attribute. Some reason classic view drag drop call and REST api call are different than others.

  • That probably explains why the delay in your ticket might add you to a bug thing then.

  • Ok now I think I understand. It looks like your payload is expecting the category data to trickle down , that happens in classic only because the nodecreation routine does make a call to the container and checks inheritance rules . I believe I have seen this behavior and I think we worked around this as in the nodecreate in rest api could be a post with the right payload not the create document . At least check if the WR works as you want by sending all the category info
  • @AppuNair I have a webreport trigger in category update, it is working if the user has system administration rights, else it is failing, the user has all the permission on the webreport except delete and edit permission, can you please let me know if we need to have system administration rights to run webrpeort trigger

  • SA avoids permission errors or in other words a system that has been hastily put up so no one knows who can add documents, apply metadata and so on.SA bypasses all of that .Very bad practice to give a user or process.

    So try to model what the WR trigger needs to do, when a human is involved ,so if Bharath is on the GUI is he able to update attributes ,then the WR Trigger also will be able to do it.

    I would also try to understand what the WR trigger code is trying to accomplish so if it is called to create a Folder, go to the place and see if Bharath can add a folder .

    The WR object is just needing See, SC on the caller ACL ,but in actuality it is the verbs inside the WR that is your real problem.

  • Hi @AppuNair so the trigger once the category is updated moves the document from one folder to another, the service account has privilege to add documents in both the folders but still its not able to move the document

  • appuq
    edited June 1, 2023 #12

    then put connect logs and see if you get permission errors or login as service account and try to do what the WR trigger was doing. WR developers can put error traps so I would expect that if I call a NodeAction and if that line executes tend to write a log file. I am confused about your situation so to make a debugging effort go to the WR and go to its specific and run it as a SA user then if the WR works then 100% it is permissions(like Folder does not have ADD items ,delete, user cannot access the category volume and so on).Changing to do the WR runas just proves that