Delete confirmation on custom entities

Hi,

When deleting records from a custom entity, by default, you hit delete and it's gone. No confirmation, no nothing. I am aware that it is easy to add a javascript confirm function call to the button press but this doesn't give a consistent look and feel when you create new entities, and my current customer does not like it and would like to see the delete confirmation that is standard in the normal entities.

I know this method which is adding the javascript confirm but it isn't suitable: https://community.sagecrm.com/user_community/f/84/t/8110.aspx

Does anyone have any example code that presents the confirm delete on custom ASP scripts without having to go around the houses and do it manually? There is a mode that is set when deleting which is 3, which according to the javascript files in the CustomPages directory, is PreDelete.

  • 0

    Lee

    My guess is that you are referring to pages created using the Advanced Customization Wizard.

    I think there is something about the design of the Wizard built pages that skips the pre-delete confirmation.

    If you hand crank the ASP pages then the 'pre-delete' is added in.

    A simple summary page like below will present the 'pre-delete' check

    var myBlock = CRM.GetBlock("ContactSummaryBox");

    var intRecordId = Request.Querystring("companyid");

    var myRecord = CRM.FindRecord("Contacts","companyid="+intRecordId);

    myBlock.DisplayButton(Button_Delete) = true;

    CRM.AddContent(myBlock.Execute(myRecord));

    if (CRM.Mode == PostDelete)

    {

    Response.Redirect(CRM.URL("contactlist.asp"));

    }

    Response.Write(CRM.GetPage());

    But the Wizard code adds the delete button in a different way.