JensH

Get list properties in columns calculated value

Discussion created by JensH on Nov 4, 2019
Latest reply on Nov 4, 2019 by Matthias_Walter

Hi @all,

 

is it possible to get the list id of a specified list in Things in background -> calculated values of a link column. The requirement is to calculate a link column with link to version history of an element.

 

 

I tried this Function Code but it did not work:

 

 

==================================

var list;
var listId;

 

function getListId() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
list = web.get_lists().getByTitle('Vertraege');
context.load(list, 'Id');

 

context.executeQueryAsync(Function.createDelegate(this, success), Function.createDelegate(this, error));

 

}


function success() {
listId = list.get_id();
console.log(listId);
}

 

function error(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}

 

// INIT
getListId;
var url = [[@Web.Url]]+'/_layouts/15/Versions.aspx?list='+listId+'&ID='+[[ID]]+'&IsDlg=1, Versions';
return url;

==================================

 

It returns undefined for listid. :-(

Successful evaluation with result: ""/sites/dev-vm/_layouts/15/Versions.aspx?list=undefined&ID=79&IsDlg=1, Versions""

 

How could I implement to get the list id?

 

Thanks in advance.

Jens

Outcomes