I wanted to implement an auto-incrementing "Code" field for the "Opportunity" section. I managed to do so following the documentation (https://academy.creatio.com/documents/technic-sdk/7-16/how-add-auto-num…). I just have a problem that I can't solve right now, everything works but when the Client create a new opportunity and then cancels it (clicks on the button "Cancel" and tries to add a new opportunity again, the auto-incrementation is done but I don't want so. I want that the Code increments only if the opportunity related to the previous code already exists in the "Opportunity" section.
And coming back to the previous quesion on how to move the auto-numbering logic the object level: for that you can try to create an event in the needed object which will be saved according to your configurations, for example, it's event of saving the record. For that you need to go to Advanced settings and find the needed object, then open it and go to the "Events" item and add the needed event there:
In your task it should be "After Record Saved" (OpportunitySaved). Than you need to save changes (click "Save" button) and in the same object click the "Open Process" item (on the top bar). After the process designer will be opened you will be able to create a process which will be triggered by the newly created event (in our example, when the Opportunity record will be saved). For that you need to add the "Event sub-process" element and set Message as OpportunitySaved (your event).
Once it's done you can add the script task/code which is responsible for auto-incrementing logic:
So after that, the object process will be triggered every time after the Opportunity record was saved and your custom code will assign the needed number to that record.
More useful infromation can be found in our Academy in the links below:
For the task, you have described the auto-numbering logic should be moved to the object level, so the user will receive the appropriate number after saving that record. First of all, you can try to replace the method in JS responsible for auto-numbering entries on the page. Also as an option, there can be created the SQL trigger for new records.
Additionally, for your business task, you can try to use the "Numerator for Creatio" add-on. Using this addon the system will form the number automatically according to your own preferences and settings.
How could I change the auto-numbering logic to be moved to the object level so that the user will receive the appropriate number only after saving that record and not when creating a new record ?
I'm new to the dev side in Creatio, sorry for that. In a normal code situation, I could just compare if the UsrCode already exists in my opportunites and if it already exists I don't increment the UsrCode. But how to do that with objects in Creatio ? An example could be really useful.
Why would I need to replace the method in JS for auto-numbering entries on the page ? Why could it be useful in my case ?
I basically only need to add the Code number and increment it only if the user saves the record, otherwise I don't want to increment it. Isn't there a method like "this.isAddMode" for the "Cancel" button ? (like if(this.cancel) { do something } or, with the same logic, this.save ?
If you have a coding solution with some examples to help me out I would be grateful :)
I'm trying to use the "Numerator for Creatio" add-on and it is really great ! However I encounter the same problem as before, when a user cancels the opportunity it continues to increment the number.
Furthermore, if you look at this screenshot :
I want that my text field "SOT-" to be static, but my "Sequence number" field to be dynamic and it must auto-increment every time a user saves the opportunity. Furthermore, why does the sequence number start at "00012" and not "00000" ? Any suggestion ?
Thanks really a lot for the help you are providing ! :)
And coming back to the previous quesion on how to move the auto-numbering logic the object level: for that you can try to create an event in the needed object which will be saved according to your configurations, for example, it's event of saving the record. For that you need to go to Advanced settings and find the needed object, then open it and go to the "Events" item and add the needed event there:
In your task it should be "After Record Saved" (OpportunitySaved). Than you need to save changes (click "Save" button) and in the same object click the "Open Process" item (on the top bar). After the process designer will be opened you will be able to create a process which will be triggered by the newly created event (in our example, when the Opportunity record will be saved). For that you need to add the "Event sub-process" element and set Message as OpportunitySaved (your event).
Once it's done you can add the script task/code which is responsible for auto-incrementing logic:
So after that, the object process will be triggered every time after the Opportunity record was saved and your custom code will assign the needed number to that record.
More useful infromation can be found in our Academy in the links below:
You reply is just awesome. Really. It will help me with more than a problem for the implementation of future things ! It's really smart to do a sub-process with a script so that the script is triggered only when a certain action is done.
Last question, in the script code task, how could I implement the same logic ? I can't get the value of the "UsrCode" field for instance or I can't use the this.getIncrementCode method because i'm not overriding the Terrasoft.BasePageV2 getIncrementCode method. I can't add a field to read the data too to get my UsrCode. How can I get all these values to implement my auto-incrementation logic ?
string name = string.Empty;
string email = string.Empty;
Guid RecordId = Guid.Empty;/**
* This approach should not be used in production
* Please create process parameters and set values with standard tools (i.e. Formula)
* ReadDataUserTask1 is the Code of "Read One Contact" element
*/
var re = context.Process.FindFlowElementByName("ReadDataUserTask1").GetPropertyValue("ResultEntity");if(re.TryGetPropertyValue("Email", out object _email)){
email = _email.ToString();}if(re.TryGetPropertyValue("Name", out object _name)){
name = _name.ToString();}if(re.TryGetPropertyValue("Id", out object _id)){if(Guid.TryParse(_id.ToString(), out Guid Id)){
RecordId = Id;}}//Set values to process parameters
Set<string>("Name", name);
Set<string>("Email", email);
Set<Guid>("RecordId", RecordId);returntrue;
Did you read the Installation > Guides and manualsRead Manuals on the marketplace page?
1. Register at Aspose.PDF service (https://products.aspose.cloud/pdf/net), add an application (My Apps> Add an App), get access keys (Client Secret, Client ID).
2. Fill in the system settings "Aspose API Access Key" (= Client Secret) and "Aspose Security Identifier (App SID)" (= Client ID) with the data from item 1, respectively. Logout and login to the Creatio app again.
3. Go to System Designer > Lookups > the ‘Printables’ lookup, select the printable, and open the printable setup page, select the ‘Convert to PDF’ checkbox and save changes. Note that the ‘Convert to PDF’ checkbox is available only on the printable setup page in the new UI.
4. The add-on shows an error message if a printable conversion fails on the Aspose side (Aspose service is unavailable, service access is not paid, etc.). Detailed error description is available in the browser console.
You can find an example of the Aspose API library call from Creatio in the 'AsposeCloud' package. Additional information on Aspose API SDK is available here - https://products.aspose.cloud/pdf/net.
The responsible team checked that the Aspose connector uses Aspose.Words.Cloud.Sdk.dll, which does not include the method that you need. You can find the description of the .Pages.Add() method that you need here: https://docs.aspose.com/pdf/net/merge-pdf-documents. Please install the required library and follow the Aspose official guidelines.
We have asked the team about possible development assistance, unfortunately, they cannot assist.