knowledge base
SDK
support
Q&A

Case

I need to create a widget

Solution

You can use widgets to display data from in-built modules. It enables displaying data in non-standard views.

Example of implementing a widget:

define('SxClientUnitTable', ['ext-base', 'terrasoft', 'sandbox', "BaseFiltersGenerateModule", 'SxClientUnitTableResources', "ChartModuleHelper", "css!SxClientUnitTableCss", "ServiceHelper"],
	function(Ext, Terrasoft, sandbox, BaseFiltersGenerateModule, resources, ChartModuleHelper, css, ServiceHelper, ConfigurationConstants) {
 
		function getViewModel() {
					return Ext.create('Terrasoft.BaseViewModel', {
				//todo SysModuleAnalyticsChart deleted
						entitySchema: 'Order',
						methods: {
							getChart: function(key) {
							debugger
								sandbox.publish('GenerateChart', key);
								var filters = this.getReportFilters();
							},
							load: function() {
 
							}
						}
					});
				};
		var result = "";
		function generateMainView(renderTo) {
 
			var resultConfig = Ext.create('Terrasoft.Container', {
				id: 'tableOtchetMetkiParamContainer',
				selectors: {
					wrapEl: '#tableOtchetMetkiParamContainer'
				},
				renderTo: renderTo
			});
			return resultConfig;
		}
		function getInfoMetki(parameters) {
 
			var serviceData = {
				site: parameters[0].toString(),
				ownerId: parameters[1].toString(),
				startDate: parameters[2].toString(),
				dueDate: parameters[3].toString(),
				countryId: parameters[4].toString()
			};
 
			ServiceHelper.callService("UsrOtchetMetkiGetCollectionConfigurationService", "GetCollectionOtchetMetki",
				function (response) {
				debugger
					if (response.status == 404) {
						this.showInformationDialog("\t Error: \n" + response.message);
					}
					else if(response.GetCollectionOtchetMetkiResult.length > 0){
						result = response.GetCollectionOtchetMetkiResult;
						var arrR = result.split(":");
						var htmlAdded = "MarkNumber of ordersBeing specified% Specified.Confirmed% Conf.Completed% Compl.Canceled% Canc.";
						for(var i = 0; i < arrR.length - 1; i++){
							//get items
							var strArr = arrR[i].split(" ");
							var metkaOne = strArr[0].replace("{","");
							var metka = metkaOne.replace("}","");
 
							htmlAdded += "" + metka + "" + strArr[1].toString() + ""  + strArr[2].toString() + "" + strArr[3].toString() + "" + strArr[4].toString() + "" + strArr[5].toString() + "" + strArr[6].toString() + "" + strArr[7].toString() + ""  + strArr[8].toString() + "" + strArr[9].toString() + "";
						}
						//end table
						htmlAdded += "";
						var el = Ext.get('tableOtchetMetkiParamContainer').setHTML(htmlAdded);
						var elemV = Ext.get('Module1');
						elemV.toggleCls('my-table');
					}
					else
						result = null;
				}, serviceData, this);
		}
		function getReplaceString(str, separator){
		debugger
		var arSt = str.split(separator);
			var res = arSt[2] + separator + arSt[1] + separator + arSt[0];
			while(res.indexOf(separator) > 0){
				res = res.replace(separator,"-");
			}
			return res;
		}
 
		var render = function(renderTo) {
 
 
			debugger
			var viewConfig = generateMainView(renderTo);
			var viewModel = getViewModel();
			var getStartD = Ext.get("fixedFilterDateView-wrap").dom.innerText;
			var getEndD = Ext.get("fixedFilterDateDueView-wrap").dom.innerText;
 
			var startD = getStartD.indexOf("Начало") > 0 ? "2016-05-01" : getReplaceString(getStartD, ".");
			var endD = getEndD.indexOf("Завершение") > 0 ? "2016-07-04" : getReplaceString(getEndD, ".");
			var ar = [];
			ar.push("all");
			ar.push("all");
			ar.push(startD);
			ar.push(endD);
			ar.push("a570b005-e8bb-df11-b00f-001d60e938c6");
			getInfoMetki(ar);
 
 
			viewConfig.bind(viewModel);
			//viewConfig.render(renderTo);
		};
		return {
			schema: 'Order',
			methods: {
				onLookupChange: function(newValue, columnName) {
 
                                this.callParent(arguments);
                                if (columnName === "UsrCityFilter") {
                                        this.set("UsrCityFilter", newValue);
                                        this.onUsrCityFilterChanged();
                                }
                        },
 
                        onUsrCityFilterChanged: function() {
                                this.reloadGridData();
                        },
				getOrdersForFilter: function(){
					var items = [];
					var selOrders = Ext.create("Terrasoft.EntitySchemaQuery", {
						rootSchemaName: "Order"
					});
					selOrders.addColumn("SxMark.Name");
					selOrders.addColumn("SxCountry.Name");
					var filterByUser = Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SxCountry.Name", "Россия");
					selOrders.filters.addItem(filterByUser);
					selOrders.getEntityCollection(function (response) {
					debugger
						if (response.collection.collection.length > 0)
							items = result.collection.getItems();
						else
							items = null;
					}, this);
					return items;
				}
 
			},
			userCode: function() {
 
			},
			init: function() {
 
			},
			filterChanged: function( filter, eOpts ){
				debugger
				var c = [];
			},
			render: render
		};
	}
)
;

 

 

