What is a script for 1s. "Arrange a call!" allows you to build a closed cycle of interactions with the client

In this article I will try to give a couple of tips on setting up script activation on sites using 1C.

Why might this be needed? In my example, I needed to run the php script to activate the download on the site, the cms of which is 1C-Bitrix. Those. the file is unloaded from 1C and signals the site to pick up the file. Thus, a high efficiency of exchange with the site is achieved.

In fact, there is nothing difficult in this process, but due to the specifics of this procedure, the programmer may have some problems with this action.

Task description:

It was necessary after uploading the data file from 1C to upload the file to the site database as soon as possible. To do this, the programmer who develops the site created a script that performed two actions - it checked the authorization and activated the exchange from the site. The php script itself looked like this: "http:// /1c_prices_import_run.php".

Let's see how this script was launched.

GET request from 1C

First, an object is created HTTPConnection", with the help of which we perform authorization:

Get 267 1C video lessons for free:

HTTP = New HTTPConnection(" /1c_prices_import_run.php

In the parameters I pass php script address, password and login. This is enough if you do not have other tricky conditions like secure authorization and a proxy server.

My second step was to check the connection, in case of successful authorization, this script returned the word “success” to me:

HTTP.Get(" http:// /1c_prices_import_run.php?mode=checkauth", ResponseFileName); // authorization check

In the parameters of the Get method (similar to GET), we specify the parameter " ?mode=checkauth", which shows it's just a ping. The second parameter, "ResponseFileName", is the file to which the server's response will be written.

HTTP.Get(" http:// /1c_prices_import_run.php?mode=query", RequestFileName);

That's all. Everything is quite simple and works perfectly on the 1C side.

Well, in the end, I'll show the whole code in its entirety:

RequestFileName= GetTempFileName();

HTTP = New HTTPConnection(" http:// /1c_prices_import_run.php«,SettingDataExchange.HTTPExchangeUserName,SettingDataExchange.HTTPExchangePassword,); //connection

Exception

End of Attempt;

HTTP.Get( http:// /1c_prices_import_run.php?mode=checkauth", RequestFileName); // authorization check

Exception

End of Attempt;

ResponseFile = New File(ResponseFileName);

If ResponseFile.Exists() Then

The thesis that open-source is created by enthusiastic geeks has lost its relevance in our time. Nevertheless, the ideology of open source was born just like that. Cool programs written at night by bearded (and not so) weirdos, disinterestedly, just to make the world a better place - changed the world of software development.

Any programmer secretly dreams of doing something big and bright for everyone to like. If you tell me that you are not one of those people, that you only like to close tickets in a working bug tracker, and you do not dream of releasing your project to the big world, then I will not believe you. Or I would suggest a career change. I am convinced that a programmer is an artist, and it is important for an artist to do something of his own, perhaps just "on the table" - but to do it.

One day, an idea for a project popped into my head. The idea was purely research and I was not going to make some kind of "product" out of it. In addition, I had never run open source projects before and I really wanted to try how it all works. What came of it - under the cut.

At the very beginning of the life path of the project, I already wrote about it on Habré. Then it was the first steps, the code was raw, but it worked. I wanted the project to arouse interest from other authors, since I obviously would not have pulled it alone and, in general, abandoned it. In principle, this would have happened if I had not received my first pull-request from a stranger. But first things first…

What is this about?

I made my own implementation of a stack machine that executes scripts in the 1C: Enterprise language. Or, to put it more simply, an open interpreter of the 1C language and an open implementation of some standard 1C classes. At the same time, a clear applied goal of the project was set - to give 1C-nicknames a scripting automation tool that would be easy to learn. The project was named 1Script.

And so, the project is published on Habré and on the specialized 1C portal infostart.ru. I'm waiting for feedback. I received the first response on the miste and laughed heartily. The topic on the forum was called “Interpreter 1C on Habré. Let's shut up?" There are a lot of good people on the mist, I was glad :)

Then came more or less adequate questions, which I diligently answered, after which the articles in the regular mode went down from the first pages somewhere down, and interest in the project subsided. Well, it was the expected ending, I was a little annoyed, but not much. Actually, I did not count on any special result. Chatted and okay. Days passed, I finished something, even posted another version, but no one except me needed it. My fire has dried up. Although I was not disappointed, I stopped writing new code.

Second wind

About two months after the publication, I was contacted by Sergey Batanov (Serega, hello! :) - a prominent dude in the 1C community, who offered his help in developing the standard library. It was the 1C-ovsky class "Table of Values". Of course, I agreed. And when I saw the real code that Sergey sent, I was happy like a child, really. It often happens on the Internet when someone offers something in words, but often it doesn’t come to the point. And here is the real live code that works, which is completely adequate, which can be inserted into the project!

At the same time, the task is quite large, I would be too lazy to do it myself. And here - a tangible, really useful, measurable by lines of code contribution to the overall project! In short, I won’t be dishonest if I say that it was Sergey who did so that the project was not abandoned by me. It's an amazing inspiration to get help from a stranger. Just like that, because he was interested in what you started.

Gradually, I began to receive feedback from people who tried the engine and asked “where is this feature?”, “But how to do this?” I had to answer all these questions, saying that this is a prototype, and to add these features myself as a matter of urgency. But the enthusiasm went off scale: “People are interested and trying to apply,” so new features were added pretty quickly. Initially, the standard library did not even have functions for working with files.

Further more

After some time, Alexander Kuntashov wrote to me with a question about the integration of 1Script and the Snegopat project (www.snegopat.ru). Who does not know - this is such a resharper for 1C. It allows you to make script plugins for the 1C Configurator and there is a whole community of authors of such plugins.
These plugins were written in JavaScript, and therefore required qualifications that went beyond the standard 1C programmer. Because of this, in the end, the development of the plugin ecosystem was also slowed down. The number of people who want to improve the Configurator is approximately equal to the total number of 1C nicknames, however, the need to learn JavaScript scares away the authors of potential masterpieces.

Again, I was wildly delighted with the demand for my brainchild, begged the author for the distribution kit of Snegopat and shook off the dust from my knowledge of C ++. There was much more dust than knowledge, but the creative itch did its job, and I plunged into MSDN.

About a month later, in the 1C Configurator, it became possible to write plugins directly in the 1C language without switching to the JavaScript editor window. At the same time, the first critical bugs of the engine were fixed and the internal architecture was significantly revised.
I got a heady delight from communicating with C ++, COM, ATL and all these things, after many years of working exclusively with 1C. Well, and also from the fact that he did something useful, tangible for the 1C-nick community.

The first experience of combat use

Around the same time (I don’t remember exactly) the project came to the attention of Alexei Lustin () (Lech, hello to you too!) - among the 1C nicknames of a well-known and respected person. This coincided with my search for a new job. I was looking for interesting companies on the market, and Alexey was looking for specialists for the Continuos Integration / Continuos Delivery project for 1C nicknames. Then Lesha already saw my project (and nickname) on Habré, and I already knew that a certain team of advanced 1C nicknames was doing interesting non-standard things on the network.

At that moment, the community already knew such things as unit testing, storing 1C code in git, BDD + cucumber for 1C, and so on. Alexei seemed to me the most accessible of these dudes and I wrote him a letter asking if he had an interesting job. So, together with my project, I got into a cheerful company of geeks who had gathered by that time in the company where Alexey worked.

At that time, the engine already had the minimum set of capabilities required for the script, and it could (as it seemed to me) be used in principle as a scripting for assembling and deploying 1C databases.

Why even use a new engine for this?

Actually, there are a million scripting languages, it is not clear why one more is needed, and even an unknown one - the reader of Habr will ask - and he will not be entirely right. Strategically, the future product was intended for 1C-nicknames and would have to live from developer to developer, regardless of personnel changes in the company. There is an objective problem in the 1C-nick community: there are many great specialists among them, but for some reason the average 1C-nick does not want to learn any other language after he has got his hand in 1C well. I don’t know what is the reason for this phenomenon, probably because 1C rules (irony)? People come to 1C knowing Java, C/C++, microcontrollers, Delphi, or nothing, but they often stay in 1C and are reluctant to move back to their original ecosystems.
I now foresee a wave of anger, but please, listen to the thesis to the end. There are exceptions to any rule, however, when planning a system that must survive several generations of developers (not biological, but human generations, of course), then most likely you will find a specialist who can develop it if it is written in 1C. If it is a python (or insert your favorite language), then you will have to hire a pythonist who knows 1C very well. And after his transition to big bosses, you will have to look for another one of the same, with competencies in the field of 1C. And if it is immediately a 1C language, then you will only have to find a 1C nickname who knows 1C well and that will be enough.
In other words, the system will be more tenacious and will be able to be developed by more specialists if it is written in a language familiar to them all.

Thus, the scope of 1Script became clear: these are DevOps and similar tasks for the purposes of 1C projects.

First bumps and proper development

The first more or less large script that I wrote (before that there were texts of no more than a hundred lines) caused the engine to crash. With a certain combination of parameters and call chains, control was transferred to an unknown place in the code, and the application crashed. I had to almost completely rewrite the implementation of the call stack and exception handling. It was a challenge in the style of “Oh you are so! Well, I'll fix you!" The fighting fuse made it possible to rewrite the necessary modules in one day and, in addition, to identify a couple of bugs. The code began to run stably. I have released a new release. Along the way, since I was now engaged in Continuous Integration, it came to the realization that the project also needed a build server and release automation. In addition, he joined the project, known among 1C nicknames as a coryphaeus and guru of 1C testing. He made me a toolkit for testing the engine based on his xUnitFor1C framework. So I got acceptance tests of behavior, also written in the 1C language. I picked up TeamCity on my home server and set up nightly builds with test runs. Along the way, I was charged with enthusiasm - the project lives on and acquires new contributors. It was wildly inspiring.

For some three or four months, the engine class library has finally acquired everything necessary for most scripting tasks: network functions, working with archives, XML, and so on have appeared. Our CI project for 1C has been successfully launched.

Around the same time, thanks, again, new interested users began to come to the project. They requested features, found bugs, demanded new releases.
The flow of features, the allocation of library code, coupled with the need for a simple release scheme, led me to such an interesting thing as the growth problem. But about her, a little later.

In November 2014, I was invited to speak at the prestigious 1C Infostart Event conference in St. Petersburg. Of course, I agreed, and I took 1Script as the topic of the speech. The topic was approved, which for me meant, firstly, the fact of some popularity of the project (i.e., listeners will probably come, because at least they heard something about it), and secondly, I hoped to attract contributors , since there was almost no time for the development of the engine.
Especially for the conference, I even made a special fun - CGI mode, in which scripts could be run under the control of an HTTP server and generate HTTP output. Sites in the 1C language are no longer a hoster's nightmare, but a harsh reality (just kidding).
The speech at Infostart can be considered the first public announcement, where 1Script could no longer be embarrassed to be called a product, a tool capable of solving specific problems. It was no longer an experiment, but a combat product. Although still in beta status.

Growth Problem or Project Support Pitfalls

As it turned out, the presence in your department of a demanded project, even a small one, carries such a considerable burden of overhead costs. For starters, it's a feature stream. Wishes come much more often than commits that implement those wishes. It is required to strictly take into account the versions in which certain errors were corrected. It is required to somehow notify users that a bug has been fixed since version X or a new feature has appeared. The growth of functionality requires documentation, and documentation tends to become obsolete.
Well, the funny thing is that the technical infrastructure of the actual “support” is required. We needed a website, a documentation generator, a build/deploy server, and so on and so forth... Financial investments in infrastructure were required - minimal, but still investments.
When starting a research project, I did not even imagine so many organizational and technical issues that I would have to face as the project grew. The transition to the git-flow technique helped a lot in this regard, it became easier to figure it out yourself and communicate with users about versions and branches.

Crowdfunding experience (terrible word)

At the beginning of this year, I tried to conduct an experiment - I organized a collection of donations for infrastructure - a domain name and hosting. I was wondering how much the project could pay for its own existence. The result was, people unknown to me, indeed, sent about 100-500 rubles each. which was enough to pay for a domain name in the .io zone. Then, the campaign was curtailed and the flow of funds stopped. It did not reach full payback, although some financial support was received.
Most importantly, the thesis about the effectiveness of the donation model, as such, was tested in nature. Conclusion - in my case, donation can hardly be called effective, although it was not zero.

Library of useful scripts

In a year and a half of coding in 1Script, library blocks have emerged that you can use yourself and recommend to others. In a natural way, I accumulated a number of developments that were suitable for reuse.
This led to the fact that the ability to connect third-party "packages" also written in 1Script was added to the engine. The result was another project called oscript-library. (https://github.com/EvilBeaver/oscript-library) This library, of course, also required infrastructure, documentation, end-user updates, and more. But the flow of contributing from 1C-nicknames has grown significantly. After all, packages are developed in an already familiar language, which means that you can immediately benefit, port existing developments, etc. The community of "1C script writers" began to grow, which was greatly facilitated by the second report at the Infostart Event in 2015.

What does it look like

Import uses a special preprocessor directive #Use (#Use) It is not in the original 1C platform, but for ease of importing libraries, we had to move away from the canonical syntax and borrow a solution from other ecosystems.
#Use json // classReaderJSON is declared in the library and is available thanks to the directive #UseReaderObject = NewReaderJSON(); // some code follows // ...
A specific solution was already developed by a team of authors, application scenarios, pitfalls, etc. were thought out. Google Docs was used as a brainstorming tool.

package manager

To manage packages, a simple package manager was written on the knee, called OPM (OneScript Package Manager). It is also written in 1Script and is a console-based package management utility. At the moment, we are rethinking the package infrastructure and working on a production-ready version of opm.

Project today

Today, 1Script is a stable, successfully used in dozens of companies automation tool for 1C-nicknames. In addition, OneScript is already a kind of brand, this name is known in the community, the tool is actively used, written, asked questions, discussed and, which is especially nice, finalized.
In addition, a library of reusable code packages is an almost integral part of the project. It is small, but covers a significant part of the tasks solved daily by a typical 1C nickname.
This is no longer just a "1C interpreter". The community has created an ecosystem of useful and popular tools.
For me, it was a unique experience, I received words (and deeds) of support from dozens of people I didn’t know (and now I already know). A program that I started solely to "try it out" has turned into a working project used in real combat missions. In addition, a huge experience in managing such an open-source project has been gained - support, maintenance, infrastructure, etc ...
And most importantly - you get the pleasure of doing something you need.

What we plan to do next

The active use of the package library revealed a number of shortcomings and inconveniences. We plan to make adjustments to the package infrastructure and expand the functionality of the package manager. We also plan to expand the set of libraries, for example, we are currently working on a wrapper for the Docker API. We manage docker containers using 1C scripts and developments on this topic will probably also be published when they are brought to mind. This will result in a simplified DSL for container manipulation from 1script.

technical summary

  • Programming language - C#, .NET v4.0/Mono 3.1x
  • Development environment - VS 2013-2015
  • The name of the interpreter is oscript.exe (run for execution - oscript )
  • The script file extension is .os
  • The package file extension is .ospx
  • Code performance - in most measurements up to 4 times faster than the original 1C platform. At least not slower than her.
  • Engine repository - github.com/EvilBeaver/OneScript
  • Library repository - github.com/oscript-library
I don’t write the project’s website, firstly, so that it doesn’t sound like PR, and secondly, it simply can’t stand the habraeffect. If you have your own project that you would like to bring to light, then let me give you a couple of tips based on personal experience.
  • Dare! If you keep your project on the table and don't tell anyone about it, then no one will know about it. Start with an article on Habr. One article will not be enough. Mention your project in forums dedicated to the subject area of ​​your project, give examples of successful application.
  • Be prepared for the fact that there are a lot of suggestions from people, and much fewer real commits. The approach in the style of "It's open-source, you need it, you do it," unfortunately, will not work.
  • Think ahead to solve the “growth problem.” Growth is usually explosive and it is quite difficult to cope with a sharply increased pool of tasks.
Add tags

background

During the implementation of one project, it became necessary to execute javascript (hereinafter referred to as JS) code under the control of the HTML Document Field object, with the result obtained in 1C. The examples given in the articles found did not seem very convenient to use (a purely personal opinion). It was decided to try to find another, simpler solution, no more than 1 day was allotted for the search.

DIV.setAttribute("onclick", "alert("Coordinates");");

Execute the script

DIV.click();

TA-DAH. everything is working

Procedure ExecuteScript(TextScript) DIV = Elements.doc.Document.getElementById("TEST"); DIV.setAttribute("onclick", TextScript); DIV.click(); EndProcedure

Update as of 08/02/2016

The comments suggested another way to call JS (thanks), if you have the ability to change the HTML code of the document, then you can write a function in it and then call it. passing the JS code to it.

and then in 1C:

Elements.DocumentHTMLField1.Document.parentWindow.exec("alert("OK")");

Returning a JS result in 1C

To transfer the result of the script to 1C from the FieldHTMLDocument object, we will use an event. Let's bind an OnClick event to the HTMLDocument Field that receives 3 parameters as input:

  1. The element in which the event occurred (the Field of the HTMLDocument itself)
  2. event object
  3. Sign of the implementation of the standard behavior

To trigger an event on click, you need to execute the following js code

Varevt = document.createEventObject(); // create an empty event object evt.propertyName = "function1"; // I propose to put the name of the result in the propertyName prop (something like a type, or the name of the function from which the data was received) evt.data = "156"; //we will pass the result data to the data prop document.body.fireEvent("onclick", evt); // execute the event on clickHtmlDocumentField

After executing this js code in the procedure, when the second parameter is clicked, the event object we created will come. Which is pretty easy to handle.

Answer parsing example.

&OnClient // get the name and result of the event Procedure DocOnClick(Element, EventData, StandardProcessing) OperationName = EventData.Event.propertyName; OperationData = EventData.Event.data; If OperationName = "" Then //not our event Return; EndIf; If OperationName = "Function1" Then // process result ElseIf OperationName = "function2" Then // process result //...... EndIf; EndProcedure

This method gets rid of the use of wait handlers, and provides a convenient event identifier. By the identifier, we know exactly what data we received and how to parse it.

Additions from 03/26/2016

And in this place, too, misunderstandings occurred (the error is reproduced only on the platform 8.3.5.1570, but in order to prevent these situations in the future, I will give a solution) The very reason - when relaunching the form with the HTML field of the document at the time of the procedure call, when clicking on the HTML field, the platform call stuck and brought down the entire COM object (An exception occurred (htmlfile): Undefined error). The solution was to disable the standard execution of the click event, and disable the event bubbling mode. How to do this, see below.

// disable event bubbling

Evt.cancelBubble = true;

// disable default behavior

Evt.returnValue = false;

As a result, we will get a function to transfer data to 1s from JS.

Function return1c(name,data)( var evt = document.createEventObject(); evt.propertyName = name; evt.data = data; evt.cancelBubble = true; evt.returnValue = false; document.fireEvent("onclick",evt ); );

Conclusion.

By combining these methods, you can quite easily run the js code you need and receive data in 1C for further processing.

Implementation example in

Operator : "Hello! My name is Maria, the company "Windows-everything-on-the-world.""

Customer : "I need nothing"

Operator : "But we have the best conditions and..."

Customer (interrupts):"Maria, goodbye!"

Operator (talking):"We have been operating in the market since 2003 and since then..."

Customer (hang up the phone):...

Maria dials the next number.

Everyone knows the annoying story. After such a dialogue, the client will have a negative aftertaste, and OknaVsemNaSvete stupidly lost precious contact. Although, the operator Maria will receive a salary at the end of the month, so in this situation, not everyone is a loser.

The most offensive thing in this situation is that Maria really tried, she sincerely thinks that "they just don't need clients - they don't take it" and in general "but how can I make him not hang up?". The fact that someone considers KPI, Mary to the light bulb - ZP will be given anyway. At the end of the month, the head Aleksey will study 1001 records of the conversation of his operators (it takes at least 2-3 days a month), scold his wards - he will recover in response the excuses that "again, the call base was not targeted ...". Alexei sighs sadly and distributes salaries to everyone. The next month starts.

The team has developed amicable, a lot of work has been done, but it can’t go on like this. (with)

What is bad in this case (but solved with little blood):

The approach of operators at work

  1. They call automatically. But without a clear goal, it's hard to build a good dialogue;
  2. They do not know how to respond to the client's objection or respond unsuccessfully;
  3. They hang up as soon as they begin to doubt the success of the conversation;
  4. I am sure that he will receive a salary for the process - therefore, he does everything slowly, with a break for rest, without the necessary motivation;
  5. Everyone slaughters the existing rules for calling customers, complaining about the complexity and volume of instructions;

Leader position


All these issues are resolved in the subsystem "Arrange a call!"

(it can be "embedded" in your 1C, you can use it separately).

"Set up a call!" can:

  • Compose scripts - speech modules for operators
  • Assign script availability to different groups and branches
  • Collect statistics on the use of script blocks, achievement of goals and failures, measure conversion
  • Download the call base from Excel or use the numbers of customers who have been called before
  • Display statistics board for operators
  • Create orders, claims during the passage of the script, fill in any objects of your database.
  • Limit "click" to script statements indiscriminately
  • Work with sip telephony
  • Work with email
  • Turn emails, site requests into leads and customer needs by uploading them to the system
  • Manage clients, leads and deals

"Arrange a call!" allows you to build a closed cycle of interactions with the client.

The stages of such work are customized to your taste. For example, like this:

Option number 1

  1. The system received a new potential client
  2. The operator called according to the algorithm, clarified the need for the service
  3. The target contact was transferred to the sales department
  4. The manager builds a relationship with the client
  5. Manager makes a deal

Option number 2

Or like this:

  1. The operator receives an incoming call
  2. When making a call, a scenario for determining the needs of the client is launched, the required company is determined
  3. In the process of work, the operator draws up a customer order, specifies the delivery date
  4. The order is transferred to the supply department for assembly

Option number 3

Well, or another option:

  1. A new application was made on the site, the site redirects the letter to the database on this application
  2. The base parses the letter, "gets" the counterparty data, the message text from it, creates a need and a task
  3. A free operator picks up the task, calls the client, solves the problem
  4. If the client liked everything, either an order is created, or the client is transferred to managers

Option number 4

Come up with any of your options!

At the end of the month, the manager receives reports:

  1. According to extended statistics of customer needs - how many were, how many were qualified, how many were refused - by any status
  2. About the work of conversation scripts and operators
  3. According to contacts with clients - what they talked about, how many times. How many called, how many letters were written.

How it works

In "Set the call!" built-in subsystems (clickable):

Scripts

By scripts, we mean some related actions according to the algorithm. For example,

  1. Outgoing call- to sell a product or service, invite to a promotion, fill out a questionnaire
  2. Incoming call- to correctly process the order, do not forget about the discount and delivery
  3. Filling out a document- standard form in the form of an assistant

How to use

  • Create operator conversation patterns in the constructor
  • Complete customizability - display any fields to fill in the call script (questionnaire data, to enter an order, etc.)
  • Post links to internal knowledge base articles so that the operator can answer any technical questions
  • Create orders during the call script, collect claims, send letters and change the status of potential customers
  • Give star managers more freedom in the call script. Such employees do not like restrictions, their performance is higher when the conversation is not 100% constrained - create a conversation script for such managers, which will be used as a prompt-questionnaire, and the transition between blocks will be free. You will receive statistics for these stars as well, and they will not feel "squeezed" by the conversation script
  • Check the work of operators according to call scenarios and record the results of the check in a special document
  • Get rid of hacky calls with the help of competitive script execution settings
  • Send quotation letters during the call script process, create complaints from dissatisfied customers during the process

Scripts are the main subsystem of "Arrange a call!". Below is a little more about its settings using an example.

Example

For example, there may be such a task for operators: "You need to call the list of numbers, weed out non-targeted contacts, and transfer leads to managers." To do this, we will create a script in the system, load potential deals from xls, operators will go through deals according to the script, weed out non-target ones, and target ones will be transferred to managers for work. Let's create a script first.

Create a new script

  1. We create a flowchart of this script - what the operator will say, what values ​​​​to choose and what the system will offer him next
  2. We set additional script fields - for example, on each block of the script, the full name of the client and his company should be visible
  3. Specify quick transitions from each block. In each block, buttons for quick transitions will be displayed (the operator can be asked at any time "What kind of company are you?" - in this case, the operator clicks on the quick transition, reads the block text about the company and returns to the previous block)
  4. We set up the script - will the script be logged, will the scheme be visible, is it necessary to use SIP, what tasks need to be performed during the script, etc.
  5. We assign access rights to it - who can see this script, create a new call using it, etc.

In the block diagram of the script, we indicate what the operator should say, what response options the client has, and what fields the operator must fill in at this stage.

  1. The text of the operator's speech. You can insert additional details from previous script blocks or common fields. Can format text
  2. Text parameters are set here - the screenshot shows that [Name] will be filled in from the company name
  3. We set whether the goal has been achieved if this block has been reached, what stage the block belongs to ("establishing contact", "reaching the secretary", etc.) and what result has been achieved if this block has been reached

The script block can have additional semantic meanings:

  • You can place any fields on it. For example, the operator must choose how to deliver the goods to the client - pickup, courier in the city or intercity. Until the operator fills this field, the script will not go further. Well, in the scheme, you can indicate that if you filled out the intercity, then you need to show one block, if by courier, then another.
  • The created block attributes can be filled with something. For example, in the first block of the script, we were told the name of the director, and in the last block we can get this information and display it on the form to the operator
  • When moving further from the block, you can perform some actions. For example, if the client said that he is not interested in us at all and there is no point in "fighting", then we will set the status "Non-targeted" in the need. If we have reached the end of the script and are ready to transfer the client to the next department, then we will set the company's status to "Lead" instead of "New". You can change any fields, not just the ones listed above
  • For the block, you can set customer response options - "Yes", "No", "Call back later", "We have a tender", "Not interested", etc. Depending on the options, you can branch the script scheme
  • While the script block is running, you can create some other elements. For example, the client agreed to give his email address - then we will immediately send him a letter from the KP. We simply indicate that a letter should be created, filled out according to the template, and sent to the client's address.

In the end, we end up with something like this:

The operator will be presented with the script processing form in human form " assistant". For example, one of the circuit blocks might look like this:

  1. The text we wrote to the operator
  2. Details that he needs to fill in this step
  3. Client response options
  4. Purpose and tasks of the script
  5. Available on each block transitions to other blocks
  6. Common Script Fields
  7. Log of selected answers

After the script scheme is created, the operator can already start calling - in the operator's workplace (if the script has the right to create), you can click on the "Create" button, select the desired script and, for example, taking the next phone number from the xls table, work on it:

At this stage, operators can already work according to the script, but there is the inconvenience of taking contacts from the table - this leads to a series of typical mistakes.

Download contacts from an Excel spreadsheet for general calling

We will upload not just companies with their contact details, but "potential deals" (aka "Leads") in the "Qualified" status. Let's set up the script in such a way that it will change the status of leads as it goes - from "Rejected" to "Appointed". Thus, we will look at the funnel for this call base.

Let's create a data loading setting:

  1. The file from which we collect data
  2. The data to be loaded into the database
  3. How will the data be loaded?

In the settings, you can specify the filling of any details of the created objects. We will create a potential deal from the company in the "Qualification" and "script execution" status - an object ready for the operator to work according to the script, fill out the project, so that later we can filter the results of the call to this database by it:

We do not fill out the operator so that everyone can see the created elements and take them into work. Created scripts will be available through operator's workplace:

Operators press the button " Next" - the system selects the next script in order and starts processing for it. Thus:

  • Operators always have "up-to-date information" in front of their eyes - there are no duplicate calls
  • Clients who asked to call back after some time are paused - such scripts are displayed in the same window with the date of the next contact.
  • Operators see the statistics of colleagues on calls - this motivates themselves to work:

Operators see their statistics in more detail:

Well, if the operators are cunning, throw complex calls ahead of time, or try to "reserve" as many scripts as possible, then you can limit the issuance of scripts using competitive rules. You can set the following restrictions:

  • No more than X scripts in Y minutes
  • After executing the script, wait X minutes
  • You can leave no more than X scripts pending

At this stage, we will have a well-developed lead base - non-core leads are screened out, and the relevant status is assigned to the core ones. The work of the operators is finished here, now the sales managers are included.

Connection to process managers.

The head of the sales department enters the directory of companies, selects only those that are qualified by calling and appoints responsible managers in transactions:

The manager enters the need for the client assigned to him and starts working according to the needs of the client. All interactions are recorded in the need card:

Analysis of results

The manager sees both the statistics of each operator and the conversion of each script:

According to the status of processed needs, you can build a funnel:

Knowledge base

In the knowledge base, you can place articles categorized. For each category, you can configure access to view and create individual users. A link to an article can be placed in the script handler.

How to use

  • Create materials about your products and place links to them in the conversation script - then your operators will be able to answer technical questions from customers
  • Place descriptions of the use of the conversation script in articles and give it to new employees for review

CRM

A small system for working with customer relationships. It includes a directory of companies (it contains a link to the counterparty if "Arrange a call!" needs to be loaded into a working configuration), contacts of these companies and potential deals. Managers work on potential transactions of counterparties, posting them according to different statuses. Sales are created for completed deals and payment is controlled. At the end of the month, the manager evaluates how many contacts were made, what remuneration is due to lead generators, and what indicators each of the managers has.

How to use

  • Keep track of statistics and analysis of customer transactions
  • Reflect all options for working with clients
  • Upload new leads to call
  • Handle "forgotten" and "lost" customers
  • Control the performance of services

Each company may contain unique details by type of activity:

For each company (and potential deal), the history of interactions is displayed:

All upcoming interactions are displayed in the "Feed", any manager has quick access to them at any time. The feed also displays comments sent to you - for example, a logistician leaves a comment "When we are delivering" in a client's request, and the person responsible for the delivery sees this in his feed.

The manager can evaluate the work of his subordinates in terms of the number of contacts with clients. How many times who called, wrote letters, communicated in the messenger, what kind of leads were interacted with.

Mail client

The subsystem provides not only sending and receiving mail. There is such a thing as a mail filter, it helps to determine what needs to be done with a particular letter. For example, you have a feedback form on your site, as soon as the user fills it out, an email with the text of the appeal will be sent to your email address. Filter in "Arrange a call!" can be configured in this way - "if the letter came from the address [email protected], then you need to get the full name, the need of the client from the text of the letter and create a new potential deal based on this data. "Thus, you can specify the rule that the letter falls under the filter and the filter actions for this letter.

For this they serve:

  • Details of the letter - additional fields of the letter, for example, "Name", "Delivery address", "Phone", "Message text"
  • Filling in the details from the letter - the rules by which the system will "get" information from the text of the letter into the details
  • Filter actions - what new email objects need to be created and how to fill them out

How to use:

  • Set up automatic collection of applications from the site and assignment of call managers according to the conversation scenario for these potential customers
  • Convert product requests (for example, they come to a specific e-mail) into a "Customer Request" document, follow the document in the right directions
  • Control the work of managers with clients by mail directly from the database

Document accounting

Allows you to fix documents in the system by their types, restrict access rights to them. For example, you can make the document type "Quality Claim" and give access to it only to the "QC" department. In this document, you will have a couple of new details, such as "Claim text", "Date of application", Result" and others. Or you can collect "Job Applications" from clients, attach files to them and pass them through statuses (" Not started", "In progress", "Calculated", "Agreed", "Refused").

How to use

  • In the settings of mail filters, you can create applications and requests for products directly from the client's letters
  • In conjunction with conversation scenarios, you can generate documents directly during the call scenario (for example, a client is dissatisfied with the quality of services - we create a "Claim", which will then be processed by the QCD department)

It looks like this:

  1. Document statuses
  2. Document type that determines the presence of details in the document
  3. Additional document details

A virtual machine that executes scripts in 1C:Enterprise.

In other words, this is the ability to write programs in 1C without using the 1C:Enterprise platform.

And this allows us to eventually take ready-made pieces of code written in the configurator and transfer them to a OneScript program with minimal adaptation.

And although, according to the developers, this is not the main goal of the project, but I see an interest in connecting from a OneScript program to the 1C database through an external connection and executing some useful code.

You ask - why is this even necessary? Why not write the same code in processing and run it through 1s in the standard way?

But we are talking about automation, and there are fundamental problems here:

  • there is no way to guarantee that the base will start and execute the code of some external processing in it (whoever has encountered this in practice knows that too much can go wrong, starting with the fact that processing simply does not reach execution due to some modal window)
  • there is no easy way to generate such processing programmatically, but we may need this when it comes to executing useful code over a group of bases
  • there is no easy way to log the execution of this processing

All these problems are solved by OneScript.

Why write and run these scripts in the updater?

Because the updater takes on a number of difficult things to simplify writing such scripts in terms of interacting with databases.

Namely.

List of bases for processing

Right in the updater, we choose for how many databases we need to run the script we wrote:

Passing base parameters

When executing the script, the updater itself passes the necessary parameters to it with information about the current database:

We can use all these parameters in our script, making it universal for execution on any number of selected bases.

We can find examples of such scripts in the list of updater templates:

Database pre-archiving

If necessary, the updater will ensure that a backup copy is created before the script is executed:

This backup will be consistent with the general archiving system, that is, it can also be "tuned" in the advanced settings of the updater. Such a copy will always be labeled "before dangerous operation".

Lock, unlock base

If necessary, the updater will perform a full database lock before executing your script and unlock after:

And this is one of the key "features" of the updater - after all, for example, the correct execution of blocking the server database in the general case is a rather non-trivial task.

It is necessary to "resolve" the current user connections, administrative connections, background tasks. And all this through communication directly with the 1c cluster.

Saving reports

The updater saves the execution history of such scripts in the report manager.

As in general terms:

So in detail:

Email notification

If you have email notifications configured (all or only on errors)...

Then information about the execution of scripts (including detailed reports) will come to you in the same way as information about the execution of other operations from the updater:

Run a script on a schedule

Cloud Monitoring

When saving the script, we also have an option for cloud monitoring of its work - an absolutely amazing opportunity in my opinion. That's about cloud monitoring.

Multi-threaded script execution

How to run the script in parallel for several databases is described in detail.

What else is useful to learn before writing scripts?

Well, of course, the 1C language itself. Where without him ...

First of all, there is this 1C language guide with examples:.

It is also worth going over the differences between OneScript and the standard 1C language. There are few of them (link).

How do I come up with my own scripts?

For inspiration, I first advise you to parse and understand the scripts from the updater templates. This will give you a lot.

And if you need an idea for writing a script that will be useful to hundreds of other users, then I ask you - write to me about it in any way convenient for you. I have a huge number of ideas, but there is not enough time and opportunities.

To do this, I started a special project on github , where I collect useful scripts from updater users so that as many people as possible can use them in their work.

Would you like to send me your script? I ask you to .

Sincerely, Vladimir Milkin(teacher and developer).