0

I have never came across this situation and need some assistance.

Below is the scenario:

  • A user gets a notification email with a hyperlink to the current item that is sent from a Workflow in List A that contains a Title and Request(Dropdown with choices New and Received).
  • When the user clicks the hyperlink from the email, the expectation is that it will change the Request column value to Received.

Is it at all possible if the user clicks on a hyperlink from email that it can change the column value of a dropdown in a List? In this case, when hyperlink is clicked it will change the Request column value to "Received"?

0

Without knowing the environment details (o365 or on-Prem), here is one solution that can work on 2013 or o365. By using custom code!

The link included in the workflow email will be directed to a custom page that have your javascript code embedded (i.e. Script Editor WP).

The link should have the ID of the item you want to update, so for example, it will be like http://site/pages/mycustompage.aspx?id=1

This code is just an example of how you can update a choice field

    <script type="text/javascript">
        var siteURL=window.location.href;
        var itemID=getQueryVariable("id");
        updateListItems(itemID);

        function updateListItems(ItemId) {
            var clientContext= SP.ClientContext.get_current();
            var oList = clientContext.get_web().get_lists().getByTitle('SPList');
            var listItem=oList.getItemById(ItemId);
            var currDate = new Date();
            listItem.set_item('ChoiceColumn', 'Received');
            listItem.update();    
            clientContext.executeQueryAsync(Function.createDelegate(this, this.onUpdateSucceeded), Function.createDelegate(this, this.onUpdateFailed)); 
        }
        function onUpdateSucceeded() {
                    alert('update success');
        }
        function onUpdateFailed(sender, args) {
            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        }

        function getQueryVariable(variable)
        {
               var query = window.location.search.substring(1);
               var vars = query.split("&");
               for (var i=0;i<vars.length;i++) {
                       var pair = vars[i].split("=");
                       if(pair[0] == variable){return pair[1];}
               }
               return(false);
        }   
    </script>

HTH!

2
  • Thanks Ahmed! Just to clarify, and sorry for the newb question, in order for it to be dynamic would I have to set the link to something like aspx?id=[CurrentItem:ID]? – Aspire27 Apr 29 '16 at 18:00
  • Yes, the link should look like that. – Ahmed Mahmoud May 1 '16 at 14:37

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.