Like 0

Like

Share

0 comments
Show all comments

Case

Access to section disappeared for all users, except for the Supervisor. Standard script for granting access permissions works but does not add records.

Solution

The [CreatedById] field in the user's database table is not populated. To solve the issue, populate the field and specify "Supervisor" as a creator:

Update Account --change the object
SET CreatedById = (SELECT id FROM Contact c WHERE c.Name = 'Supervisor')
where CreatedById is null;

 

Like 0

Like

Share

0 comments
Show all comments

Question

We cannot add contacts. The page freezes when doing so.

Answer

The details "Detail: Contact address" and "Detail: Contact communication options" have been deleted from the contact page. That is the reason why you cannot add new contacts.

Restore the details and you will receive no errors.

To do this, add the below code to the ContactPageV2 schema:

details: {
    "AccountAddress": {
        "schemaName": "AccountAddressDetailV2",
        "entitySchemaName": "AccountAddress",
        "filter": {
            "detailColumn": "Account",
            "masterColumn": "Account"
        },
        "useRelationship": true,
        "filterMethod": "accountAddressFilter"
    },
    "AccountCommunication": {
        "schemaName": "AccountCommunicationDetail",
        "entitySchemaName": "AccountCommunication",
        "filter": {
            "detailColumn": "Account",
            "masterColumn": "Account"
        },
        "useRelationship": true,
        "filterMethod": "accountAddressFilter"
    }
},
/**......*/
methods: {
    accountAddressFilter: function() {
        var account =  this.get("Account");
        var accountId = this.Terrasoft.GUID_EMPTY;
        if (account && account.value) {
            accountId = account.value;
        }
 
        var filterGroup = new this.Terrasoft.createFilterGroup();
        filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
        filterGroup.add("AccountFilter", this.Terrasoft.createColumnFilterWithParameter(
        this.Terrasoft.ComparisonType.EQUAL, "Account", accountId));
        return filterGroup;
    }
},
/**......*/

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

When creating details via the "Detail wizard" and switching to the "Page" tab, the browser fails and provides the below error:

message: The 7f889822-86af-4b53-bd7d-b8b153f0a5c4 key element Does not exist

Solution

Find an element with the necessary CardSchemaUId in the SysModuleEdit table of the database and delete it.

Necessary conditions and restrictions

Occurred in version 7.7

Like 1

Like

Share

0 comments
Show all comments

Customization of the unsupscribe function is represented in the following php codes:

Functions:

