Not applicable

Form populating from Workflow

Jump to solution

We have created an OCONUS travel form that requires approval from multiple sources. Is it possible to populate the form fields with the name of the person that approves the workflow from that group? For example: Export team, 4 people on the team, 1 approves it and the form now has the name in the text field of the person that approved it for that one kind of like a signature. There are at least 5 approvals needed on this form. Any assistance would be greatly appreciated.

SharePoint Foundation 2013

Nintex Forms and Workflow 2013

Reply
7 Replies
janeyres
Novice

Re: Form populating from Workflow

Jump to solution

Hi,

In the workflow once the approval has been actioned you can update the current item using the "Last Task Respondent Display Name" option from Workflow Context.

Hope that helps.

Jan

Reply
philipplucas
Scout

Re: Form populating from Workflow

Jump to solution

Hi Brandon,

this should be possible and can be achieved in different ways. Just one idea:

You add some Javascript-Logic to the forms save button. Whenever that save button on your task form is hit and the form will be submitted, you catch the name of the current user and populate it to the textfield. Of course you will need to make sure, that the correct text field is written in. If your second approver hits the submit button, the first field will be filled already so you need an additional check to fill the correct field. For catching information about the current user, you can have a look at the SPServices JS-Framwork (here: jQuery Library for SharePoint Web Services - Home ). It provides very easy access to the current users information.

Another idea:

Add columns for the approval information in the list used for starting the workflow ("Approval 1", "Approval 2",...). Add a workflow to your task list, which fires whenever a task is completed and write back the information about the person who completed the task into these columns. Of course you would need to know what is the maximum number of approvals. But you can then connect these columns with the fields on your form and your form fields will show the values of your approval columns.

Please tell us if this could be working for you and if you need further assistance.

Greetings

Philipp

Reply
philipplucas
Scout

Re: Form populating from Workflow

Jump to solution

This should work perfectly if the tasks are assigned to single users. If there is only one task assigned to a whole group, this won't work because you cannot execute an action after a single user of that group completed his task, at least not from the workflow itself.

Reply
Not applicable

Re: Form populating from Workflow

Jump to solution

Hi, Brandon Martel​, let us know if this advice works out. Thanks!

Frank

Your community manager

0 Kudos
Reply
Not applicable

Re: Form populating from Workflow

Jump to solution

Thank you for the information. This seems like the easier of the 2 to do, but I'm having difficulties figuring it out. I found 'last task..'; however, I'm unable to figure out how to link the 2.

Reply
philipplucas
Scout

Re: Form populating from Workflow

Jump to solution

I highly recommend option number one. A simple piece of Javascript will do and adding a second workflow to your tasklist is simply too much, if you ask me.

You get the information about the current user from the workflow context and inline functions (lookupUserprofile), you can use the help function for further information about this. Having that, you just need to check all available fields in the right order and put the current user info into the first empty one.

Don't have my environment at hand =\

Reply
philipplucas
Scout

Re: Form populating from Workflow

Jump to solution

Here you have some JS-Code to start with:

NWF$(document).ready(function(){

     var currentUserName = $().SPServices.SPGetCurrentUser({

          fieldName: "Title",

          debug: false

     });

     if(NWF$("#"+fieldOne).val() == "") {

          NWF$("#"+fieldOne).val(currentUserName)

     } else {

          NWF$("#"+fieldTwo).val(currentUserName)

     }

});

This code first of all assigns the "Title" property (thats the display name) to the variable currentUserName. Afterwards it checks for my two textfields and adds it in the first empty one. You would probably need to check for more fields, but the idea is the same. The code is executed automatically when the form is loaded.

I used the SPServices JQuery library for this, because using the workflow context "current user" breaks my preview mode. And with this library you can get different kinds of information in no time.

SPServices Reference for SPGetCurrentUser: jQuery Library for SharePoint Web Services - Documentation

And don't forget to also reference JQuery (at least 1.7), otherwise SPServices won't work. Also pay attention to the order, JQuery has to be referenced first! (I always forget the order and waste 30 min with debugging). This is what it has to look like:

Capture.JPG

Hope this helps.

Greetings

Philipp

Reply