0

I have situation where clicking on Bulk-Approve button, a mail has to be triggered. When I click on approve button, it approves many items at a time.

Now I want to send a mail when this button is clicked. If I do it by workflow, it sends multiple mails to same person as multiple items has been modified.

What should be done so that it sends only one mail?

0

I had similar situation, to send reminder to the assigned users. In button click you can use below code, which will send single mail to single user who are assigned to more than one task. What happening here actually i am saving the user information who is already informed, so that it should not receive more than one mail on single button click.

  StringBuilder nusers = new StringBuilder();

  nusers.Append(" ");
  SPFieldUserValueCollection userVals = (SPFieldUserValueCollection)ListItem[SPBuiltInFieldId.AssignedTo];
   foreach (SPFieldUserValue userVal in userVals)
     {
    SPUser user = userVal.User;

    string nAssignedTo = user.Name.ToString();

       if (!nusers.ToString().Contains(nAssignedTo))
         {
         //do your stuff...
         }
    }

Try out the code and let me know if you have any doubt. It's Done!!

  • But is there any way dat i can do it through workflow? – KumarV Aug 14 '15 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.