<?php
function BPMAuth(){
    $url = 'https://bpmonline.com/ServiceModel/AuthService.svc/Login';//someBPMURL
    $requestData["UserName"] = "";
    $requestData["UserPassword"] = "";    
    $jcres = json_encode($requestData);    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_COOKIEJAR,'cookie.txt');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jcres);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jcres))
    );
    $result = curl_exec($ch);
    curl_close($ch);
}
function BPMQuery($json,$operation) {
    //Operations: 1-Add Data; 2 - Update Data; 3 - batch Data; 4 - SelectQuery
    switch ($operation) {
    case 1:
        $queryOperation='InsertQuery';
        break;
    case 2:
        $queryOperation='UpdateQuery';
        break;
    case 3:
        $queryOperation='BatchQuery';
        break;
    case 4:
        $queryOperation='SelectQuery';
        break;
}
    $url = 'https://bpmonline.com/0/DataService/json/SyncReply/'.$queryOperation;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR,'cookie.txt');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($json))
    );
    return curl_exec($ch);
    curl_close($ch);
} // Sends Update Query to BPM
function BuildIdFilter(array $array){
    $i=0;
    $filter='';
    foreach ($array as $item)
        {
            if ($i!=0) $filter.=',';
            $filter.='
            "CustomFilters'.$i.'":{
            "filterType":1,
            "comparisonType":3,
            "isEnabled":true,
            "trimDateTimeParameterToDate":false,
            "leftExpression":{
    		   "expressionType":0,
    		   "columnPath":"Id"
    			},
            "rightExpression":{
               "expressionType":2,
               "parameter":{
                  "dataValueType":0,
                  "value":"'.$item.'"
               }
            }
         }';
        $i++;  
        
        }
    return $filter;
} // Build Json Array Filter
function BuildSubscribeJson($filter,$bool){
    //$filter is filter to be applied in Json
    //$bool - to set true (Subscribed) or false(unsubscribed) for subscription
    if($bool==true) {$subsvalue='1a5cd9b8-b999-4b65-b8a8-bd3168792128';}
    else {$subsvalue='c8947f80-a374-412a-bbc8-ea9068a8b78e';}
    return '{
                           "rootSchemaName":"BulkEmailSubscription",
                           "operationType":2,
                           "filters":{
                              "items":{
                                 '.$filter.'
                              },
                              "logicalOperation":1,
                              "isEnabled":true,
                              "filterType":6
                           },
                           "columnValues":{
                              "items":{
                                 "BulkEmailSubsStatus":{
                                    "expressionType":2,
                                    "parameter":{
                                       "dataValueType":10,
                                       "value":"'.$subsvalue.'"
                                    }
                                 }
                              }
                           },
                           "isForceUpdate":false
                        }';
    
}
function JsonAddNewSubscriber($contactId,array $bulkemailtype,$bool_subsctiption){
    //$contactId Id of contuct to be subscribed
    //$bulkemailtype is id of bulk email to be subscribed
    //$bool_subsctiption - to set true (Subscribed) or false(unsubscribed) for subscription
    if($bool_subsctiption==true) {$subsvalue='1a5cd9b8-b999-4b65-b8a8-bd3168792128';}
    else {$subsvalue='c8947f80-a374-412a-bbc8-ea9068a8b78e';}
    $i=0;
    $insertItems='';
  
  
    foreach ($bulkemailtype as $value) {
        if ($i!=0) $insertItems.=',';
        $insertItems.='{
            "__type": "Terrasoft.Nui.ServiceModel.DataContract.InsertQuery",
            
           "rootSchemaName":"BulkEmailSubscription",
           "operationType":1,
           "columnValues":{
              "items":{
                 "Contact":{
                    "expressionType":2,
                    "parameter":{
                       "dataValueType":10,
                       "value":"'.$contactId.'"
                    }
                 },
                 "BulkEmailType":{
                    "expressionType":2,
                    "parameter":{
                       "dataValueType":10,
                       "value":"'.$value.'"
                    }
                 },
                 "BulkEmailSubsStatus":{
                    "expressionType":2,
                    "parameter":{
                       "dataValueType":10,
                       "value":"'.$subsvalue.'"
                    }
                 }
              }
           }
        
        }';
        $i++;
    }
    return '{"items": ['.$insertItems.']}';
}
function ContactUnsubscribe($contactId,$bool){
    return '{
  "rootSchemaName": "Contact",
  "operationType": 2,
  "filters": {
    "items": {
      "primaryColumnFilter": {
        "filterType": 1,
        "comparisonType": 3,
        "isEnabled": true,
        "trimDateTimeParameterToDate": false,
        "leftExpression": {
          "expressionType": 1,
          "functionType": 1,
          "macrosType": 34
        },
        "rightExpression": {
          "expressionType": 2,
          "parameter": {
            "dataValueType": 0,
            "value": "'.$contactId.'"
          }
        }
      }
    },
    "logicalOperation": 0,
    "isEnabled": true,
    "filterType": 6
  },
  "columnValues": {
    "items": {
      "DoNotUseEmail": {
        "expressionType": 2,
        "parameter": {
          "dataValueType": 12,
          "value": '.$bool.'
        }
      }
    }
  },
  "isForceUpdate": false
}'; // Json Request
}
function JsonSelectSubscriptions($contactId){
    $json= '{
       "rootSchemaName":"BulkEmailSubscription",
       "operationType":0,
       "filters":{
          "items":{
             "customFilterContact_BulkEmailSubscription":{
                "filterType":1,
                "comparisonType":3,
                "isEnabled":true,
                "trimDateTimeParameterToDate":false,
                "leftExpression":{
                   "expressionType":0,
                   "columnPath":"Contact"
                },
                "rightExpression":{
                   "expressionType":2,
                   "parameter":{
                      "dataValueType":10,
                      "value":"'.$contactId.'"
                   }
                }
             }
          },
          "logicalOperation":0,
          "isEnabled":true,
          "filterType":6
       },
       "columns":{
          "items":{
             "Id":{
                "caption":"",
                "orderDirection":0,
                "orderPosition":-1,
                "isVisible":true,
                "expression":{
                   "expressionType":0,
                   "columnPath":"Id"
                }
             },
             "BulkEmailType":{
                "caption":"Bulk email type",
                "orderDirection":0,
                "orderPosition":-1,
                "isVisible":true,
                "expression":{
                   "expressionType":0,
                   "columnPath":"BulkEmailType"
                }
             },
             "BulkEmailSubsStatus":{
                "caption":"Subscription status",
                "orderDirection":0,
                "orderPosition":-1,
                "isVisible":true,
                "expression":{
                   "expressionType":0,
                   "columnPath":"BulkEmailSubsStatus"
                }
             }
          }
       },
       "isDistinct":false,
       "rowCount":30,
       "rowsOffset":0,
       "isPageable":false,
       "allColumns":false,
       "useLocalization":true,
       "useRecordDeactivation":false,
       "serverESQCacheParameters":{
          "cacheLevel":0,
          "cacheGroup":"",
          "cacheItemName":""
       },
       "queryOptimize":false,
       "useMetrics":false,
       "querySource":0,
       "ignoreDisplayValues":false,
       "conditionalValues":null,
       "isHierarchical":false
    }'; // Json Request
    return $json;
}
function JsonSelectdefaultchannels(){
    $json= '{"rootSchemaName":"BulkEmailType","operationType":0,"filters":{"items":{"64ae0f22-cb41-4599-97c1-3571c0fe56f3":{"items":{},"logicalOperation":0,"isEnabled":true,"filterType":6}},"logicalOperation":0,"isEnabled":true,"filterType":6},"columns":{"items":{"Id":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"Id"}},"Name":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"Name"}},"Description":{"caption":"Description","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"Description"}},"IsSignable":{"caption":"Can be subscriber","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"IsSignable"}},"EntryPointsCount":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":3,"aggregationType":1,"columnPath":"[EntryPoint:EntityId].Id","subFilters":{"items":{"c0c2fa11-5faa-415d-98d6-83df4bb90770":{"filterType":1,"comparisonType":3,"isEnabled":true,"trimDateTimeParameterToDate":false,"leftExpression":{"expressionType":0,"columnPath":"IsActive"},"rightExpression":{"expressionType":2,"parameter":{"dataValueType":1,"value":true}}}},"logicalOperation":0,"isEnabled":true,"filterType":6}}},"CreatedOn":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"CreatedOn"}},"CreatedBy":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"CreatedBy"}},"ModifiedOn":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"ModifiedOn"}},"ModifiedBy":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"ModifiedBy"}},"ProcessListeners":{"caption":"","orderDirection":0,"orderPosition":-1,"isVisible":true,"expression":{"expressionType":0,"columnPath":"ProcessListeners"}}}},"isDistinct":false,"rowCount":30,"rowsOffset":0,"isPageable":true,"allColumns":false,"useLocalization":true,"useRecordDeactivation":false,"serverESQCacheParameters":{"cacheLevel":0,"cacheGroup":"","cacheItemName":""},"queryOptimize":false,"useMetrics":false,"querySource":0,"ignoreDisplayValues":false,"conditionalValues":null,"isHierarchical":false}';
    return $json;
}
function JsonSelectEmailStatus($contactId){
    $json= '{
       "rootSchemaName":"Contact",
       "operationType":0,
       "filters":{
          "items":{
    		 "CustomFilters":{
    			"filterType":1,
    			"comparisonType":3,
    			"isEnabled":true,
    			"trimDateTimeParameterToDate":false,
    			"leftExpression":{
    			   "expressionType":0,
    			   "columnPath":"Id"
    			},
    			"rightExpression":{
    			   "expressionType":2,
    			   "parameter":{
    				  "dataValueType":0,
    				  "value":"'.$contactId.'"
    			   }
    			}
    		 }
    	  },
          "logicalOperation":0,
          "isEnabled":true,
          "filterType":6
       },
       "columns":{
          "items":{
             "DoNotUseEmail":{
                "caption":"Do not use email",
                "orderDirection":0,
                "orderPosition":-1,
                "isVisible":true,
                "expression":{
                   "expressionType":0,
                   "columnPath":"DoNotUseEmail"
                }
             }
          }
       },
       "isDistinct":false,
       "rowCount":30,
       "rowsOffset":0,
       "isPageable":false,
       "allColumns":false,
       "useLocalization":false,
       "useRecordDeactivation":false,
       "serverESQCacheParameters":{
          "cacheLevel":0,
          "cacheGroup":"",
          "cacheItemName":""
       },
       "queryOptimize":false,
       "useMetrics":false,
       "querySource":0,
       "ignoreDisplayValues":false,
       "conditionalValues":null,
       "isHierarchical":false
    }';
    return $json;
}

