Add new DataView in Contact Section (only contacts with B2B type)

define("ContactSectionV2", ["GlbClientConstants"], function(clientConstants) {
    return {
        entitySchemaName: "Contact",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        attributes: {},
        methods: {
            getDefaultDataViews: function() {
                var baseDataViews = this.callParent(arguments);
                baseDataViews.GridDataViewB2B = {
                    name: "GridDataViewB2B",
                    caption: this.get("Resources.Strings.B2BButtonCaption"), // Section header
                    hint: this.get("Resources.Strings.B2BButtonCaption"), // Hint for button
                    icon: this.get("Resources.Images.B2BDataViewIcon") // Image for button
                };
                return baseDataViews;
            },
            loadActiveViewData: function() {
                var activeViewName = this.getActiveViewName();
                if (activeViewName === "GridDataViewB2B") {
                    this.loadGridData();
                }
                this.callParent(arguments);
            },
            loadGridDataView: function(loadData) {
                var gridData = this.getGridData();
                if (gridData && loadData) {
                    gridData.clear();
                }
                this.setViewFilter(this.get("ActiveViewName"));
                this.reloadGridColumnsConfig(false);
                this.reloadSummaryModule();
                this.callParent(arguments);
            },
            loadGridDataViewB2B: function(loadData) { // "load" + DataView.name
                this.loadGridDataView(loadData);
            },
            setActiveView: function(activeViewName) {
                this.callParent(arguments);
                if (activeViewName === "GridDataViewB2B") {
                    this.set("IsGridDataViewVisible", true);
                }
            },
            setViewFilter: function(activeViewName) { // Add filter for your "DataView"
                var sectionFilters = this.get("SectionFilters");
                if (activeViewName === "GridDataViewB2B") {
                    sectionFilters.add("FilterB2BType", this.Terrasoft.createColumnFilterWithParameter(
                        this.Terrasoft.ComparisonType.EQUAL, "Type", clientConstants.ContactTypes.B2B));
                } else {
                    sectionFilters.removeByKey("FilterB2BType");
                }
            }
        }
    };
});

Like 2

Like

Share

2 comments

How to create GridDataViewB2B? Is it a schema of the section view model?

Thank you

You don't need to create a schema. The GridDataViewB2B is created in the getDefaultDataViews function via native js (https://prnt.sc/pl1tvo).

Show all comments

Symptoms

When creating a detail via the detail wizard, the following error message pops up at the moment of registering the page: message: Uncaught Terrasoft.ArgumentNullOrEmptyException: Nonexisting or empty argument with the argumentName: query name

Cause

Too long names of objects used for creating details:

"Opportunity Documents in the Product", "History of Document changes"

Solution

Change the name for a shorter one (up to 30 characters) and publish the object.

Like 0

Like

Share

0 comments
Show all comments

Symptoms

Terrasoft.Exception% 0D% 0A Message: A timeout occurred while determining the current coordinates%

There was a problem with determining the location when the error has occurred.

When determining the current location, a time-out message is displayed if the system could not determine the coordinates using any available services.

Depending on the device, your location can be determined by the following services:

  • A built-in GPS device
  • Google services using Wi-Fi
  • Using A-GPS technology in case the device supports it.

The most reliable way is to determine the location using a Wi-Fi network.

The most common method is to determine the coordinates is using GPS, however GPS in itself is not failproof, for example:

- GPS is turned off

- No satellite signal at the time of the request

- Signal from the satellite is weak

- Radio interference

About the influence of external factors on the signal quality: 

The level of signal reception from satellites is lower if there is dense foliage of trees in its way or due to very large clouds. Also, the normal reception of GPS signals can be prevented by interference from radio sources. However, the main factor affecting the decrease in GPS accuracy is the incomplete visibility of the sky - this occurs when a GPS receiver is located in a dense urban environment in which a significant part of the sky is hidden by nearby buildings, sheds, and other obstacles.

It is important to note that a message about a location failure is not an application error and does not affect its performance. The mobile app simply alerts the user that it wasn't able to determine the location for an activity, for example. 

Solution

Wait for the GPS signal to recover and re-synchronize. If you are using Android, try restarting your mobile device (this error may occur due to nuances of certain mobile OS versions). If you still see an error, check the following:

1.  What options are included in the geolocation settings on the device (Fig. 1-3):

Fig.1 

Fig.2

Fig. 3

2. Were you indoors or outdoors when the error has occurred?

3. Did the error still occur when you tried to create a visit once more?

If your device is normally connected to WiFi, but the settings indicate “Use GPS only”, then this error may occur as well.

 

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

