Good day.

I am new to BPM Online(And C#). I just registered a 14 day free account to try it out.

I want to use the sub process to create a case number when a new record is created on a section. Please see the image below:

When the new record is saved the process starts and reads the zone filed from the request record as depicted below:

Upon reading the zone field I then assign the zone filed to the zone process variable using the formular task as depicted below:

I then use the zone process variable to formulate the case number in the code script as depicted below:

string unique_numer =  DateTime.Now.ToString("yyMMddhhmmss");
string  zone_val = Get<Guid>("zone").ToString();
string case_number=(zone_val+"-"+unique_numer)
 
Set("case_number",case_number);
return true;

The challenge I am facing is to get the value of the selected lookup zone field to store the value into zone_val string filed.

How to get the selected value from the zone lookup filed using C# code. The value that I get is a Guid data type and cannot get the value of the lookup.

I need to store the generated CaseNumber to the case_number field in the database as depicted below:

You help will be highly appreciated as I am currently stuck.

 

Like 0

Like

4 comments

Dear Tebogo,

You may create a system setting that will store this number and use it in the future number generation. You can find detailed example here: https://academy.bpmonline.com/documents/technic-sdk/7-13/how-add-auto-n…

Best regards,

Angela

Assuming you want the field name in the Zone Table : 

var uc = Get&lt;UserConnection&gt;("UserConnection");
 
Guid zoneId = Get&lt;Guid&gt;("zone");
 
var esq = new EntitySchemaQuery(uc.EntitySchemaManager.GetInstanceByName("Zone"));
esq.AddColumn("Name");
var entity = esq.GetEntity(uc, zoneId );
string zoneName = entity.GetTypedColumnValue&lt;string&gt;("Name");

 

Angela Reyes,

Thank you very much Angela.

Jerome BERGES,

Thank you very much Jerome, highly appreciate it!

Show all comments

I am trying to add an auto-numbering field on Opportunity.

https://academy.bpmonline.com/documents/technic-sdk/7-13/how-add-auto-numbering-edit-page-field

I successfully did this with the Product object just like the guide said. It was very easy.

But when I try to do the same thing on Opportunity, there are some differences. Opportunity does not have the inherited Code –property or the methods called in the code under onEntityInitialized()

I have only tried the client-side solution.

Best regards,

Like 0

Like

6 comments

Hi, Julius!



As you have your own field in Opportunity (e.g. "UsrCode"), so you can use:



    onEntityInitialized: function() {

                 // onEntityInitialized method parent realization is called.

                this.callParent(arguments);

                // The code is generated only in case we create a new element or a copy of the existing element.

                if (this.isAddMode() || this.isCopyMode()) {

                    //  Call of the Terrasoft.BasePageV2.getIncrementCode base method, that generates the number 

                    // according to the previously set mask. 

                    this.getIncrementCode(function(response) {

                    // The generated number is stored in [Code] column.

                        this.set("UsrCode", response);

                    });

                }

            }

Dear Julius,

Since opportunity section does not have an existing Code column, you can create one using means of section wizard.

No special methods needed for new column, since we are calling parent realization in the onEntityinitialized method, which has the logic of working with auto incrementing. Just be sure to indicate your custom column in the this.set method by its name, but not title.

As for the back end realization of the auto incrementing, follow the instructions just the same, but indicate name of the custom column.

Regards,

Anastasia

 

Anastasia Botezat, Vladimir Sokolov,

I tried this again. But it's not working. No value gets set.

I have created the System Settings, the Property on Opportunity, And I have adjusted the JavaScript to have the correct string value, "UsrCode".

It's not working this time either. Is the on-client method unavaliable on the Opportunity object?

Maybe the Opportunity object does not know the Systems Settings i Created. The system settings code names are : OpportunityLastNumber and OpportunityCodeMask

UPDATE : It is working while using Copy. But no Code is set when adding an Opportunity with the Mini-Page. I am now working on this. Any advice appreciated.

UPDATE 2 : Creating and Copying works as long as I do not have a Mini-Page. I tried to add the same JavaScript in the MiniPage methods{}. But that's not working. Any tricks to use MiniPages?

Julius,

The auto increment logic is not a part of basic mini page logic. The 

getIncrementCode method is written on the BasePageV2. However, mini pages are inherited from BaseMiniPage, which does not have such method.

You can add the getIncrementCode method realization to the mini page, so that it will execute the logic. 

As for the back-end part, the changes are displayed on the client side only after record is saved. Therefore, it is impossible to view the code value on the opportunity page immediately. 

Regards,

Anastasia

Anastasia Botezat,

 I did not get this to work with Mini-Page. I have anyway decided to work without the mini-pages. When Creating a Opportunity I just get the regular edit page where the incremented numbers work fine. Thank you.

Anastasia Botezat,

Hi,

This dint worked  even to me. 

https://community.bpmonline.com/questions/auto-increment-issue

I have posted the issue in detail in the above link. Please help!!!!

regards,

Sriraksha

Show all comments