Unsubscription channels:

<?php
$contactId=$_GET['contactId'];
//contactId for test = 2480fb60-43d1-4a58-9011-0f859b431670 for test
require_once( MODX_CORE_PATH . 'model/bpmintegration/bpm_bulk_subscriptionsFunctions.php');
BPMAuth();
$jsonUseEmailQuery = JsonSelectEmailStatus($contactId);
$result = BPMQuery($jsonUseEmailQuery,4);
$r0 = json_decode($result,true);
$requestData1 = JsonSelectSubscriptions($contactId);
$result = BPMQuery($requestData1,4);
$r=json_decode($result, true);
$requestData1=JsonSelectdefaultchannels();
$result = BPMQuery($requestData1,4);
$r2=json_decode($result, true);
{//building html form 
    echo '';
    if ($r0["rows"]["0"]["DoNotUseEmail"]==1) {
    
        echo '

You are currently Unsubscribed from all emails, please uncheck Subscribe me back, if you wish to keep current setting on.

'; echo ' Subscribe me back
'; } echo '

Subsctiption types

'; //print_r($r); foreach ($r["rows"] as $value) { echo ''; if ($value["BulkEmailSubsStatus"]["displayValue"]=='Subscribed'){ echo ' '.$value["BulkEmailType"]["displayValue"].'
'; }else{ echo ' '.$value["BulkEmailType"]["displayValue"].'
'; } } // Display channels already set for client foreach ($r2["rows"] as $value){ foreach ($r["rows"] as $value1) { if ($value["Id"]==$value1["BulkEmailType"]["value"]){ $exist=1; } } if (!$exist) { echo ''; echo ' '.$value["Name"].'
'; } //if there is no such channel in basic subscription - echo some inputs else unset ($exist); } // Display Default Channels if ($r0["rows"]["0"]["DoNotUseEmail"]!=1) { echo '

OR Unsubscribe from all?

Unsibscribe from all emails
'; } echo ' '; }//building form

Unsubscription channel request:

<?php
//$_POST['SubscriptionData']- array with all subscription preferances for current ContactID
//$_POST['CurrentSubscription'] - array with data to be subscribed
//$_POST['Defaultsubscriptions'] -array with default channels to add to subscriptions
//$_POST['defaultsubscriptionschannels'] - array with default channels
$contactId=$_GET['contactId'];
require_once( MODX_CORE_PATH . 'model/bpmintegration/bpm_bulk_subscriptionsFunctions.php');
BPMAuth();
if ($_POST['Subscribemeback']==1){
    $requestData1=ContactUnsubscribe($contactId,false);
    BPMQuery($requestData1,2);
    echo 'You were subscribed back';
}
if ($_POST['Unsibscribe_all']==1){
    $requestData1=ContactUnsubscribe($contactId,true);
    BPMQuery($requestData1,2);
    echo 'Unsubscribed from all';
    } // If Unsubscribed - post "Do no use email in BPM"
    else {
        echo '

Subscription Channels were Updated

'; if (isset($_POST['CurrentSubscription'])){ $filter=BuildIdFilter($_POST['CurrentSubscription']); $JsonSubscribe=BuildSubscribeJson($filter,true);// Json for Subscription Data BPMQuery($JsonSubscribe,2); $ToSetUnsubscribed=array_diff($_POST['SubscriptionData'],$_POST['CurrentSubscription']);//this is array to set unsubscribe status if (!empty($ToSetUnsubscribed)){ $filter=BuildIdFilter($ToSetUnsubscribed); $JsonSubscribe=BuildSubscribeJson($filter,false); BPMQuery($JsonSubscribe,2); } } elseif(isset($_POST['SubscriptionData'])){ $filter=BuildIdFilter($_POST['SubscriptionData']); $JsonSubscribe=BuildSubscribeJson($filter,false); BPMQuery($JsonSubscribe,2);//UpdateBPM } if (isset($_POST['defaultsubscriptionschannels'])){ if (isset($_POST['defaultsubscriptions'])){ $JsonSubscribe=JsonAddNewSubscriber($contactId,$_POST['defaultsubscriptions'],true); BPMQuery($JsonSubscribe,3);//UpdateBPM $ToAddUnsubscribed=array_diff($_POST['defaultsubscriptionschannels'],$_POST['defaultsubscriptions']); if (!empty($ToAddUnsubscribed)){ $JsonSubscribe=JsonAddNewSubscriber($contactId,$ToAddUnsubscribed,false); BPMQuery($JsonSubscribe,3);//UpdateBPM } }else{ $JsonSubscribe=JsonAddNewSubscriber($contactId,$_POST['defaultsubscriptionschannels'],false); BPMQuery($JsonSubscribe,3);//UpdateBPM } } }// Defines array to add new subscription channels ?>

For additional assistance, see the video instruction at https://drive.google.com/file/d/1vJipUf0m04Mk_r3QLAakcwdXYtEon--J/view.

Like 2

Like

Share

0 comments
Show all comments
SDK
support
knowledge base
Q&A

Case

When I click "Add" on the [Products] detail in an order, I get an error that the total payment sum per order does not correspond the sum of products.

The same happens when I do it for the installment plan.

Answer

When you add a product, bpm'online saves the page. Though the "OrderStatus" base lookup has been changed in this case. During saving, the system checks the correspondence of the sums and the OrderPageV2 page code of the Passport package fails:

validateOrderStatus: function(callback, scope) {
    var result = {
        success: true
    };
    var status = this.get("Status");
    var primaryAmount = this.get("PrimaryAmount");
    var OrderStatus = OrderConfigurationConstants.Order.OrderStatus;
    if (status && (status.value === OrderStatus.InPlanned || status.value === OrderStatus.Canceled)) {
        callback.call(scope || this, result);
        return;
    }
    var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
        rootSchemaName: "SupplyPaymentElement"
    });
    esq.addAggregationSchemaColumn("PrimaryAmountPlan", Terrasoft.AggregationType.SUM,
"PrimaryAmountPlanSum");
    var filters = Terrasoft.createFilterGroup();
    filters.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
"Order", this.get("Id")));
    filters.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
