$format_object2->query_id = $query_id2; $format_object2->list_order_y = 1; $format_object2->exportable = "on"; $format_object2->header = "on"; $format_object2->table_width = 100; $format_object2->font_size = "Default"; $format_object2->output_default = "table"; $format_object2->prespace_y = "on"; $format_object2->use_prev_header = "on"; $format_object2->table_width_type = "%"; $format_object2->custom_layout = "Enabled"; $format_object2->team_id = 1; $format_object->save(); $format_object->enable_custom_layout(); $format_object2->save(); $format_object2->enable_custom_layout(); ///////////////Get the attribute metadata ready/////// $start_body_array = array('display_type' => 'Normal', 'attribute_type' => 'Body', 'font_size' => 'Default', 'cell_size' => '250', 'size_type' => 'px', 'wrap' => 'off', 'style' => 'normal', 'format_type' => 'Text'); $scalar_head_array = array('display_type' => 'Scalar', 'attribute_type' => 'Head', 'font_size' => 'Default', 'wrap' => 'off', 'style' => 'normal', 'format_type' => 'Month'); $scalar_body_array = array('display_type' => 'Normal', 'attribute_type' => 'Body', 'font_size' => 'Default', 'size_type' => 'px', 'wrap' => 'off', 'style' => 'normal', 'format_type' => 'Accounting'); //Populate thet dataset_attribute $layout_id = $format_object->get_layout_id_from_parent_value("Opportunity Type"); $body_object = new DataSet_Attribute(); $body_object->parent_id = $layout_id; foreach ($start_body_array as $key => $value) { $body_object->{$key} = $value; } $body_object->save(); ////Fill in attributes for all the scalar columns for ($i = 0; $i <= 5; $i++) { $layout_id = $format_object->get_layout_id_from_parent_value("{sc}0{sc}" . $i . "");