Question

"+" button on Activity Detail and Type list

Hello Team,

 

Im looking possibility to hide displayed possible types of activity on custom detal (based on Avtivity entity schema).

By default on my new detail after clicking "+" user have to chose one of type of activity , but i would like to set this type by default on this detail without possibility to chose it from this list.

As a example is Email detail under Account/History - after clicking on "+" new record with type Email is created.

 

Regards,

Marcin Kott

Like 0

Like

1 comments

Dear Marcin, 

To do this you need to create a replacing schema for a detail (if it is in the locked package) and override getEditPages method. 

Here is an example where new page is defaulted to "New task":

define("UsrSchema1Detail", [], function() {

    return {

        entitySchemaName: "Activity",

        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,

        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,

        methods: {

            getEditPages: function() {

                if (!this.get("EditPages")) {

                    this.initEditPages();

                }

                var menuItems = this.Ext.create("Terrasoft.BaseViewModelCollection");

                var activityTypes = this.get("EditPages");

                var entityStructure = this.getEntityStructure(this.entitySchemaName);

                if (entityStructure) {

                    var editPage = entityStructure.pages[0];

                    activityTypes.each(function(activityType) {

                            var id = activityType.values.Id;

                            var caption = activityType.values.Caption;

                            if (caption === "New task")

                            {

                                var schemaName = editPage.cardSchema;

                                var item = this.getButtonMenuItem({

                                    Caption: caption,

                                    Click: {bindTo: "addRecord"},

                                    Tag: id,

                                    SchemaName: schemaName

                                });

                                menuItems.add(id, item);

                            }

                        }, this);

                }

                return menuItems; 

            }

        }

    };

});

Best regards,

Dennis  

Show all comments