I am new to developing apps in Visual Studio for SP. I have a problem to use the standard functions for creating a workflow. Currently I need the workflow action Set field in current item
, but I don't know where to find this action. Which action in VS is the replacement for that action? I was trying to use the Update list item
action too, but it asks me for a C# expression, how to write the placeholders for the columns?
1 Answer
Yes you can use the UpdateListItem
activity.
In the ListItemPropertiesDynamicValue
property you need to set the Path
and the Value
. In Path
select the field you want to update. In Value
enter the value you want the field to be.
So, for example, if you want a field called Status
- which is a Single Line of Text field - to be set to "In Progress" it would look something like this:
If the field you want to update was a Number field, then you would simply enter a number in Value
.
But remember in the Value
field you can also enter the name of a workflow variable, if you've defined any.
Update:
It seems you're asking how to assign a workflow variable to the workflow item's ID.
First you need the item ID. Use the GetCurrentItemId
activity:
In this activity's properties set the Result
property to a workflow variable of your choice, I've created one called itemId
:
Then you need the Assign
activity:
And set its properties like so:
WorkflowID
will be assigned to the value of itemId
.
-
Thank you for your answer. I found that way, but I don't know how to put in the Value field a placeholder. For example. I need to set in one column the ID of the item. In SPD I would use the Set field in current item action and set MyField to CurrentItem:ID.– SenadCommented Feb 8, 2016 at 15:53
-
Are you saying you have a workflow variable called
MyField
or something else and you want to take the value of this workflow variable and use it to set the value of a column in your list item? If so, in theValue
field in the screenshot above just enter the name of your variable.– SubmitsCommented Feb 8, 2016 at 16:02 -
For my example I need to set the ID of the item to the field "MyField". On your screenshot MyField should be in the Path column and the ID of the item should be in the Value column.– SenadCommented Feb 9, 2016 at 8:41
-
That's correct. But, do you know that the
ID
column of a list item is read only? You can't update it.– SubmitsCommented Feb 9, 2016 at 10:04 -
Sorry for misunderstandings, I need the opposite. Here is a screenshot from SPD from the action that I need. imgur.com/thxyA0C– SenadCommented Feb 9, 2016 at 13:17