function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
efantiniefantini 

Fields order in Custom Object

Folks,

looking at the properties of object "field" i do not see any reference to a tab/position , that, i can eventualy use to order the colums of a custom object.

The simplest way i though, was to assign a sequential name to the field ( ex ob1_axxx__C, ob1_bxxx__C ... ) , but, although the wsdl displays the fields list in the correct order, this order is not respected in the custom object visualization.

Any hint?

Thanks

 

 

 

adamgadamg
Custom objects don't have layouts/displays assosicated with them, so there is no concept of field/tab order. This may change in the future.
efantiniefantini

sure they don't, that's why we use s-controls to fill-in and display them, i though.

For instance, It is very much possible that in some cases you need to define a specific colums display order ( eg. Price, QTY,Discount, Price Tot ... ) . In order to fullfill this requirements, we named each field considering its position ( eg. price.name = aprice, QTY.name = bQTY, discount.name = cdiscount ... ).

Unfortunately, s-controls do not care about this idea. Thus, we implemented a basic Sort function in the javascript :

function AQuickSort(l,r)

{

var i;

var j;

var bVerso;

var strTemp;

i = l;

j = r;

bVerso = true;

while(i

{

if(this.fieldArray[i].name > this.fieldArray[j].name)

{

strTemp = this.fieldArray[i];

this.fieldArray[i] = this.fieldArray[j];

this.fieldArray[j] = strTemp;

bVerso = !bVerso

}

if (bVerso)

i++;

else

j--;

}

if (l

this.QuickSort(l, i - 1);

if (j

this.QuickSort(j + 1, r);

}

 

In the entity object definition we define the sort function:

CEntity.prototype.QuickSort=AQuickSort;

 

In function AdescribeFinished(responseXML) we call the Sort function:

if (this.entityType == top.customObjectName)

this.QuickSort(1,this.fieldArray.length-1);

 

DevAngelDevAngel

Hi efantini,

You could maintain your layout in a custom object.  In this way you could put whatever layout metadata you require into that table for each field and use it in conjuction with the field object.