Type: Terrasoft.SyncException%0D%0AMessage: There was a synchronization error%0D%0A%0D%0AType: Terrasoft.FileException%0D%0AMessage: An error occured while opening the file%0D%0AAdditional information: %0D%0A%09Name: BPMonline700/AppStructure/rev_29/src/MobileContactAnniversaryEditPage.js%0D%0A%0D%0AType: Terrasoft.FileSystemException%0D%0AMessage: Object not found%0D%0AAdditional information: %0D%0A%09Code: 1%0D%0A%0D%0A

Solution

In the mobile application, perform the following actions:

  1. Clear cache.
  2. Re-synchronize.
Like 0

Like

Share

0 comments
Show all comments

Question

Regarding the error when working with the mobile version of the application:

HTTP Error 405.0 - Method Not Allowed. The page you are looking for cannot be displayed because an invalid method is used (HTTP command).

Full bug report:

Type: Terrasoft.ServerException

Message: Request for server returned error

<legend> Most likely reasons: </ legend> \ n <ul> \ t <li> The request sent to the web server used the HTTP command that was not allowed by the module configured to process the request. </ li> \ t < li> A request was sent to the server containing an invalid HTTP command. </ li> \ t <li> This request for static content contains an HTTP command other than GET and HEAD. </ li> \ t <li> The request was sent to the virtual directory using the HTTP POST command; meanwhile, the default document is a static file that is not compatible with HTTP commands other than the GET and HEAD. </ li> </ ul> \ n </ fieldset> \ n </ div> \ n <div class = \ "content-container \"> \ n <fieldset> <legend> What can be done: </ legend> \ n <ul> \ t <li> Check the list of commands activated for the module handler with this request and ensure that this command can easily reach the website. </ li> \ t <li> View the IIS log file and determine which command cannot be used in the request. </ li> \ t <li> Create a trace rule to track failed requests for this HTTP status code. For more information about creating a trace rule for failed requests, click Most likely causes: The request sent to the web server used the HTTP command that was not allowed by the module configured to process the request. A request was sent to the server containing an invalid HTTP command. This static content request contains an HTTP command other than GET and HEAD. A request was sent to the virtual directory using an HTTP POST command; meanwhile, the default document is a static file that is not compatible with HTTP commands other than the GET and HEAD. Possible solutions: Check the list of commands activated for the module handler where this request was sent, and make sure that this command can reach the website. Review the IIS log file and determine which command cannot be used in the request. Create a trace rule to track back requests for this HTTP status code. For more information on creating a trace rule for failed requests, click here.

Solution

This error may occur due to incorrect IIS settings on the server.

To fix this, add the following code to the web.config file:

<system.webServer>
    <modules>
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
    </handlers>
</system.webServer>

 

Like 0

Like

Share

0 comments
Show all comments

Symptoms

When I export big data volumes, in 30 seconds I get an error.

Cause

The cause of the timeout error, when exporting big volumes of data or big number of nested queries, is the Ext.Ajax component, whose standard timeout is 30 seconds.

The server request waits for this exact time, and if the file is not generated, the client declines waiting.

Solution

The possible solution might be extending the timeout period in the bpm'online "core" (...\Terrasoft.WebApp\Resources\ui\Terrasoft\core\). The ajax-provider.js file in the "request: function(config) { …" function, add the following code strings:

Ext.Ajax.timeout = 90000;
Ext.override(Ext.data.proxy.Server, { timeout: Ext.Ajax.timeout });
Ext.override(Ext.data.Connection, { timeout: Ext.Ajax.timeout });

If a permission error occurs, increase the number of list records in the web config:

 

Like 0

Like

Share

0 comments
Show all comments
  1. Add your *.dll file to configuration on "External assemblies" tab (for example barcode.dll):

  2. Get Namespace of your *.dll file.

    a) You can find it in documentation to library;

    b) If you don't have documentation you can use ildasm.exe (IL Disassembler). This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7). For more information, see Command Prompts.



     

  3. Add using to your schema

    a) For source code:





    b) For Business process:







     
  4. Now you can use methods from library in your code. 

     

    Example for barcode.dll

    string temp = BarcodeConverter128.StringToBarcode("Test string");

     

Like 0

Like

Share

6 comments

Hi,

I tried to do so with a library I uploaded and I'm getting the following compilation errors on the script

 

The type or namespace name 'PdfApi' could not be found (are you missing a using directive or an assembly reference?)

 

Thanks,

Raz

Raz Guille Rosman,

Hello,

 

Please share the process schema and with the library you've uploaded.

 

Thank you in advance!

 

Best regards,

Oscar

Oscar Dylan,

Hi Oscar,

 

I attached  a screen shot of the process and a link to the libraryhttps://www.dropbox.com/s/2lplgni2wsi5piy/Aspose.PDF.dll?dl=0

 

This is the code inside the script task:

