Document check-in on submit
Hello mnikitina,
Hi have already a workflow start after a modification, the first step of the workflow is to wait the check-in of the document.
So when the Test field value will be set to Yes on submit, I want also to check-in the document.
Is it possible?
Thanks
Hi have already a workflow start after a modification, the first step of the workflow is to wait the check-in of the document.
So when the Test field value will be set to Yes on submit, I want also to check-in the document.
Is it possible?
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear @cmagnan,
It wouldn't work in onsubmit, as it takes time to process a request, but you can make sure the file is checked in and then saved:
There is a problem with this method though... The changes on the form are not applied before save, so if required fields are filled in on the form - they'll be missing, and the save is not triggered before check-in - it's a catch-22.
You can try to remedy it, by setting required fields manually. For example, here I am setting fields Title and Date manually:
This, on the other hand will give you a message that the item has been modified when you try to save:
It wouldn't work in onsubmit, as it takes time to process a request, but you can make sure the file is checked in and then saved:
Code: Select all
var itemId = fd.getUrlParam(window.location.href, 'ID');
var targetListItem;
function runCode() {
var clientContext = new SP.ClientContext.get_current();
var targetList = clientContext.get_web().get_lists().getByTitle('Documents');
targetListItem = targetList.getItemById(itemId);
clientContext.load(targetListItem, 'FileLeafRef');
clientContext.executeQueryAsync(function(){
var oFile = targetListItem.get_file();
console.log(oFile);
oFile.checkIn();
clientContext.executeQueryAsync(function(){
fd.save().click();
}, function(sender, args){
alert('Failed! ' + args.get_message());
});
});
}
runCode();
You can try to remedy it, by setting required fields manually. For example, here I am setting fields Title and Date manually:
Code: Select all
var itemId = fd.getUrlParam(window.location.href, 'ID');
var targetListItem;
function runCode() {
var clientContext = new SP.ClientContext.get_current();
var targetList = clientContext.get_web().get_lists().getByTitle('Documents');
targetListItem = targetList.getItemById(itemId);
clientContext.load(targetListItem, 'FileLeafRef', 'Title','Date','DateTime');
clientContext.executeQueryAsync(function(){
targetListItem.set_item('Title', fd.field('Title').value());
var dateString = fd.field('Date').value();
var dateParts = dateString.split(".");
var dateObject = new Date(+dateParts[2], dateParts[1] - 1, +dateParts[0]);
targetListItem.set_item('Date', dateObject);
targetListItem.update();
clientContext.executeQueryAsync(function(){
var oFile = targetListItem.get_file();
console.log(oFile);
oFile.checkIn();
clientContext.executeQueryAsync(function(){
fd.save().click();
}, function(sender, args){
alert('Failed! ' + args.get_message());
});
}, function(sender, args){
alert('Failed! ' + args.get_message());
});
});
}
runCode();
Cheers
-
- Posts: 2
- Joined: Tue Nov 17, 2020
I'm using the new cache submission page and the only way to submit a cache listing for review is to check off the "Yes, the cache is in place and ready to be found" checkbox.
How do I submit a coordinate check without enabling that checkbox?
Just enable the listing with a note to the reviewer indicating I am checking if the location is free?
How do I submit a coordinate check without enabling that checkbox?
Just enable the listing with a note to the reviewer indicating I am checking if the location is free?
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear JacksonPsynC,
Unfortunately, I am not sure what you mean. Are you using Forms Designer for this? Can you attach some screenshots that would showcase the process, and also what exactly you want to achieve?
Unfortunately, I am not sure what you mean. Are you using Forms Designer for this? Can you attach some screenshots that would showcase the process, and also what exactly you want to achieve?
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 23 guests