Easy API: Difference between revisions

From MobileX for SageCRM
No edit summary
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
UPDATE March 2020 - not to be used as this will be replaced -


New Easy API - Designed to make "some" screens easy to provide in the interface
New Easy API - Designed to make "some" screens easy to provide in the interface
Line 47: Line 165:
----
----


Example showing how to add in a menu item on the footer
Example showing how to add in a menu item on the footer that then displays a web page
 
1. Navigate to the 'Administration -> Advanced Customisation -> System Menus'
2. Open (or create) the menu 'MXFooterMenu'
3. Add menu item setting:
  caption: site
  custom file: fa fa-bar-chart
  sql: getwebsite('Site','https://crmtogether.com');
4. Save this
5. Open the custompages/sagecrmws folder
6. open web.config
7. Add into 'CustomPlugins'
 
    <add name="website" />


EG
   1. Navigate to the 'Administration -> Advanced Customisation -> System Menus'
   <CustomPlugins>
  2. Open (or create) the menu 'MXFooterMenu'
    <plugins>
  3. Add menu item setting:
...
    caption: site
  '''<add name="website" />'''   
    custom file: fa fa-bar-chart
    </plugins>
    sql: getwebsite('Site');
   </CustomPlugins>
  4. Save this
  5. Open the custompages/sagecrmws folder
  6. open web.config
   7. Add into 'CustomPlugins'


        <add name="website" />


8. Open the custompages/sagecrmws/js/plugins folder
    EG
9. Create a folder called 'website'
            <CustomPlugins>
10. Create a folder called 'client'
            <plugins>
11. Create a file called 'plugin.js'
            ...
12. add the following contents to the file created in 11
              '''<add name="website" />'''  
            </plugins>
            </CustomPlugins>


var onDocumentReady = function () {
  8. Open the custompages/sagecrmws/js/plugins folder
}
  9. Create a folder called 'website'
var onContextChanged = function () {
  10. Create a folder called 'client'
};
  11. Create a file called 'plugin.js'
var _websitecount=0;
  12. add the following contents to the file created in 11
function getwebsite(_caption,_url)
{
_websitecount++;
cApp.containerTop.clear();
cApp.container.clear();


var _id="websitetitle"+_websitecount;
    var onDocumentReady = function () {
Factory.destroyComponent(_id);
    }
var powerbititle = Factory.createLabel(_id);
    var onContextChanged = function () {
powerbititle.pr_caption = _caption;
    };
powerbititle.draw("containerTop");
    var _websitecount=0;
powerbititle.position(150, 10, true);
    function getwebsite(_caption)
    {
          cApp.containerTop.clear();
          cApp.container.clear();
          Factory.destroyComponent("powerbititle2");
          var powerbititle2 = Factory.createLabel("powerbititle2");
          powerbititle2.pr_caption = _caption;
          powerbititle2.draw("containerTop");
          powerbititle2.position(110, 10, true);


console.log('getwebsite:'+_id);
          console.log('getPowerBI2 demo');
var pr_targetImage = Factory.createImage("pr_targetImage");
          var pr_targetImage2 = Factory.createIFrame("pr_targetImage2");
pr_targetImage.pr_height = "100%";
          pr_targetImage2.pr_height = "100%";
pr_targetImage.pr_width = Factory.deviceObject.pr_width;
          pr_targetImage2.pr_width = "100%";
pr_targetImage.pr_src=_url;
          pr_targetImage2.pr_src="https://crmtogether.com";
pr_targetImage.pr_onclick = "";
          pr_targetImage2.pr_onclick = "";
pr_targetImage.draw("container");
          pr_targetImage2.draw("container");
pr_targetImage.position(0, 0);
          pr_targetImage2.position(0, 0);
}
    }

Latest revision as of 15:25, 26 March 2020

UPDATE March 2020 - not to be used as this will be replaced -



























































New Easy API - Designed to make "some" screens easy to provide in the interface



  • showScreens - screens with optional edit
 - Parameters
   1. Entity - name of the entity
   2. EntityIdField - id field of the entity
   3. Screens - Comma seperated list of CRM screens
   4. EntityToUse - name field to make ContextEntityfield value to
   5. ContextEntityfield - name of the entity context (tab) we are in
   6. allowEdit - boolean - set to true to show edit button

Example:

   showScreens(cApp.EntityName, cApp.EntityId,'CustomCompanyScreenMX1,CustomCompanyScreenMX2', 'company', 'comp_companyid','comp_companyid',true);

  • cugetList – Table style lists
 - Parameters
   1. Entity - name of the entity
   2. EntityIdField - id field of the entity
   3. EntityOrderBy - order date by this column
   4. displayfields - optional - comma delimited list of fields, alternatively use CRMListToUse
   5. linktoEntity - boolean - allows the item be clicked on to navigate the user to that entity record summary page
   6. customlink - optional - set linktoEntity to false and instead set your own function call
   7. CRMListToUse - optional - name of a list in CRM alternatively use displayfields 

Example:

 cugetList('ctproject','ctpr_companyid','ctpr_createddate',,true,,'mxcustomlist');



  • getListScreen – repeating screens style list
 - Parameters 
   1. entityname
 - Notes
   1. Expects view "vENTITYnamesummary" to exist and must contain fields "pers_firstname,pers_lastname,pers_personid,comp_name,comp_companyid".
   2. Expects screen "ENTITYOfficeIntSmall"

Example:

 getListScreen('ctproject');

Example showing how to add in a menu item on the footer that then displays a web page

 1. Navigate to the 'Administration -> Advanced Customisation -> System Menus'
 2. Open (or create) the menu 'MXFooterMenu'
 3. Add menu item setting:
   caption: site
   custom file: fa fa-bar-chart
   sql: getwebsite('Site');
 4. Save this
 5. Open the custompages/sagecrmws folder
 6. open web.config
 7. Add into 'CustomPlugins'
        <add name="website" />
    EG
           <CustomPlugins>
           <plugins>
           ...
              <add name="website" />    
           </plugins>
           </CustomPlugins>
 8. Open the custompages/sagecrmws/js/plugins folder
 9. Create a folder called 'website'
 10. Create a folder called 'client'
 11. Create a file called 'plugin.js'
 12. add the following contents to the file created in 11
    var onDocumentReady = function () {
    }
    var onContextChanged = function () {
    };
    var _websitecount=0;
    function getwebsite(_caption)
    {
         cApp.containerTop.clear();
         cApp.container.clear();
         Factory.destroyComponent("powerbititle2");
         var powerbititle2 = Factory.createLabel("powerbititle2");
         powerbititle2.pr_caption = _caption;
         powerbititle2.draw("containerTop");
         powerbititle2.position(110, 10, true);
         console.log('getPowerBI2 demo');
         var pr_targetImage2 = Factory.createIFrame("pr_targetImage2");
         pr_targetImage2.pr_height = "100%";
         pr_targetImage2.pr_width = "100%";
         pr_targetImage2.pr_src="https://crmtogether.com";
         pr_targetImage2.pr_onclick = "";
         pr_targetImage2.draw("container");
         pr_targetImage2.position(0, 0);
    }