Adding custom button programatically

Hello,

I'm trying to add a button to contact page details (Contacts_FormPage), I'm currently using Creatio on cloud version 8.1.3.6734 with Freedom UI
I followed these steps:

  1. Navigated to Settings > Advanced Settings
  2. Created a new package, and added ProductCore dependency
  3. Created a Replacing view model with the code name ContactPageV2
  4. Added the code:
  5. define("ContactPageV2", [], function() {
       console.log("ContactPageV2 module loaded");
       return {
           methods: {
               onGenerateLinkClick: function() {
                   console.log("Generate Link button clicked");
               }
           },
           diff: [
               {
                   "operation": "insert",
                   "name": "GenerateLinkButton",
                   "parentName": "ActionButtonsContainer",
                   "propertyName": "items",
                   "values": {
                       "itemType": Terrasoft.ViewItemType.BUTTON,
                       "caption": "Generate Link",
                       "click": {"bindTo": "onGenerateLinkClick"}
                   }
               }
           ]
       };
    });
  6. After saving, I compiled the package
  7. Emptied the cache of the browser, but nothing is showing not even the console log "ContactPageV2 module loaded"

 

Please help as I'm not sure what I'm doing wrong or what steps am I missing (I'm a newbie to this platform).
Thank you in advance.

Like 0

Like

2 comments
Best reply

Creatio has two types of pages, Freedom UI pages and classic pages. They are completely separate/different pages. The ContactPageV2 is the classic page, not the Freedom UI page which is Contacts_FormPage

To add the button that executes your code on the Freedom UI page:

  1. Go to the contact page, click the small gear on the top right corner of the page to edit
  2. Save it to make a copy in your package (see the Side Note at end of article here to force the save to go into your package, if needed)
  3. Add a button to the page where you want it
  4. Open the code for the page (clicking one of the icons at the top right of the page designer)
  5. Add the request handler for the button (the code that will execute when clicked) following steps here: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Creatio has two types of pages, Freedom UI pages and classic pages. They are completely separate/different pages. The ContactPageV2 is the classic page, not the Freedom UI page which is Contacts_FormPage

To add the button that executes your code on the Freedom UI page:

  1. Go to the contact page, click the small gear on the top right corner of the page to edit
  2. Save it to make a copy in your package (see the Side Note at end of article here to force the save to go into your package, if needed)
  3. Add a button to the page where you want it
  4. Open the code for the page (clicking one of the icons at the top right of the page designer)
  5. Add the request handler for the button (the code that will execute when clicked) following steps here: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Thank you! 
I was able to add it following your explanation. 
And yes I need to add it to my custom package since I'm trying to create a connector that can be used by anyone later on.
That was very insightful, thanks again!

Show all comments