"Type", OrderConfigurationConstants.SupplyPaymentElement.Type.Payment));
    esq.filters = filters;
    esq.getEntityCollection(function(response) {
        if (response.success) {
            var collection = response.collection;
            if (collection.getCount() > 0 && primaryAmount !==
collection.getByIndex(0).get("PrimaryAmountPlanSum")) {
                result.message = this.get("Resources.Strings.ValidateOrderStatus");
                result.success = false;
            }
        } else {
            return;
        }
        callback.call(this, result);
    }, scope);

Instruction

var status = this.get("Status"); - returns undefined

collection.getByIndex(0).get("PrimaryAmountPlanSum"))  - returns 0

This causes the verification failure and provides notifications for the "Planned" status.

To solve the issue, replace the OrderConfigurationConstant module and specify the correct Ids in it. This way, the below code:

if (status && (status.value === OrderStatus.InPlanned || status.value === OrderStatus.Canceled)) {
    callback.call(scope || this, result);
    return;
}

will be performed successfully.

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

Implementation of the case:

  1. In the schedule, open an activity with the following fields populated on the "Connected to" detail: [Lead], [Invoice] and [Project/task];
  2. click the link to open the page of the connected object;
  3. open the "History" tab -> "Activities";
  4. add a new activity to the detail.

