Add New Item Button - List or Library Control

Hi Guys,

We have a Form with a List or Library Control where we need to Pass data through from the parent to the child when a user clicks the Add New Item. For now I have done this by creating a button on the form and placing this above the control, this works really well. My code in the button OnClick is:


function openDialog () {
var itemId = fd.itemId;
var costUplift = fd.field('Cost_x0020_Uplift_x0020__x0025_').value;
var profitMultiplier = fd.field('Profit_x0020_Multiplier').value;
var status = fd.field('Status').value;"", { 
	quotationReferenceId: itemId,
	costUplift: costUplift,
	profitMultiplier: profitMultiplier,
	status: status

My questions are: -

a) Could we lose the additional button and inject this functionality into the standard Add new item button on the List or Library Control?
b) Can we hide the default Add new Item button from the control without making the whole control Read Only?

I assume both of the above are possible, it would be good to know how to do both as in this scenario I will probably stick with the additional button and hide the default but in others it may be easier to use the default but we would still want to pass through field data…

Also how to hide other functions within the List or Library control such as the delete item button?


Dear Tony,

You don’t need to pass the data from the parent to the child because on the child form you still have access to the parent form by “”.

You can hide delete and edit columns by this code:


To hide a default “Add new item” button:


Hi Alex,

I have tried to use the functionality and it doesn’t work as I’d expect, could you let me know where I’m going wrong please??

var status ='Status').value;

The Error I get is: -

VM587 spform.js:1 TypeError: Cannot read property 'field' of undefined
at eval (eval at e._executeCustomJavaScript (spform.js:38), <anonymous>:39:29)
at spform.js:1
at (<anonymous>)
at Function.e.safeRun (spform.js:1)
at spform.js:68


Dear Tony,

Have you placed the “” code on the child form? Do not forget to check if is defined because it’s only defined when a child form is opened in the dialog mode.

Hi Alex,

The code is 100% on the child form and it doesn't matter if open a form in a dialog by clicking the Add new item button on a List or Library Control, or click the edit button next to an item, or click the new button that I added to open a New form in a dialog the result is the same...

This is my code I'm testing with: -

// Set Variables for values from Arguments

function setStatusFromTopWindow () {
	if ( {
		var status ='Status').value;
	} else {
		var status = 'In Progress';

My Form looks like: -

And the debug: - Capture


Dear Tony,

I’m sorry, I forgot to mention you that you need to define fd globally in the parent form: window.fd = fd;

Hi Alex,

Thats worked well thank you…