AnsweredAssumed Answered

how to write JSON on Nintex Task form

Question asked by akuma577 on Jan 27, 2016
Latest reply on Jan 30, 2016 by vadim.tabakman@nintex.com

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();

this.site = ctx.get_site();

ctx.load(this.site);

this.web = ctx.get_web();

ctx.load(this.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();

console.log(file.get_name());

}

}

function innerError(sender, args) {

console.log(args.get_message());

}

main();

Outcomes