使用javascript将自定义表单中的列表项值绑定到Sharepoint列表下拉字段中

时间:2018-10-16 17:26:18

标签: javascript sharepoint sharepoint-online

如何在插入数据时指定“ GBSServiceOrganization&TechnologyUsed”为下拉列表?现在它可以正常工作,数据可以正确显示在视图上,但是当您尝试编辑该项目时,“ GBSServiceOrganization&TechnologyUsed”字段为空。

非常感谢您的帮助。

function createListItem(siteUrl) {
        var devName = document.getElementById("devName").value
        var techUsed = document.getElementById("techUsed").value
        var gbsServOrg = document.getElementById("gbsServOrg").value

        var clientContext = new SP.ClientContext(siteUrl);
        var oList = clientContext.get_web().get_lists().getByTitle('LayOver Test');

        var itemCreateInfo = new SP.ListItemCreationInformation();
        this.oListItem = oList.addItem(itemCreateInfo);

        oListItem.set_item('Title', devName);
        oListItem.set_item('GBSServiceOrganization', techUsed);
        oListItem.set_item('TechnologyUsed', gbsServOrg);

        oListItem.update();

        clientContext.load(oListItem);
        clientContext.executeQueryAsync(
            Function.createDelegate(this, this.onQuerySucceeded), 
            Function.createDelegate(this, this.onQueryFailed)
        );
    }

    function onQuerySucceeded() {
        alert('New Solution Collection Added');
    }

    function onQueryFailed(sender, args) {
        alert('Failed to Add New Solution Collection');
    }

0 个答案:

没有答案