MobileX can be extended or customised, get in touch to find out more

1. In the   custompages/sagecrmws/web.config

we add in the plugin

       <add name=”Sage300″/>

In the “client/plugin.js” we download the “chartjs” files

see function “onDocumentReady

We also add in buttons
EG

//sales today
        var _btnname = "btnMy300sales";
        Factory.destroyComponent(_btnname);
        cApp[_btnname] = Factory.createBottomButton(_btnname);
        cApp[_btnname].pr_caption = _getTrans("ERPYear");
        cApp[_btnname].pr_icon = "fa fa-cube";
        cApp[_btnname].pr_onclick = "cApp.view_arcusyear();";
        cApp[_btnname].pr_index = 55;
        cApp.addBottomAreaButton(cApp[_btnname]);

2. In “onContextChanged” the system checks the context 

If the context is a company we add in those buttons
EG

if (cApp.EntityName.toLowerCase().indexOf("company") == 0) {
 Factory.destroyComponent("btnview_arcusCompany");
 cApp.btnview_arcusCompany = Factory.createTopButton("btnview_arcusCompany");
 cApp.btnview_arcusCompany.pr_caption = "300 ERP";
 cApp.btnview_arcusCompany.pr_icon = "cube fa-lg";
 cApp.btnview_arcusCompany.pr_onclick = "cApp.view_arcus(cApp.EntityName,cApp.EntityId);";
 cApp.btnview_arcusCompany.pr_insert = false;
 cApp.btnview_arcusCompany.pr_index = _idx;
 cApp.addEntityReworkBtn(cApp.btnview_arcusCompany, true);


3. 
ERPyear

When we click the “ERPYear” button it calls the method “view_arcusyear” in the client/plugin.js

cTSApp.prototype.view_arcusyear = function () {

    collapseTop(true);
   
    cApp.containerTop.clear();
    var params = {
        fileName: "js\\plugins\\sage300\\server\\view_OESTATS.js"
    };

    var view_arcustodayCompleted = function (data) {
        cApp.drawArcusYear(data);
    };
    
	cApp.gatewayPostParams("runServerScript", params, view_arcustodayCompleted);
};

This makes a request to 
 js\\plugins\\sage300\\server\\view_OESTATS.js

cApp.gatewayPostParams("runServerScript", params, view_arcustodayCompleted);

“view_arcustodayCompleted” is called when the data returns

    var view_arcustodayCompleted = function (data) {
        cApp.drawArcusYear(data);
    };

which in turn called

     cApp.drawArcusYear(data);

Sample JSON returned
EG

[{
		"yr": "2019",
		"period": "1",
		"currency": "USD",
		"audtdate": null,
		"audtdate_raw": "20100818",
		"audttime": "10163790",
		"audtuser": "ADMIN",
		"audtorg": "SAMINC",
		"numord": "3",
....

The method

cTSApp.prototype.drawArcusYear = function (data) {

then gets the JSON in the (data) parameter and this is used to build the screen and chart

4. ERP data for the given company


The line

cApp.btnview_arcusCompany.pr_onclick = "cApp.view_arcus(cApp.EntityName,cApp.EntityId);";

calls 

cTSApp.prototype.view_arcus = function (EntityName, EntityId) {

    var params = {
        fileName: "js\\plugins\\sage300\\server\\view_arcus.js",
        EntityId: EntityId,
        EntityName: EntityName
    };

    var view_arcusCompleted = function (data) {
        cApp.drawArcus(data);
    };
    
	cApp.gatewayPostParams("runServerScript", params, view_arcusCompleted);
};

which makes a request to

          js\\plugins\\sage300\\server\\view_arcus.js

which in turn calls

cTSApp.prototype.drawArcus = function (data) {

when the data comes back and this creates the screen. 

===========================================
Also worth noting…

Footer Menu – now you can update the menu via CRM

As per the help
http://mobilex.crmtogether.com/index.php?title=FooterCustom


You may also like

Join our newsletter

Newsletter
Sending
The Business Predictability Blueprint

The Business Predictability Blueprint

Our free e-book will help you learn gain more structure within your business, better predict your pipeline, achieve consistency and start feeling more in control.

Get it now

Register for updates with us! Subscribe to our Newsletter