Enter default values into FieldContainer

144 Views Asked by At

I am using a Field Container to enter a new Contact information, and I would like to populate some of the fields with values.

I can do this for normal fields like Phone and LastName, but ti does not work for lookup fields like ReportsTo and Account.

This is th code I am using:-

var acc:DynamicEntity = new itemClass("Contact");
acc.Phone="8888";
acc.LastName="Nieddu Srl"
acc.ReportsTo  ="0012000000RsJYb"
acc.Account="test"
_createFieldContainer.render(acc)

Is there any way to populate a lookup field with a default value when the field container is called??

Thanks

Roy

1

There are 1 best solutions below

0
On

I can see a couple of issues here:

  1. You need 'Id' on the end of your lookup fields - i.e. ReportsToId, AccountId
  2. You need to supply a real object Id for Account.

So your code would look something like:

var acc:DynamicEntity = new itemClass("Contact");
acc.Phone = "8888";
acc.LastName = "Nieddu Srl";
acc.ReportsToId = "0012000000RsJYb";
acc.AccountId = "00123400000RHEG";
_createFieldContainer.render(acc);