As a result, you receive a console error with the following message: 

message: Cannot read property 'replaceCls' of null.

The page of the new activity opens, but when you save and close all of the opened pages, you get back to the schedule displayed in a vertical list and see a blank space with inactive action buttons where the activity page should be. 

Cause

The openCardInChain method is blocked in ActivitySectionV2 as follows:

openCardInChain: function(config) {
   if (this.isSchedulerDataView() && (config.operation === ConfigurationEnums.CardStateV2.ADD)) {
      var historyStateInfo = this.getHistoryStateInfo();
      if (historyStateInfo.workAreaMode === ConfigurationEnums.WorkAreaMode.COMBINED) {
         this.closeCard();
      }
   }
   return this.callParent(arguments);
},

This code is available starting from version 7.3.0.

Solution

In version 7.7.0 this behavior must be corrected. To quickly correct it in the configuration, replace the ActivitySectionV2  schema and override the openCardInChain method in it as follows:

openCardInChain: function(config) {
   if (config.isLinkClick) {
      return false;
   }
   this.saveCardScroll();
   this.scrollCardTop();
   this.showBodyMask();
   var historyState = this.sandbox.publish("GetHistoryState");
   var stateObj = config.stateObj || {
            isSeparateMode: config.isSeparateMode || true,
            schemaName: config.schemaName,
            entitySchemaName: config.entitySchemaName,
            operation: config.action || config.operation,
            primaryColumnValue: config.id,
            valuePairs: config.defaultValues,
            isInChain: true
 };
   this.sandbox.publish("PushHistoryState", {
      hash: historyState.hash.historyState,
      silent: config.silent,
      stateObj: stateObj
   });
   var moduleName = config.moduleName || "CardModuleV2";
   var moduleParams = {
      renderTo: config.renderTo || this.renderTo,
      id: config.moduleId,
      keepAlive: (config.keepAlive !== false)
   };
   var instanceConfig = config.instanceConfig;
   if (instanceConfig) {
      this.Ext.apply(moduleParams, {
         instanceConfig: instanceConfig
 });
   }
   this.sandbox.loadModule(moduleName, moduleParams);
   return true;
}

 

Like 0

Like

Share

0 comments
Show all comments

Question

It is necessary to disable the ability to download files during synchronization, but still leave the option to download files from a mobile app.

Answer

You can disable the binary data transfer from the configuration. The mobile application will not download files while synchronizing with the main app, but the user will still have the ability to download files or upload them.

An example based on knowledge base files:

In the manifest, in the "ModelDataImportConfig" section for the "KnowledgeBaseFile" Data column, set the "ImportBinaryData" sign to false.

{
    "Name": "KnowledgeBaseFile",
    "SyncColumns": [
        {
            "Name": "Data",
            "UseRecordIdAsFileName": false,
            "ImportBinaryData": false
        } 
    ]
}

 

Like 0

Like

Share

0 comments
Show all comments
knowledge base
SDK
support
Q&A

Case

I need to add custom macro to WORD to convert the entered data.

Solution

  1. Create a new [Source code] schema in the configuration.
  2. The schema content should be taken from the DateTimeExpressionConveter schema.
  3. From line 22, change the code for the needed one:
ExpressionConverterAttribute("<MacrosName>")]
public class <MacrosName>ExpressionConveter : IExpressionConverter {
    public string Evaluate(object value, string arguments = "") {
        string dateFormat = "dd.MM.yyyy";
        if (!arguments.IsNullOrEmpty()) {
            dateFormat = arguments;
        }
        DateTime date;
        if (DateTime.TryParse((string)value, out date)) {
            return date.ToString(dateFormat);
        }
        return string.Empty;
    }
}

