List 2 is a list where users can choose to be alerted if one or more documents are changed in List 1.
List 2 has a lookup field, pulling the names of the List 1s documents. The user can select multiple documents.
If a document in List 1 is changed, and a user has it selected, the user should get a mail / alert / notification about the change.
in a workflow, attached to List 1, I make a Query.
It pulls List 2, only if the user selection is not empty.
it reads 2 fields:
"The-Choices" which is stored in a collection variable: "Str-Choices".
and "The User" which is stored in a collection variable: "Str-Users"
and from here my trouble starts.
I have tried to split the Choices and users to form two variable "lists" containing each of the choices and users, as "The-Choices" in the Query contains, example: doc1.docx; picturename.jpg;calculation.xlsx ( separated by ; )
when I make a regular expression for "The-Choices":
pattern: ; ( a semicolon with no other chars around it )
input text: {workflowvariable:Str-Choices}
store in: EveryChoice (which is a collection variable )
and do the "same" with the users:
Pattern: ; ( a semicolon with no other chars around it )
input text: {workflowvariable:Str-Users}
store in: Everyuser (which is a collection variable )
the "send notification" mail is configured like this TO: EveryUser
subject ( standard text about a change )
Body:
Changes made to: EveryChoice
( and some other smart infos to where and when, which works fine)
When changes are made, the notification mail arrives with
ALL the EveryChoice in the mail-line "Changes made to: EveryChoice" like this: doc1.docx; picturename.jpg;calculation.xlsx
How do I make it send about ONLY the actually changed choices?
( I have not testet with multiple users, but I recon it is the same problem.. EveryUser will get a mail about EveryChoice.. 😞 )
DO ask if there is something in the above hard to understand... I am Danish 🙂
Best answer by MrCapion
I must "bitterly" inform You, that I dropped the extra list from wherein users could sign up to get notofications on a specific document in the other library. I thought it was smart, as it could be used "globally" to other lists and libraries. But I never could make it work, neither with Your help, nor a multiple times of trying other stuff. So I capitulated to creating a field IN the same library. A Person/Group type.
I made it work this way. 2 "extra fields" in the Library:
Users > Person / Group.
Status > Single text line.
Variables used:
tmp_comment / single text
NewCom / single text
UserNames / Collection
All-titles / Collection
UserColl / Collection.
The WorkFlow:
Wait for check out status change > wait for document is checked IN.
Check out item.
Call web service:
weburl/_vti_bin/Versions.asmx
getversions
input > item_url
output > tmp_comment
Query XML:
source: XML XML > reference > {WorkflowVariable:tmp_comment}
Output 1> Xpath > //defaultNS:result/@comments
Return as: Text
Store in: NewCom
Set Field value:
Title = Name ( the strange sharepoint thing where uploades files has no title, only a name )
Update item: Update: Current item
Status = editing ( pure text, to get a status for quering users/the specific item changed )
Commit pending changes. As is, no changes in the function. Keep the "system generated" setting )
This is primary for the Status field update. It seems the workflow cannot set the value at this time, so
we force it to change.
query list: List: My Library name is selected. Sort: Users not null
Status = editing ( there You see, now ONLY the items where status is editing is found ) output fields:
I assume you are running the workflow for each document modified in your library, since you are using a list workflow. Since you are dealing with a single item, I think a For Each action is more effective. Try something like this:
This results in a single email notification to all users tracking the file:
It is only sending notification to 1 user, not all.
this is what I have:
wait ( pause ) 1 minute. ( I have another workflow copying name to titel, and have to wait for it )
Query list: Select only items when following is True: List: UserSelections Sort: TestLibrary-Choises ( a lookup field ) Contains: Titel
Field: ID saved in: TrackedFilesID ( collection type variable )
>>>>
For each: Target: TrackedFilesID save in: Str_CurrID ( Id type ) Index: Indexed ( numbers type )
Condition: if one of the values is equal to the value: value: Str_CurrID > is empty
Set Variable: set ID_currID equal to Str_CurrID
.... Get Users: List: UserSelections Select only items when following is True: show items when column: ID ( from the list ) is equal to ID_CurrID ( ID type variable )
Save "Username" ( from the list ) in: Pg_CurrUser ( person/group type )
I must "bitterly" inform You, that I dropped the extra list from wherein users could sign up to get notofications on a specific document in the other library. I thought it was smart, as it could be used "globally" to other lists and libraries. But I never could make it work, neither with Your help, nor a multiple times of trying other stuff. So I capitulated to creating a field IN the same library. A Person/Group type.
I made it work this way. 2 "extra fields" in the Library:
Users > Person / Group.
Status > Single text line.
Variables used:
tmp_comment / single text
NewCom / single text
UserNames / Collection
All-titles / Collection
UserColl / Collection.
The WorkFlow:
Wait for check out status change > wait for document is checked IN.
Check out item.
Call web service:
weburl/_vti_bin/Versions.asmx
getversions
input > item_url
output > tmp_comment
Query XML:
source: XML XML > reference > {WorkflowVariable:tmp_comment}
Output 1> Xpath > //defaultNS:result/@comments
Return as: Text
Store in: NewCom
Set Field value:
Title = Name ( the strange sharepoint thing where uploades files has no title, only a name )
Update item: Update: Current item
Status = editing ( pure text, to get a status for quering users/the specific item changed )
Commit pending changes. As is, no changes in the function. Keep the "system generated" setting )
This is primary for the Status field update. It seems the workflow cannot set the value at this time, so
we force it to change.
query list: List: My Library name is selected. Sort: Users not null
Status = editing ( there You see, now ONLY the items where status is editing is found ) output fields: