Topic
  • 10 replies
  • Latest Post - ‏2014-01-23T07:41:28Z by Avallyn
Avallyn
Avallyn
28 Posts

Pinned topic custom step processor: autoselect & view attachment

‏2013-12-10T15:17:44Z |

Hi,

I'm new to Content Navigator and work with the sample step processor. The sample works fine.

Now I'm trying to autoselect the workflow attachment when I open the work item in the custom step processor and show it in the viewer.  So far I expand the updateView function and get my workItem. But how do I get the attachment?

Hope you can help me.

Thanks

  • rickx
    rickx
    2 Posts
    ACCEPTED ANSWER

    Re: custom step processor: autoselect & view attachment

    ‏2013-12-18T13:04:43Z  
    • Avallyn
    • ‏2013-12-16T12:48:40Z

    Hi,

    Thanks for your help. I'm able to select the first "attachment" in the attachment tree. But I'm still not able to get and select the items in the content attachment list.

    this._workItem.resultSet.items[0] is an ecm.model.attachmentItem - So in the next step I need "retrieveAttachmentContents" but what do I get back?
    I don't know why, but I don't get it.

    Is there an example or something else to look at?

    Regards

    Hello,

    If I understand it correctly I think managed to do the same thing you are trying to, loading the first attachment into the viewer.

    The object you get back from the retrieveAttachmentContents  method is an array of "ecm.model.ContentItem" objects. This object can be supplied as an argument to the viewer. So in code it looks like this:

     

    if ( attachments[i].isInstanceOf(ecm.model.AttachmentItem) ) {
      attachments[i].retrieveAttachmentContents(false, false, function(results) {
        var attachmentContents = [].concat(results.getItems());
     
        if ( attachmentContents.length > 0 )
        {
          this.contentViewer.open(attachmentContents[0]);
        }
        // Add this to force a resize
        this.contentViewer.viewerEditContainer.onLoaded();
      });
    }
     

    I hope that this also works for you.

  • blaturner
    blaturner
    46 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2013-12-11T17:27:35Z  

    Hi, there is a new method on the WorkItemsAttachmentPane in out 2.0.2 release that can select a attachment item and can be called something like:

                    this.workItemAttachmentsPane.selectAttachmentItem(this._workItem.resultSet.items[0]);
     

    This will select the first "attachment" in the attachment tree list. From there, you'll have to select the item you would like from the attachment content list.

    Regards

  • Avallyn
    Avallyn
    28 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2013-12-16T12:48:40Z  

    Hi,

    Thanks for your help. I'm able to select the first "attachment" in the attachment tree. But I'm still not able to get and select the items in the content attachment list.

    this._workItem.resultSet.items[0] is an ecm.model.attachmentItem - So in the next step I need "retrieveAttachmentContents" but what do I get back?
    I don't know why, but I don't get it.

    Is there an example or something else to look at?

    Regards

  • rickx
    rickx
    2 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2013-12-18T13:04:43Z  
    • Avallyn
    • ‏2013-12-16T12:48:40Z

    Hi,

    Thanks for your help. I'm able to select the first "attachment" in the attachment tree. But I'm still not able to get and select the items in the content attachment list.

    this._workItem.resultSet.items[0] is an ecm.model.attachmentItem - So in the next step I need "retrieveAttachmentContents" but what do I get back?
    I don't know why, but I don't get it.

    Is there an example or something else to look at?

    Regards

    Hello,

    If I understand it correctly I think managed to do the same thing you are trying to, loading the first attachment into the viewer.

    The object you get back from the retrieveAttachmentContents  method is an array of "ecm.model.ContentItem" objects. This object can be supplied as an argument to the viewer. So in code it looks like this:

     

    if ( attachments[i].isInstanceOf(ecm.model.AttachmentItem) ) {
      attachments[i].retrieveAttachmentContents(false, false, function(results) {
        var attachmentContents = [].concat(results.getItems());
     
        if ( attachmentContents.length > 0 )
        {
          this.contentViewer.open(attachmentContents[0]);
        }
        // Add this to force a resize
        this.contentViewer.viewerEditContainer.onLoaded();
      });
    }
     

    I hope that this also works for you.

  • TimmyT
    TimmyT
    6 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-14T23:34:47Z  
    • rickx
    • ‏2013-12-18T13:04:43Z

    Hello,

    If I understand it correctly I think managed to do the same thing you are trying to, loading the first attachment into the viewer.

    The object you get back from the retrieveAttachmentContents  method is an array of "ecm.model.ContentItem" objects. This object can be supplied as an argument to the viewer. So in code it looks like this:

     

    if ( attachments[i].isInstanceOf(ecm.model.AttachmentItem) ) {
      attachments[i].retrieveAttachmentContents(false, false, function(results) {
        var attachmentContents = [].concat(results.getItems());
     
        if ( attachmentContents.length > 0 )
        {
          this.contentViewer.open(attachmentContents[0]);
        }
        // Add this to force a resize
        this.contentViewer.viewerEditContainer.onLoaded();
      });
    }
     

    I hope that this also works for you.

    Hello RickX and Avallyn,

    I am trying to do the exact same thing, I think.  When a workitem is opened, the first document associated to the workitem, (in my case, only 1 document per workitem), is opened in the embedded viewer (described in the new Extending and Customizing ICN released Jan 2014 - Chapter 8).

    Can you share your custom step processor code (the stepprocessor.js)?   Since you're using the code to do the action, then creating a custom Action plugin is unnecessary, right?

    Thank you,

    Tim T

  • TimmyT
    TimmyT
    6 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-15T15:01:53Z  
    • Avallyn
    • ‏2013-12-16T12:48:40Z

    Hi,

    Thanks for your help. I'm able to select the first "attachment" in the attachment tree. But I'm still not able to get and select the items in the content attachment list.

    this._workItem.resultSet.items[0] is an ecm.model.attachmentItem - So in the next step I need "retrieveAttachmentContents" but what do I get back?
    I don't know why, but I don't get it.

    Is there an example or something else to look at?

    Regards

     

    Hello RickX and Avallyn,

    I am trying to do the exact same thing, I think.  When a workitem is opened, the first document associated to the workitem, (in my case, only 1 document per workitem), is opened in the embedded viewer (described in the new Extending and Customizing ICN released Jan 2014 - Chapter 8).

    Can you share your custom step processor code (the stepprocessor.js)?   Since you're using the code to do the action, then creating a custom Action plugin is unnecessary, right?

    Thank you,

    Tim T

  • rickx
    rickx
    2 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-22T13:09:45Z  
    • TimmyT
    • ‏2014-01-15T15:01:53Z

     

    Hello RickX and Avallyn,

    I am trying to do the exact same thing, I think.  When a workitem is opened, the first document associated to the workitem, (in my case, only 1 document per workitem), is opened in the embedded viewer (described in the new Extending and Customizing ICN released Jan 2014 - Chapter 8).

    Can you share your custom step processor code (the stepprocessor.js)?   Since you're using the code to do the action, then creating a custom Action plugin is unnecessary, right?

    Thank you,

    Tim T

    In the attached file you can find the modified custom step processor from the Content Navigator Red Book example. It uses an overridden method of the original step processor to display the first content element of the first attachment in the viewer. 

    If you always have only one document with one content element attached to your workflow then the custom action plugin is indeed unnecessary. If you have multiple plugins then you still need the custom action to display the other attachments.

     

    Attachments

  • Avallyn
    Avallyn
    28 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-22T15:59:06Z  

    Hello RickX,

    Thank you very much for your help! You saved me here :) Looks like i need to learn more dojo.

    One question to your version of the Content Navigator Red Book "Customizing and Extending IBM Content Navigator" Version. So far I have the version from October 2012 without any custom processor capital (sg24-8055-00) and the version from January 2014 with this capital (sg24-8055-01) but there is another example version of StepProcessorRedbkLayout. Which Red Book version do you have?

  • TimmyT
    TimmyT
    6 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-22T16:16:25Z  
    • rickx
    • ‏2014-01-22T13:09:45Z

    In the attached file you can find the modified custom step processor from the Content Navigator Red Book example. It uses an overridden method of the original step processor to display the first content element of the first attachment in the viewer. 

    If you always have only one document with one content element attached to your workflow then the custom action plugin is indeed unnecessary. If you have multiple plugins then you still need the custom action to display the other attachments.

     

    RickX,

    This works exactly as advertised!  Thanks for helping out.  How did you know this?  I've been looking everywhere to understand how to develop for ICN better.  There's no formal training.  Accelebrate has a Dojo class, but I don't know if it would be beneficial for developing for ICN. 

    Thank you very much!

    Tim T

  • TimmyT
    TimmyT
    6 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-22T16:19:50Z  
    • Avallyn
    • ‏2014-01-22T15:59:06Z

    Hello RickX,

    Thank you very much for your help! You saved me here :) Looks like i need to learn more dojo.

    One question to your version of the Content Navigator Red Book "Customizing and Extending IBM Content Navigator" Version. So far I have the version from October 2012 without any custom processor capital (sg24-8055-00) and the version from January 2014 with this capital (sg24-8055-01) but there is another example version of StepProcessorRedbkLayout. Which Red Book version do you have?

    Avallyn,

     

    The Redbook is a little inconsistent with the supplied additional materials.  You can get the source from ftp://www.redbooks.ibm.com/redbooks/SG248055

    That's where I got the StepProcessorRednkLayout files

     

    Tim

     

     

  • Avallyn
    Avallyn
    28 Posts

    Re: custom step processor: autoselect & view attachment

    ‏2014-01-23T07:41:28Z  
    • TimmyT
    • ‏2014-01-22T16:19:50Z

    Avallyn,

     

    The Redbook is a little inconsistent with the supplied additional materials.  You can get the source from ftp://www.redbooks.ibm.com/redbooks/SG248055

    That's where I got the StepProcessorRednkLayout files

     

    Tim

     

     

    Hello TimmyT,

    thanks for posting the link. I missed the new sg248055.zip there.

    Regards

    Avallyn