This is Suitescript 1.0
# suitescript
b
This is Suitescript 1.0
l
nlobjSublist.addField()
, type is 'url'
b
I tried the 'url' type field and used setLinkText to mask the URL, but it doesn't work
n
Hi @bharath64 you could implement this by using a text field. the value for the text field will be using an anchor tag for with the url you with to bind it to. below is a sample. var someField = form.addField(); // text field var someUrl = ‘www.google.com'; var linkText = ‘<a href=“’ + someUrl + ‘“>Yahoo.com</a>’ ; someField.setDefaultValue(linkText); this also works on sublist fields
b
Thanks @Noe de Jesus, I tried this approach , it still didn't work for me in 1.0
n
hello @bharath64. I forgot to mention that the field should be readonly (inline). in this case for the sublist it should be a list or of static list type. I've attached a code written in 1.0 as a sample. var form = nlapiCreateForm('sample form'); var txtField = form.addField('custpage_linkfield', 'text', 'sample field'); var linkText = '<a href="https://www.google.com">Sample Link</a>'; txtField.setDisplayType('inline'); txtField.setDefaultValue(linkText); var sublistData = [ {"text": "Go to Google", "link": "www.google.com", "id": 1}, {"text": "Go to Yahoo", "link": "www.yahoo.com", "id": 2}, {"text": "Go to Facebook", "link": "www.facebook.com", "id": 3} ]; var sublist = form.addSubList('custpage_samplelist', 'list', 'sample sublist'); sublist.addField('id', 'text', 'link id'); sublist.addField('linelink', 'text', 'clickable text'); sublistData.forEach(function (line, i) { var index = (i + 1); sublist.setLineItemValue('id', index, line.id); var lineLink = '<a href="https://' + line.link + '">' + line.text + '</a>'; sublist.setLineItemValue('linelink', index, lineLink); }); response.writePage(form);
b
Thanks ! That worked . 🙂
n
You're welcome.