Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to write JSON on Nintex Task form

I have a nintex workflow running on a document set in a document library in SharePoint. I want to provide the documents name in the task form, so that user can approve after seeing the documents. I have the below script running in my developer tool to fetch the records inside a document set. I would like to know how to implement it inside a Task form and if I have a field in Nintex Task form having document set name, how should i bind it inside my code. And After all is done, How am I going to display it on the Nintex form. The question may be very basic but I have just started with Nintex and trying to find all it can offer.

var folderUrl = "/sites/portalmgmt/DS_Test/Powai";

var listTitle = "DS_Test";

var kk;

function main() { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadConstants); }

function loadConstants() {

var ctx = new SP.ClientContext.get_current(); = ctx.get_site();


this.web = ctx.get_web();


  ctx.executeQueryAsync(Function.createDelegate(this, function() { onSuccess(ctx); }), Function.createDelegate(this, this.onFail)); }

function onSuccess(ctx) {

kk = ctx; var olist = ctx.get_web().get_lists().getByTitle('DS_Test')

  var qry = SP.CamlQuery.createAllItemsQuery(); qry.set_folderServerRelativeUrl(folderUrl);

var items = olist.getItems(qry); ctx.load(items, 'Include(File)');

ctx.executeQueryAsync( function() { innerSuccess(items); }, innerError);


function onFail(sender, args) { console.log(args.get_message()); }

function innerSuccess(items)


for (var i = 0; i < items.get_count(); i++) {

var file = items.get_item(i).get_file();




function innerError(sender, args) {




Labels: (1)
0 Kudos
1 Reply
Nintex Employee
Nintex Employee

Re: how to write JSON on Nintex Task form

Hi Ankit,

you should be able to put something like this into the Custom JavaScript section of the Nintex Form.

Open your task action, click on Form Settings in the ribbon and expand the Custom JavaScript section.

You'll be able to put your JS into there.

In there, you'll need to find your control that you want to update.  I find one of two ways to be the easiest.

Go back to your form and double click on your control and either add some css class name (eg. cssMyControl) or expand the Advanced section and there should be an option to store ID in JavaScript Variable (eg. varMyObjID)..

Then in your JS, to get your controls object, if you used the css method:

var myObj = NWF$('.cssMyControl');

if you stored the ID, then :

var myObj = NWF$('#' + varMyObjID);

Then, after your JS runs, if you need to update your control, I'd recommend putting some HTML together for your list of documents, and then you could do something like this:


Hope this gets you started.