SBM CUSTOM FILE ATTACHMENTS ? Question

0
Can some guide me to do the flowing task related to file uploading?

My Form shall indicate what essential documents are to be uploaded (e.g.Resume,Birth Certificate).

User to select from a list of pre-specified fields indicating what type of essential document is
being uploaded (e.g.Resume,Birth Certificate etc) before upload of the actual soft-copy of the
document.
System allows user to upload other nonessential documents.

System to indicate to user application submission is incomplete and will not be processed when there is missing essential documents.
Responses (4)
  • Accepted Answer

    Monday, June 22 2015, 09:40 AM - #Permalink
    0
    What you are asking for may be possible, but not easy to do within SBM today. Please vote for the enhancement request I submitted, because it would make your task much easier. Here is the link to the enhancement:
    https://communities.serena.com/community/ideas/sbm/new-field-types-for-file-and-url-attachments
    The reply is currently minimized Show
  • Accepted Answer

    Jeff Malin
    Jeff Malin
    Offline
    Monday, June 22 2015, 10:34 AM - #Permalink
    0
    Lynn, I upvoted your idea as this would be extremely useful functionality.

    In the meantime, we wrote a workaround that lets you "Bind" an individual text field to the full list of attachments on the SBM record. Add these two functions as custom JS to your Transition forms, and then execute the first function below with the name of your text field, and whether you want it to support Single or Multiple attachments. Make sure "Display HTML" is checked, and when shown on screen or in reports, the attachment will appear as a valid URL link. You'll also need to make sure this is a Custom form with jQuery enabled.

    --Note, the forums appear to me messing with this code below. I tried to attach this as a .js and .txt file but I am not seeing them appear, hopefully there is just a slight delay--


    function bindTextFieldAttachments(fieldName, isMulti) {
    var $fldObj = $(GetFieldByName(fieldName));
    if ($fldObj.length == 0) {
    console.log("field " + fieldName + " not found");
    } else if ($fldObj.attr("type") !== "text" && $fldObj.prop("tagName") !== 'TEXTAREA') {
    console.log("Attachment fields may only be bound to Text fields, field type " + $fldObj.attr("type") + " tagname");
    } else if (!$fldObj.hasClass('boundfile')) { // Ignore if already bound

    var $selectObj = $(
    "<select id='boundDocuments_" + fieldName + "' onChange='setBoundAttachmentsField(this, \"" + fieldName + "\");' "
    + ((isMulti) ? "multiple>" : "><option value=0>(None)</option>")
    + getAttachmentOptionList()
    + "</select>"
    );

    $($fldObj.val()).each(function(){ // Add existing values as selected (replace if already in list)
    var selectedID = $(this).attr("attachID");
    var selectedText = $(this).text();
    $selectObj.find("option[value=" + selectedID + "]").remove();
    $selectObj.prepend("<option value=" + selectedID + ">" + selectedText + "</option>");
    $selectObj.val(selectedID);
    });

    var $addFileLink = $("<div id='addFileLink'><a href='javascript:attachFile();'>Add New File</a></div>");

    $fldObj
    .hide()
    .addClass('boundfile')
    .after($selectObj.after($addFileLink));
    }
    };

    function setBoundAttachmentsField(selectElm, fieldName) {
    var linkHTML = ""
    jQuery("option:selected[value!=0]", selectElm).each(function(){
    linkHTML += "<a target='_blank' attachID=" + $(this).val() + " href='tmtrack.dll?AttachmentPage&AttachmentID=" + $(this).val() + "'>"
    + $(this).text()
    + "</a>";
    });
    SetFieldValue(fieldName, linkHTML);
    FireChangeEvent(GetFieldByName(fieldName));
    };
    Like
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 22 2015, 11:56 AM - #Permalink
    0
    Another option would be to have the user select the essential documents to be uploaded in the transition to state "ABC". That transition has an action that says "Perform 'Check Birth Certificate' when this transition occurs". For each essential doc, create a Rule, a Decision and a pair of Transitions. The Decisions chain to each other. Each Decision uses a rule that says "is doc "X" selected?". If yes then have a transition that presents a form and requires user to attach doc "X". That transition leads to the next Decision. If a Decision is no, the "otherwise" branch goes to the next Decision using a quick transition. Either way, the Decision for doc "X" leads to the Decision for doc "Y" which leads to the Decision for doc "Z" ...etc.

    I had implemented this with an older version of SBM but couldn't chain Decisions together. I ended up with something similar except that the 2 transitions out of the Decision returned to the original State. Each transition had an action that performed the next transition in sequence.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 23 2015, 11:28 AM - #Permalink
    0
    This doesn't necessarily handle any of the chaining together logic of stepping from one required attachment to another, but food for thought in terms of storing/displaying different attachment types using current sbm features.....

    A year ago I had actually put together a proof of concept on this very topic where I chose to use Aux tables for each 'type' of attachment which they could or need to add to a primary CI item. Then the primary item could have an embedded report of attachments showing any data from the Aux table but initially just attachment type (functional requirement, technical requirements, deployment architecture, etc...) and the link to the attachment.

    This was an option that could scale and handle the need for flexibly changing or using different attachment types. While it was a report we could ultimately have used the type to display certain attachments with certain fields or areas of a form since the embedded report could qualify on attachment type. We didn't ultimately implement or expand on this idea for other reasons.

    So while this may be one other option there are other use cases and reasons why the suggested Idea would still be nice to have baked into the product itself.
    Like
    The reply is currently minimized Show
Your Reply

Recent Tweets

Twitter response: "Invalid or expired token."