Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Hi All,
I am working on a POC which is really very urgent for me. As per the requirement,the scenario is to save data from a nintex form to multiple lists. To achieve this, I am using javascript code with REST api to insert a new item to sharepoint list, but the issue is it gives this error message in browser console on POST request: "Failed to execute 'postmessage' on DOMWindow':The target origin provided('URL') does not match the receipient window's origin ('null')."
I am not getting any solution to use javascript to insert records all over the internet and Nintex community. Kindly help and let me know if there is any other alternative to save data to multiple lists from the nintex form.
Thanks..!!
could you post how does your request looks like?
"receipient window's origin ('null')" => sounds like you haven't provided a required value.
Thanks for replying.. My javascript looks like below:
function save() {
NWF$('.saveButton').click();
var Client = NWF$(".nsClient option:selected").text();
var CaseType = NWF$(".nsCaseType option:selected").text();
var FundDate = NWF$(".nsDate input").val();
var Plan = NWF$(".nsPlan option:selected").text();
var hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
var addNewItemUrl = hostweburl + "/_api/Web/Lists/GetByTitle('Onboarding')/Items";
alert(hostweburl);
alert(addNewItemUrl);
var data = {
__metadata: {
'type': 'SP.Data.SpListItem'
},
Client: Client,
Case_Type: CaseType,
Estimated_Funding_Date: FundDate,
Plan: Plan
};
alert("Before item addition");
addNewItem(addNewItemUrl, data, hostweburl);
}
function addNewItem(addNewItemUrl, data, hostweburl) {
var executor = new SP.RequestExecutor(hostweburl);
executor.executeAsync({
url: addNewItemUrl,
type: "POST",
headers: {
"accept": "application/json;odata=verbose"
},
data: JSON.stringify(data),
success: function(data) {
console.log("Item Created");
console.log(data);
},
error: function(error) {
console.log(JSON.stringify(error));
}
});
}
first spot: enclose data properties and field names in apostrophess and test ...
... '__metadata': ... 'Client': Client ...