Brian Oster

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Misc Tab not listing Fields under Hidden fields section #34551
    Brian Oster
    Participant

    That was it. Once I hit save on the config for each form type the field list appeared. Thanks.

    in reply to: filterObj not configured correctly. #33973
    Brian Oster
    Participant

    Worked perfectly, thanks.

    in reply to: Using opening links using document library feature #33707
    Brian Oster
    Participant

    Ok, I think this works.

    
    
    function openInWeb(val, item) {
        var name = item.get_item("FileLeafRef");
        var url = item.get_item("FileRef");    
        return "<a href='" + url + "?web=1' target='_blank'>" + name + "</a>";
    }
    
    function openInDesktopApp(val, item){
        //debugger;
        var retlink = "";
        var name = item.get_item("FileLeafRef");
        var doctype = name.substring(name.lastIndexOf('.') + 1).toLowerCase();
        var url = makeAbsUrl(item.get_item("FileDirRef") + "/" + name);
    
        switch(doctype) {
            case "doc" :
            case "docx" :
                retlink = "<a href='ms-word:ofe|u|" + url + "'>" + name + "</a>";
                break;
            case "xls" :
            case "xlsx" :
                retlink = "<a href='ms-excel:ofe|u|" + url + "'>" + name + "</a>";
                break;
            default:
                retlink = openInWeb(val, item);
                break;
        }
        
        return retlink;
    }
    • This reply was modified 1 year, 6 months ago by Brian Oster.
    • This reply was modified 1 year, 6 months ago by Brian Oster.
    • This reply was modified 1 year, 6 months ago by Brian Oster.
    in reply to: Using opening links using document library feature #33701
    Brian Oster
    Participant

    I was having the same issue as Paul in that I need to be able to click the link and edit the document and save changes back to the document in the list. The openInWeb function worked great for this.

    However, is there a way to have it open in the Office Desktop App instead of the Web. I am not talking about the default behavior which is to download the document and then effectively edit it locally. I want the default behavior when viewing in native SP where you have the option to “Open in Word” or “Open in Excel” so that edits are saved back to the document in the doc lib. This way I can give users effectively the same option as “Open in Excel” or “Open in Excel Online”.

    Brian Oster
    Participant

    Never mind. Finally got it all working. Your example code from Post 29668 was all good. I had the Document Library GUID wrong.

    Brian Oster
    Participant

    After debugging I found the initial problem. It appears it is not finding the inserted document object. The line “if(res.count > 0)” fails so it never trys to set the document properties. So spjs.utility.queryItems appears to not find the document.

    
    
    var res = spjs.utility.queryItems({
                    "listName": targetLibGUID,
                    "query": "<Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='Text'>" + newDocName + "</Value></Eq></Where>",
                    "viewFields": ["ID", "EncodedAbsUrl"]
                });
                debugger;
                if (res.count > 0) {
                    var item = res.items[0];
                    var uRes = spjs.utility.updateItem({
                        "listName": targetLibGUID,
                        "id": item.ID,
                        "data": {
                            "Project_x0020_ID": projectID,
                            "Category": "Special Instructions"
                        }
                    });
                    if (uRes.success) {
                        // Refresh vLookup table
                        jQuery("#vLookupManualRefresh_" + vLookupFieldname).trigger("click");
                        var a = document.createElement("a");
                        a.setAttribute("href", "ms-word:ofe|u|" + item.EncodedAbsUrl);
                        a.setAttribute("target", "_blank");
                        document.getElementsByTagName("body")[0].appendChild(a);
                        a.click();
                    }
                }
    Brian Oster
    Participant

    So very close. I have it creating documents from my Templates Doc Lib and inserting into the target Doc Lib but I can’t

    a) get it to link to the parent
    b) set additional properties

    Here is the relevant section of js:

    ` if (res.count > 0)
    {
    var item = res.items[0];
    var uRes = spjs.utility.updateItem(
    {
    “listName”: targetLibGUID,
    “id”: item.ID,
    “data”:
    {
    “Project_x0020_ID”: getFieldValue(“ID”),
    “Category”: “Special Instructions”
    }
    });

    See attachment for vLookup Query Definition. I even tried hard coding the Project ID value just to see if it would work and it still would not set that property.

    • This reply was modified 1 year, 6 months ago by Brian Oster.
    Brian Oster
    Participant

    I may have found another thread that may do what I want.

    Post #29668

Viewing 8 posts - 1 through 8 (of 8 total)