PdfApi api = new PdfApi("11d276990520041f6cda09531e25aabb", "9568f0a0-cf77-4836-97d2-fd1389338080");

return true;

Raz Guille Rosman,

 

Hello Raz,

 

Thank you for providing the dll file!

 

The namespace of the file is no Aspose.PDF, but Aspose.Pdf:

And even after applying a correct namespace name this error comes up:

And indeed I couldn't locate the type or namespace with such a name in the dll. Please contact the developer of this library and ask him\her how to correctly call the method you need.

 

Best regards.

Oscar

Thank you, I'll check it out.

It's a library I downloaded from Aspose website

Show all comments

Let's suppose you have created a new web-service UsrCustomService.svc and you need to disable cookie authentication. Here is the

list of changes to be done:

Make changes to the site folder

  • In folder \Terrasoft.WebApp\ServiceModel\ create file UsrCustomService.svc with text:
<%@ ServiceHost Language="C#" Debug="true" Service="Terrasoft.Configuration.UsrCustomService" %>

Important! Specify full service name including the namespace

  • In file \Terrasoft.WebApp\ServiceModel\http\services.config and \Terrasoft.WebApp\ServiceModel\https\services.config add section:
<service name="Terrasoft.Configuration.UsrCustomService">
    <endpoint name="UsrCustomServiceEndPoint"
        address=""
        binding="webHttpBinding"
        behaviorConfiguration="RestServiceBehavior"
        bindingNamespace="http://Terrasoft.WebApp.ServiceModel"
        contract="Terrasoft.Configuration.UsrCustomService" />
</service>
  • In file \Terrasoft.WebApp\Web.config in the  section  to the value of the key AllowedLocations append ;ServiceModel/UsrCustomService.svc and add next section into configuration section:
<location path="ServiceModel/UsrCustomService.svc">
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
    <httpRuntime requestValidationMode="2.0" executionTimeout="28800" /><!--For incoming message in 'Raw' format-->
    <pages validateRequest="false" />
  </system.web>
</location>

Example different requests

UsrCustomService.cs

namespace Terrasoft.Configuration
{
    using System;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Collections.Specialized;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    using System.ServiceModel.Activation;
    using Terrasoft.Common;
    using Terrasoft.Core;
 
    #region Class: UsrCustomService
 
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class UsrCustomService {
 
        #region Constructors
 
        public UsrCustomService() {
        }
 
        public UsrCustomService(HttpContextBase httpContext, UserConnection userConnection) {
            _httpContext = httpContext;
            _userConnection = userConnection;
        }
 
        #endregion
 
        #region Properties: Protected
 
        private const int StreamReaderBufferSize = 65536;
 
        private HttpContextBase _httpContext;
        protected virtual HttpContextBase CurrentHttpContext {
            get { return _httpContext ?? (_httpContext = new HttpContextWrapper(HttpContext.Current)); }
        }
 
        private UserConnection _userConnection;
        protected UserConnection UserConnection {
            get {
                if (_userConnection != null) {
                    return _userConnection;
                }
                _userConnection = CurrentHttpContext.Session["UserConnection"] as UserConnection;
                if (_userConnection != null) {
                    return _userConnection;
                }
                var appConnection = (AppConnection)CurrentHttpContext.Application["AppConnection"];
                _userConnection = appConnection.SystemUserConnection;
                return _userConnection;
            }
        }
        #endregion
 
        #region Methods: Private
 
        private void SetOptionsCORS() {
            CurrentHttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
            CurrentHttpContext.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
            CurrentHttpContext.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
        }
 
        private void SetHeaderCORS() {
            CurrentHttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
        }
 
        private NameValueCollection ParseQueryParameters(Stream stream) {
            var rawPostData = new StringBuilder();
            char[] buffer = new char[StreamReaderBufferSize];
            int readLength = 0;
            using (StreamReader streamReader = new StreamReader(stream)) {
                while ((readLength = streamReader.ReadBlock(buffer, 0, StreamReaderBufferSize)) > 0) {
                    if (readLength < StreamReaderBufferSize) {
                        char[] bufferLast = buffer.Take(readLength).ToArray();
                        rawPostData.Append(bufferLast);
                        bufferLast = null;
                    } else {
                        rawPostData.Append(buffer);
                    }
                }
            }
            buffer = null;
            NameValueCollection queryParameters = HttpUtility.ParseQueryString(rawPostData.ToString(), Encoding.UTF8);
            rawPostData.Clear();
            return queryParameters;
        }
 
        #endregion
 
        #region Methods: Public
 
        [OperationContract]
        [WebInvoke(Method = "OPTIONS", UriTemplate = "*")]
        public void GetWebRequestOptions() {
            SetOptionsCORS();
        }
 
        #region POST: Content-Type: "application/x-www-form-urlencoded"
 
        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "UsrFormRequest", ResponseFormat = WebMessageFormat.Json)]
        public ConfigurationServiceResponse UsrFormRequest(Stream stream) {
            SetHeaderCORS();
            ConfigurationServiceResponse response = new ConfigurationServiceResponse();
            if (UserConnection == null || stream == null) {
                response.Success = false;
                return response;
            }
            try {
                NameValueCollection queryParameters = ParseQueryParameters(stream);
                ///TODO: your code here
            } catch (Exception e) {
                response.Exception = e;
            }
            return response;
        }
 
        #endregion
 
        #region POST: Content-Type: "application/json"
 
        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "UsrJsonRequest",
            RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        public ConfigurationServiceResponse UsrJsonRequest(JsonDataRequest request) {
            SetHeaderCORS();
            ConfigurationServiceResponse response = new ConfigurationServiceResponse();
            if (UserConnection == null || request == null) {
                response.Success = false;
                return response;
            }
            try {
                ///TODO: your code here
            } catch (Exception e) {
                response.Exception = e;
            }
            return response;
        }
 
        #endregion
 
        #region GET
 
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "UsrGetRequest/{request}/", ResponseFormat = WebMessageFormat.Json)]
        public ConfigurationServiceResponse UsrGetRequest(string request) {
            SetHeaderCORS();
            ConfigurationServiceResponse response = new ConfigurationServiceResponse();
            if (UserConnection == null || string.IsNullOrEmpty(request)) {
                response.Success = false;
                return response;
            }
            try {
                ///TODO: your code here
            } catch (Exception e) {
                response.Exception = e;
            }
            return response;
        }
 
        #endregion
 
        #endregion
 
    }
 
    #endregion
 
    #region Class: JsonDataRequest (Example)
 
    [DataContract]
    public class JsonDataRequest {
 
        [DataMember(Name = "first_name")]
        public string FirstName { get; set; }
 
        [DataMember(Name = "last_name")]
        public string LastName { get; set; }
 
    }
 
    #endregion
 
}

 

