Solved

Updating a SharePoint List with Approver's User ID

  • 22 March 2016
  • 5 replies
  • 8 views

Badge +10

Here is the scenario, when an approver denies or approves a list item, I need to save approver's user ID or Name in a custom field in SharePoint list. SharePoint list has "Modified By " field but when K2 Workflow updates an item, this field has default K2 user and not the actual user ID. So I can not use "Modified By " field and  I need to retain the user ID that last updated the item in a separate field. I am updating list item using "Update List Item" option in K2 Workflow.

 

Thanks,

icon

Best answer by Andrew_Blinco 22 March 2016, 23:28

View original

5 replies

Badge +5

Hi, you could do this from the form or on the workflow. 

 

First create a custom column in the SharePoint list/library then;

 

1. On the form you could create a text box or add a control which transfers the users name or email when the form is initialized and when the submit button is clicked, you can pass that name into a datafield in the workflow and once it's in the datafield in the workflow you can easily save as part of the "Update List Item" method. 

 

2. Using K2 Studio WF (not sure you can do this in K2 Designer WF), from the context browser save the "Activity Destination User" Display Name or email into the SharePoint custom column. 

Userlevel 1
Badge +8

Hi K2_Beginner

 

As you are probably aware SharePoint stores the data for a Person column as the ID for the person for that Site Collection. So to populate that field you will need to first find the ID for the user on that Site. If you are using SharePoint 2013 there is a Get User method in the SharePoint 2013/[Site Collection Name]/Management/User SmartObject that will return a user ID given the account (domain/account).

Badge +10

@Latte,

I searched for "Activity Destination User" option in context browser, didn't find it. I am using Web-based designer. Under what category, you see this option in K1 Studio?

 

Thanks

Badge +10

Thanks Andrew!!

 

Will I create a new Smartobject to call GetUser. When I try to create a new Smartobject, I don't see GetUser under Management. Please see attached.

 

BTW I am not using Smartform but SharePoint form. Also, I am using Web-bsed designer and not the Studio.


Thanks again.

Userlevel 3
Badge +9

I want to get the username from SharePoint people picker column but SharePoint 2013 returns display name and user ID.  

You have 2 options to get the user name.

1. user the SharePoint 2013 -> site collection -> management -> user smartobjet.

you can pass the user ID you got from SharePoint picker column. 

2. update the service instance and make true for hidden list. you will see user information list.

Create smartobject and use that to get username from the user ID.

Reply