Update a list item after a task is completed
Hi,
I have a sharepoint workflow, where I am creating a workflow and the workflow steps involves assigning a task. How do I Update a list item after the task is completed? So after the task assignment step, how do I check that the task is completed so I can
update a list item?
Please help.
techie
Hi,
According to your description, you might want to update a list item after a task is completed in SharePoint Designer workflow.
By default, the workflow will stuck at a “Assign a task” action. When the “Task Status” become “Completed”, other actions afterwards will go on.
Here is a demo about how to update a list item after a task is completed in my environment:
You can follow the steps above to make a test in your environment to see if this is what you want.
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support
Similar Messages
-
Hi,
I am receiving the below error when I update a List item.
'Catastrophic failure (Exception from HResult:0x8000FFF(E_UNEXPECTED))'
I have enabled the Verbose logging, and below are the details of the error that I have taken from Log Files.
Application error when access /sites/exg/Lists/Applics/EditForm.aspx, Error=Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)
Kindly advise the resolution to avoid this error.
ThanksHi shameej,
i found a similar thread , can you plz check it?
http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/2ee9e393-70f9-4ec7-b19b-f107ef204ef7
http://www.sharepointdev.net/sharepoint--development-programming/catastrophic-failure-after-itemupdatingeventhandler-66510.shtmlBest Regrads,
Ahmed Madany -
Hi All
I have one sharepoint list with huge data i.e with 20columns and more than 200 records with the fields .
Suppose lets consider there are A,B,C,D,E,F,G,H columns.
Now i want to create one form with the fields A,C,E.
When the user enter the existing data of list for columns A,C..based on C value the E column value should change and update that particular item in the list.
Please guide me without visual web part can we acheive this by Sharepoint designer 2013 or what would be the preferable solution.
Please help me on this as it is very urgent from me..
Thanks in Advance
Sowjanya GHi,
According to your post, my understanding is that you wanted to update the list item in the same sharepoint list with particular condition with Sharepoint Designer 2013.
I recommend to create workflow associated to the list and then start the workflow automatically when an item is changed.
In the workflow, you can add condition and actions as below:
If current item: C equal to Test1
Set E to Test2
Then the value of the filed E will be changed based on the value of the filed C.
In addition, if you create the form using InfoPath, you can add rule to the filed C as below:
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
I have created a farm solution and then i deploy it to SharePoint server, the code looks as follow, and i use it to update a page info values (as the current page values represents old info):-
[ToolboxItemAttribute(false)]
public partial class VisualWebPart1 : WebPart
// Uncomment the following SecurityPermission attribute only when doing Performance Profiling using
// the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
// for production. Because the SecurityPermission attribute bypasses the security check for callers of
// your constructor, it's not recommended for production purposes.
// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
public VisualWebPart1()
protected override void OnInit(EventArgs e)
base.OnInit(e);
InitializeControl();
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
using (SPWeb web = site.OpenWeb())
SPList list = web.Lists["Pages"];
web.AllowUnsafeUpdates = true;
foreach (SPListItem items in list.Items)
items["Author"] = "SharePoint";
items["Created"] = "01/08/2014 01:44 PM";
items.Update();
list.Update();
web.AllowUnsafeUpdates = false;
protected void Page_Load(object sender, EventArgs e)
but when i try adding this web part to a page i got the following error:-
Invalid data has been used to update the list item.The field you are trying to update may be read only
so can anyone advice?i only changed lines bitween
web.AllowUnsafeUpdates = true;
and
web.AllowUnsafeUpdates = false;
and other parts of code remains without change
so it will updates all pages in current web
yaşamak bir eylemdir -
Trying to follow Serge Luca's Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007. http://sergeluca.spaces.live.com/blog/cns!E8A06D5F2F585013!859.entry
I have an onWorkflowActivated, followed by an ifElse condition and a log to history.
In the IfElse, each branch has a code segment, that trys to update the status column in the list that the workflow is attached to.
private void Authorize_ExecuteCode(object sender, EventArgs e)
// tried serveral methods
WorkflowProperties.Item["Status"] = "Automatically Approved";
// tried all of the following (one at a time)
item.update();
WorkflowProperties.Item.Update();
WorkflowProperties.Item.SystemUpdate();
//tried this as well.
Microsoft.SharePoint.SPListItem item = WorkflowProperties.Item;
item["Status"] = "Automatically Approved";
item.Update() ;
On the update call I keep getting "Invalid data has been used to update the list item. The field you are trying to update may be read only."
Could someone explain how to update "Status" column of the list item that the workflow is working on?
Thank you very much.
Bill
Hi:
you can do the following:
add the following code to the workflow.xml file (under the MetaData section)
Code Snippet
<ExtendedStatusColumnValues>
<StatusColumnValue>Branch1</StatusColumnValue>
<StatusColumnValue>Branch2</StatusColumnValue>
</ExtendedStatusColumnValues>
then add 2 SetState activities one in each branch of the IfElse.
for the code behind of setState1 (branch1) write the following code:
Code Snippet
state = Convert.ToInt32(SPWorkflowStatus.Max);
for setState2 (branch2) write the following:
Code Snippet
state = Convert.ToInt32(SPWorkflowStatus.Max) + 1;
where state is the variable assigned to the field State in the properties of the SetState(design lever), or instead of state u can use the following code:
Code Snippet
((SetState)sender).State
where sender is the object sent through the function parameter.
hope this answered your question
Best Regards -
Hi.
I am getting below error while adding value to look-up field.
Invalid data has been used to update the list item. The field you are trying to update may be read only.
I have tried many forums ans post but didn't come to know what's the root cause of issue. I am also posting Code for creating and adding lookup field.
CAML to create lookup field (It works Fine)
string lkproductNumber = "<Field Type='Lookup' DisplayName='Product Number' StaticName='ProductNumber' ReadOnly='FALSE' List='" + pNewMaster.Id + "' ShowField='Product_x0020_Number' />";
Code to insert value to lookup field
ClientContext client = new ClientContext(SiteUrl);
client.Load(client.Web);
client.Credentials = new NetworkCredential(this.UserName, this.Password, this.Domain);
// Lookup Lists
List pmList = client.Web.Lists.GetByTitle("Product_Master");
//List Conatining Lookup Columns
List piList = client.Web.Lists.GetByTitle("Product_Inventory");
client.Load(piList);
query.ViewXml = "<View/>";
ListItemCollection collection = pmList.GetItems(query);
client.Load(collection);
client.ExecuteQuery();
int prodid=0;
foreach (ListItem item in collection)
if (Convert.ToString(item["Product_x0020_Number"]) == ProductNumber)
{ prodid = Convert.ToInt32(item["ID"]); }
ListItem piItem = piList.AddItem(new ListItemCreationInformation());
piItem["Product_x0020_Number"] = new FieldLookupValue() { LookupId = prodid };
piItem.Update();
client.ExecuteQuery();
Exception Detail
Microsoft.SharePoint.Client.ServerException was caught
Message=Invalid data has been used to update the list item. The field you are trying to update may be read only.
Source=Microsoft.SharePoint.Client.Runtime
ServerErrorCode=-2147352571
ServerErrorTypeName=Microsoft.SharePoint.SPException
ServerStackTrace=""
StackTrace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at WebServiceProviders.ClientServices.NewProductInventory() in Z:\.............ClientServices.cs:line 889
InnerException:
Quick response is highly appreciated.
Thanks
MeharTry some thing like below,
your data value that needs to be update should be in this format "ID of the lookup";#"Title of the Lookup"
For example,
listItem["Product_x0020_Number"]
= "1;#iPhone";
listItem["Product_x0020_Number"]
= "2;#Mobile";
Hope this helped you.... -
How to update 500 list items using Rest API
Hi All,
i have requirement that is "required to update 500 list items using rest Api".
how can i do it,please share your thoughts with me.
Thanks,
Madhu.Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development -
Update a list item based sort order of created by column value
HI
using powershell script how to sort a list column before update a list item.
here i created a document library and uploaded some documents and update ProcessNo column based sort order of created column
value.
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$webURL = "http://tspmcwfe:91" $listName = "Courts"
Get the SPWeb object and save it to a variable
$web = Get-SPWeb $webURL
$list = $web.Lists[$listName]
$items = $list.items
Go through all items
foreach($item in $items)
$item["ProcessNo"] = 1
$item.Update()
$web.Dispose()Hi,
According to your description, my understanding is that you want to sort the list items order before updating items using PowerShell.
I suggest you can use the Sort-Object command to sort the list items.
Here are some detailed articles for your reference:
Better SharePoint Lists and List Items in PowerShell
Sort-Object
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
ECMA/CSOM script to update multiple list items
i am trying update multiple list items using CSOM/ECMA script but it updates only first record. can help out .how to update multiple list item records
Note(sharepoint hosted APP) only client side coding solution
function updateListItems() {
var itemArray = [];
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('TestList');
for(var i = 1; i<= 5; i++){
var oListItem = oList.getItemById(i);
oListItem.set_item('Title', 'My Updated Item!' + i);
oListItem.update();
itemArray[i] = oListItem;
clientContext.load(itemArray[i]);
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
function onQuerySucceeded() {
alert('Items Updated');
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
updateListItems();Have a look at the following link for your reference
https://social.msdn.microsoft.com/Forums/office/en-US/fc91b7b5-6300-4302-af93-4fc697131ec5/client-object-model-update-multiple-list-items?forum=sharepointdevelopment
You can modify CAML query to fetch rows that you want to fetch.
Geetanjali Arora | My blogs | -
Workflow - how to update multiple list items
Is it possible to update up to 3 list items with the same information using a workflow? My scenario is where a company vehicle (registration number) has up to three drivers assigned to it - Driver Name 1, Driver Name 2 and Driver Name 3. I
have two separate lists - one for vehicles (fleet list) and one for drivers (driver database). In my workflow when an item is created or changed in the fleet list, I would like the current vehicle registration to be updated in all three driver records
in the driver database. I am not sure if I can do this as I am unsure of what my unique look up would be as I need to be able to tie a vehicle registration to a driver name. Any advice would be much appreciated.
ThanksHi,
Refer to the following threads about how to update multiple list items simultaneously.
http://social.technet.microsoft.com/Forums/en-US/936d05ba-6e86-4f44-bbdb-b3c5c12b2c68/how-do-i-update-multiple-list-items-at-once-in-a-sharepoint-list
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2d342b01-1978-40c9-a203-303d145b331e/how-to-update-mulitple-list-items-at-same-time
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8d5b7424-58dc-470b-8142-90755dbdeaae/sharepoint-workflow-change-multiple-items-in-other-list
Thanks.
Tracy Cai
TechNet Community Support -
Failed to update a list item to external list
I'm getting below error when I try to add my record to external list. This happen when spExternalItem.Update for 2nd time. I have value in my params
"Failed to update a list item for this external list based on the Entity (External Content Type) 'SA' in EntityNamespace 'Triggers'. Details: Null was returned to FindSpecific (Read Item operation)."
SPList spExternalList = contentDb.Sites[0].RootWeb.Lists["SA"];
List<string>
lstMachineNames = GetMachineNames(lstWarehouseTaskRecords);
foreach(stringstrMachineName
inlstMachineNames)
SPListItemspExternalItem = spExternalList.Items.Add();
spExternalItem["FormType1"]
= "WH";
spExternalItem["SerialNum1"]
= strMachineName;
spExternalItem.Update();
Serial Number is "map to identifier" in External Content types. "Required" and "Read-only" check box is uncheck. Anyone has any idea? please help.
[UPDATED 7 May 2014]
I believe it is due to BDC problem. I created another column called ID so I can map this ID column as identifiers instead of using SerialNum1 and this error solved!Hi,
As you said, the error thrown when executing the Update method for the second time.
I suggest you debug your code in Visual Studio and keep watching the values of objects in use to get more details about the root cause of the error.
What’s more, you can take a look at the posts from Dimitry and Scot in this thread with similar error message:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/29fb464f-3539-40c4-91c5-216b0363b8ef/null-was-returned-to-findspecific-read-item-operation?forum=sharepointdevelopmentprevious
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Patrick Liang
TechNet Community Support -
Update existing list item value in sharepoint using web service code
I have the below code which I am trying to run for updating the list item value. "Settings" is the list name and the item in this list is having index of 1.
Main()
ListsSoapClient client = new ListsSoapClient();
client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
string strListName = "Settings";
client.Open();
XElement listData = client.GetList(strListName);
string listID = listData.Attribute("ID").Value;
string version = listData.Attribute("Version").Value;
// string version = listData.Attribute("View").Value; Doesnt work
// Method 1 : Make the call to SharePoint
var listItems = client.GetListItems(strListName, null, null, null, null, null, null);
List<XElement> results = listItems.Descendants().ToList();
XElement updateItem = results[1];
updateItem.SetAttributeValue("ows_Value", "value to update");
client.UpdateListItems(strListName, updateItem); //Didnt work
// Method 2 : Make the call to SharePoint
string strBatch = "<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>1</Field>" +
"<Field Name='Title'>" + "999" + "</Field></Method>";
XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
//elBatch.SetAttribute("OnError","Continue"); //Not mandatory ?
//elBatch.SetAttribute("ListVersion","1"); //Not mandatory ?
//elBatch.SetAttribute("ViewName", "00F85842-35AD-4AED-8DF7-0F903FB850BE"); is it mandatory ?
elBatch.InnerXml = strBatch;
client.UpdateListItems(strListName, XmlElementToXelement(elBatch)); //doesnt work
client.Close();
public static XElement XmlElementToXelement(XmlElement e)
return XElement.Parse(e.OuterXml);
How do we get the ViewName value of the list using code ? why is it not mandatory in Method 2. At the end of the method1 i am getting the below exception.How do I fix this ?
Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.you can get view name using below links:
http://stackoverflow.com/questions/14857811/sharepoint-web-services-getlistitems-view-name
http://www.a2zmenu.com/Blogs/SharePoint/Get-selected-view-name-of-a-SharePoint-List.aspx
you can use SPList.getview method. -
How to Disable Event firing while updating a list item using poweshell
Hi All,
I am working on a powershell code which updates most of the list items in the entire web application. I am using SystemUpdate($false) to update the items so that 'modified' and 'modified By' and versions are not changed.
However event receivers gets fired which is now a problem. I want to disable the Event receivers before update and enable it after update. I want powershell code for this. I am using SharePoint 2010.
Your help would be much appreciated. Thank you in anticipation.
Regards
Karthik R.hi
check this thread:
How to disable event firing outside an event. It contains example on C#, but it is not difficult to convert it to PowerShell.
Blog - http://sadomovalex.blogspot.com
Dynamic CAML queries via C# - http://camlex.codeplex.com -
Custom itemRenderer in a F3 ComboBox on specific list items after combobox creation
Hi,
I'm trying to set a specific list item in a mx combobox to have a custom item renderer, the problem is that I cannot do this via mxml, it needs to be done via actionscript at a later stage, eg: combobox gets created, combobox gets populated, user does other tasks, combobox needs to set one or more items in the combobox to have icons (via item renderer)..
I can do this via the onChange event, but it only applies the icon when the combobox is opened and there is a slight delay so you can see the icon being added.
Thanks in advance for any help
JHi,
If I understand correctly, you can create you comboBox with all items at the begining:
http://blog.flexexamples.com/2007/08/18/displaying-icons-in-a-flex-combobox-control/
After that, base on user task, you can filter you comboBox:
http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-items-in-a-datagrid-in- flex/
In this way you don't see the delay.
Johnny
Please rate answers. -
Hi Everyone,
i am facing one problem ...
when i am updating an SharePoint List item, it is throwing above error....
This is my code......
try
tbl = getListDateTable("NCR");
DataTable dt = tbl;
oWebsite = mysite.OpenWeb();
oList = oWebsite.Lists["NCR"];
SPListItem itemToUpdate = null;
foreach (SPListItem listItem in oList.Items)
listItem.Update();
workOrderID = Convert.ToInt32(txtTitle.Text);
itemToUpdate = listItem;
//SPListItem itemToUpdate = oList.GetItemById(workOrderID);
//itemToUpdate.Fields["Title"].ReadOnlyField = false;
//string str = ddlStatus.SelectedValue;
itemToUpdate["Title"] = txtTitle.Text;
itemToUpdate["JobNumber"] = txtJobNumber.Text;
itemToUpdate["PartNumber"] = txtPartNumber.Text;
itemToUpdate["PartDescription"] = txtPartDescription.Text;
//itemToUpdate["RequiredBy"] = txtRequiredBy.Text;
itemToUpdate["ReportedBy"] = txtReportedBy.Text;
itemToUpdate["WrittenBy"] = txtWrittenBy.Text;
//itemToUpdate["DateOpened"] = txtDateOpened.SelectedDate;
//itemToUpdate["DateClosed"] = txtDateClosed.SelectedDate;
itemToUpdate.Update();
oList.Update();
// bind();
catch (Exception ex)
throw ex;
Thanks
viswanathHi Viswanath,
If you are using People/User Type Field Column then use below code methord
SPUser user = web.EnsureUser(loginName);
item["UserTypeFieldName"] = user;
Lookup Type Field Column then use below code methord
public static SPFieldLookupValue GetLookupFieldFromValue(string lookupValue,string lookupSourceColumn, SPList lookupSourceList)
SPFieldLookupValue value = null;
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='" + lookupSourceColumn + "'/><Value Type='Text'>" + lookupValue + "</Value></Eq></Where>";
SPListItemCollection listItems = lookupSourceList.GetItems(query);
if(listItems.Count > 0 )
value = new SPFieldLookupValue(listItems[0].ID,lookupValue);
return value;
item["LookupField"] = GetLookupFieldFromValue(lookupfieldValue, lookupSourceColumn, listName);
Please mark the replies as answers if they help or unmark if not.
Maybe you are looking for
-
See detail in original question. Here is the text from the dialog box which comes up, with fields for Username and Password: "The proxy fastun.com:7000 is requesting a user name and password. The site says: "fasTun"." This means I'm unable to use MFF
-
How can i install snow leopard together with lion, on a Lion based MacBook Pro ultimo 2011
Hi How can I install Snow Leopard on a Lion Based MacBook Pro ultimo 2001. I will both have installed Snow Leopard and Lion on my computer, but how can i do that? I have purchaded Snow Leopard, but I can installed it Pls can anyone help me Best regar
-
ATI driver 11.8 - lost OpenGL
Just to say - and sorry if it's been mentioned already - I lost OpenGL (in CS5) and its functionality with the ATI 11.8 driver today. Going back to 11.7 put things right.
-
RA for WBS element showing RESA Status
Hi PS experts! I am new to SAP and have a doubt. I want to know whether Result analysis (KKA2 or KKAJ) can be successfully done for a WBS element having RESA status. We use WBS elements to book and post Time (as per project requirement). And so, if I
-
Could not complete your request because an adjustment or fill layer cannot be converted to the desti
Getteing the following message when dragging layers between files - Could not complete your request because an adjustment or fill layer cannot be converted to the destination document mode. Original file was client created and supplied. I have issola