Like 0

Like

Share

2 comments

I have a problem with CORS with cookies value "samesite". How I can fix it?

Daer Nataliia, 

Please see the article below on how to deal with CORS: 

https://community.creatio.com/articles/web-service-available-without-authorization-cors

Show all comments

Question

How can I get information form an account page via the [Addresses] detail? For example, I need to call a function or retrieve information from a field (e.g., name) or learn the field status (e.g., enabled).

Answer

To connect a detail with a page, use the message mechanism. You can use base messages or create custom ones (you will have to create a replacing module in this case).

For example, you can execute a ReloadDetail message subscription in the implementation of the init() method of the detail code as follows:

this.methods.init = function() {
 ...
 this.sandbox.subscribe("ReloadDetail", function(customArgs) {
 // executing actions with function arguments
 }, [this.sandbox.id]);
}

Further, you can publish the message in the parent page code by an action:

this.methods.myAction = function() {
 Terrasoft.each(this.entitySchemaInfo.details, function(detailInfo) {
 if (detailInfo.name === "addresses") {
 sandbox.publish("ReloadDetail", this, [detailInfo.moduleId]);
 }
 }, this);
}

Passing this as a parameter when publishing enables accessing the page object in a detail as well as accessing all its attributes and methods, etc. – this object will be passed in the customArgs parameter. You can pass a set of only the needed data instead of this.

You do not need to create ReloadDetail, it is already contained in the base modules of pages and details.

We recommend receiving the values of needed conditions before this moment, since after you perform getCustomItemView(), the control will be passed over to the base detail module (DetailModule), where the model is linked to the view and detail rendering is performed.

Like 0

Like

Share

0 comments
Show all comments

Symptoms

Type: Terrasoft.SourceCodeException

Message: SyntaxError: Unexpected identifier 'Invoices'. Expected '}' to end a object literal.

Additional information:

Script: file:///var/mobile/Containers/Data/Application/5971FB51-E199-46E3-8004-22E3199C246B/Documents/BPMonline700/AppStructure/rev_1/src/UsrInvoicesType.js?hash=c033cb8c-ace4-4766-b865-88fc6882274f%0D%0A%09Line:8 

Cause

The title of the Activity includes double quotation marks, but at the present moment, the system does not know how to process them.

Solution

The ability to work with double quotation marks will be implemented in the next versions of bpm'online. At the moment, a workaround is the following:

1. Go to the configuration

2. Open the UsrInvoicesType schema

3. Change its caption so that it does not have double quotation marks

For example, Section object type 'Invoices'

Necessary conditions

Admin rights.

Like 0

Like

Share

0 comments
Show all comments