lundi 25 octobre 2021

Sharepoint - Javascript, How can i add data to multiple choice field set as checkbox

I have five fields in the list. The four fields in the list are of chooice type You can see in the picture

Two of the choice fields are of dropdown type and two of them are of checkbox type. I gave the options that these fields should take while creating For the Checkbox type, I first print the values I have given as default to the screen. Then I assign the value of the selected ones to the array. But I cannot save the data in these arrays to the checkbox type choice fields. I try to save a string instead of array but it still doesn't save. How can we save data to choice fields of type checkbox?

In the code below, selectedPositive and selectedPotential variables take arrays. PotaDurumuOlumlu and PotaDurumuPotansiyel are the names of the choice field fields in the checkbox type, which are in the comment line in cItem. And I can't save there. Can you help me?

function saveForPotaSureci() {
var dealerId = $.urlParam('dealerId');
var potaAction;
if ($("#txtMarketKodu").val() != "") {
    potaAction = "Tamamlandı";
}
else { potaAction = $("#statusAction").text(); }

var potaStatu = $("#ddlPotaStatu").val();

var selectedPositive = selectedPositiveCheckboxValues;
var selectedPotential = selectedPotentialCheckboxValues;
var teststring = "Teminatı alabiliyor mu?";
var magazaKodu = $("#txtMarketKodu").val();
var potaAction2 = $("#statusAction").text();
var portfoyAciklama = $("#txtPotaAciklama").val();
var itemType = "SP.Data.BayiTalepTestListItem";
var cItem = {
    __metadata: {
        type: itemType,
    }
};
cItem = $.extend({}, cItem, {
    PotaStatuDurumu: potaStatu == "" ? null : potaStatu,
    //test: selectedPositive == "" ? null : selectedPositive,
    //PotaDurumuOlumlu: teststring == "" ? null : teststring,
    //PotaDurumuPotansiyel: selectedPotential == "" ? null : selectedPotential,
    MagazaKodu: magazaKodu == "" ? null : magazaKodu,
    PotaAksiyon: potaAction2 == "" ? null : potaAction2,
    PortfoyAciklama: portfoyAciklama == "" ? null : portfoyAciklama
});
if (dealerId != null && dealerId != 0) {
    updateDealerListItemNew2(dealerId, 'BayiTalepTest', cItem, function () {
        console.log('Record updated successfully..');
    });

}
console.log("Pota Statu:" + potaStatu + "Pota Action:" + potaAction + "Olumlu Checkbox:" + selectedPositive + "potansiyel:" + selectedPotential + "magaza kodu:" + magazaKodu);

}




Aucun commentaire:

Enregistrer un commentaire