Addding macro to the displayed value is performed in Word, read more at https://academy.bpmonline.com/documents/technic-sdk/7-7/how-create-own-…

Like 0

Like

Share

0 comments
Show all comments
knowledge base
SDK
Q&A
support

Question

I cannot compile anything, bpm'online cannot find the system setting values, section wizard does not work, etc.

Compilation error.The System setting element with the "CodeCompilerWarningLevel" code not found.

Answer

The user deleted the Supervisor user. The solution to restore the Supervisor is provided below:

------
INSERT INTO Contact (Id, Name, AccountId, OwnerId, GenderId, TypeId) VALUES ('410006E1-CA4E-4502-A9EC-E54D922D2C00',
'Supervisor', 'E308B781-3C5B-4ECB-89EF-5C1ED4DA488E', '410006E1-CA4E-4502-A9EC-E54D922D2C00',
'EEAC42EE-65B6-DF11-831A-001D60E938C6', '60733EFC-F36B-1410-A883-16D83CAB0980')
------
 
INSERT INTO [dbo].[SysAdminUnit]
  ([Id]
  ,[CreatedOn]
  ,[CreatedById]
  ,[ModifiedOn]
  ,[ModifiedById]
  ,[Name]
  ,[Description]
  ,[ParentRoleId]
  ,[ContactId]
  ,[TimeZoneId]
  ,[UserPassword]
  ,[SysAdminUnitTypeValue]
  ,[AccountId]
  ,[Active]
  ,[LoggedIn]
  ,[SynchronizeWithLDAP]
  ,[LDAPEntry]
  ,[LDAPEntryId]
  ,[LDAPEntryDN]
  ,[IsDirectoryEntry]
  ,[ProcessListeners]
  ,[SysCultureId]
  ,[LoginAttemptCount])
VALUES
  ('7F3B869F-34F3-4F20-AB4D-7480A5FDF647'
  ,'2008-12-25 10:30:00.0000000'
  ,'22C5540C-D9B1-49EF-8EB7-72419B78E57C'
  ,'2012-09-11 04:52:13.3962744'
  ,'410006E1-CA4E-4502-A9EC-E54D922D2C00'
  ,'Supervisor'
  ,''
  ,NULL
  ,'410006E1-CA4E-4502-A9EC-E54D922D2C00'
  ,''
  ,'eF4f7sfUgBuNFei7bk+3djw/zXkaB1ODf3huR0RJDD4='
  ,4
  ,NULL
  ,1
  ,0
  ,0
  ,''
  ,''
  ,''
  ,0
  ,0
  ,'1A778E3F-0A8E-E111-84A3-00155D054C03'
  ,0)
GO
 
------

Afterwards, distribute the admin and all comapny employees' roles to Supervisor.

Like 0

Like

Share

0 comments
Show all comments