Dear Community,

 

I want to add multiple details of the same object "product in order" to the order section. My problem is that the product catalogue of the original detail does not appear when adding products in the newly created details.

Does anyone have the code to adjust this?

 

 

Like 0

Like

4 comments

Hello Markus,

 

First of all, we don't recommend adding the same details on the page more than once as they may not behave correctly.

 

The "Product in Order" detail is quite specific, and is meant to be used in one section only. You can make it visible it two different tabs. 

 

To add the same detail twice, you can create a new detail based on this object, and then add it to the page. So the detail should work correctly.

 

Regards,

Gleb.

Gleb,

Thanks for answering! If I create a detail based on the same object, unfortunately the selection page (in the screenshot above) is not transferred. Any idea how I could copy this functionality to the new detail?

Hello Markus,

 

honestly, it is quite difficult to understand where you have the issue without looking at it. You can try the following:

1. Open this detail's settings in "Order" section
2. Go to the second section where you need this detail, open Wizard, Add new detail
3. Than you can just copy the relation from the first one (like Object, columns etc.)
4. Give you detail another Name and Code, then Save.
5. Now you have the same detail as in "Orders" which is working correctly.

 

If you will still have some questions, I recommend creating a case for our support team so my colleagues will be able to help you resolve the problem as quick as possible.

 

Regards, 

Gleb.

Markus Kumpfmüller,

To begin with, you should create a new object and set  Parent Object: BaseProductEntry.

Please follow the below steps for Product Catalogue.

 

 

 

 The following dependency and code to the edit page where the detail is added. (Ex: OpportunityPageV2)

 

            Dependency: ProductSalesUtils

 

            /**Opens the catalogue page**/

            openCardInChain: function(config) {

                 if (config && !config.hasOwnProperty("OpenProductSelectionModule")) {

                     return this.callParent(arguments);

                 }

                 return ProductSalesUtils.openProductSelectionModuleInChain(config, this.sandbox);

            },

Inside the Detail Schema you need to subscribe the following messages.

                       /**

                   * @message ProductSelectionInfo

                   * ########### ######### ###### ####### ########

                   * @return {Object}

                   */

                  "ProductSelectionInfo": {

                        mode: Terrasoft.MessageMode.PTP,

                        direction: Terrasoft.MessageDirectionType.SUBSCRIBE

                  },

                  

                  /**

                   * @message ProductSelectionSave

                   * ############ ####### ######## ###### ####### #########

                   */

                  "ProductSelectionSave": {

                        mode: Terrasoft.MessageMode.PTP,

                        direction: Terrasoft.MessageDirectionType.SUBSCRIBE

                  },

 

            init: function() {

                this.callParent(arguments);               

                this.subscribeOnProductSelectionInfo();

                           },

subscribeOnProductSelectionInfo: function() {

    this.sandbox.subscribe("ProductSelectionSave", this.onProductsSelected, this, [this.sandbox.id + "_ProductSelectionModule"]);

    this.sandbox.subscribe("ProductSelectionInfo", function() {

           return {

                masterRecordId: this.get("MasterRecordId"),

                masterEntitySchemaName: this.get("DetailColumnName"),

               masterProductEntitySchemaName: this.entitySchemaName

             };

      }, this, [this.sandbox.id + "_ProductSelectionModule"]);

},

 

Important Note: You need to change the schema detail parent to "Base detail - Products". And the schema detail page to "Base edit page - Products detail".

Show all comments

Hi Team,

In the "Order" section there is a multicurrency field 'Total' and the values get auto-calculated/updated when a detail (OrderProduct) record is added/modified/deleted.

As this is a two different tables & modules, a sandbox should be used for the communication. Could you please assist us with the below queries?
1. EventHandler/Method name where the actual calculation is executed?

2. Where is the Sandbox mechanism used in OrderPageV2 & OrderProductDetailV2?

3. Which package has these client modules where the OOTB logic is written?

 

Attached the image reference,

 

 

Any insight on this would be appreciated.

 

 

BR,
Bhoobalan Palanivelu.

Like 0

Like

3 comments

Team,

Any insight on this?

Regards,

Bhoobalan Palanivelu.

One approach you can take is to add a subscriber to the detail. It is a function you can add to the detail definition to receive add/edit/delete updates from the detail. I believe that is possibly how it is working now out of the box. 

Locate the detail and add a subscriber like this: 

details: {
    ProductInProductsTab: {
        schemaName: "OrderProductDetailV2",
        entitySchemaName: "OrderProduct",
        filter: {
            masterColumn: "Id",
            detailColumn: "Order"
        },
        subscriber: { methodName: "refreshAmount" }
    }
}

Then add the function:

methods: {
  refreshAmount: function() {
    // refresh or do something since the detail has had something added/edited/deleted
  }
}

Ryan

Hi, 
This logic may be quite difficult to follow, and due to that I recommend you add breakpoints in the network to see it for yourself, but if you want a small step-by-step explanation then here it is:
When you are changing the product values the system triggers the method onBaseQuantityOrUnitChange in the schema BaseProductDetailPageV2? after it calcDiscountAmount, calcTaxAmount, and calcTotalAmount also start in this schema. Then the method saveRowChanges from the schema OrderProductDetailV2 and following the chain of methods we get to refreshAmount from BaseOrderPage and updateAmount/updateAmountFromDB from ProductEntryPageUtils. After that, triggers a modifyAmountESQ/updateAmountColumnValues from BaseOrderPage and in the end calls updateAmountColumnValues from ProductEntryPageUtils which is setting the "Amount" column.

I know I missed quite a lot of steps but it's really better to inspect this logic for yourself using breakpoints.

Show all comments

Hi Community,

We have this business requirement that consists of adding more than one Value for a specific Feature. For example, if we consider “Colour” as a Feature, we will need multiple Values for that Feature.

 

Colour – Blue

Colour – Orange

 

However, when we try to add another value for the same feature, we receive the following error:

Currently, Creatio only let us add a unique Feature. This logic is not compatible with our requirement.

 

How can we turn off this constrain? And, what are the consequences of disabling it?

 

Thank you in advance.

 

Best Regards,

Pedro Pinheiro

Like 0

Like

1 comments

Hello Pedro!

 

Unfortunately, there is no way to achieve this with built-in instruments, as it is expected that there would be a different product record for each feature so that when adding them into orders you can determine exactly what feature set is required.

 

However, you can do this by creating a "Replacing view model" for the "SpecificationInProductPageV2" schema. There, you would only need to change the "validateSpecification" function by removing the following part:

 

After that, you will be able to add multiple features into products!

 

Best regards,

Max.

Show all comments

Hi Team,

 

We have a scenario to display only few products when the add (+) icon is clicked in the Product detail of Order section. When the add record is clicked a product catalogue is displayed.

Required Filter Scenario:
All the products that belong to a particular price list alone should be shown in the product catalogue list along with additional columns in the Product Price table is also taken into consideration for the filter.

 

Only Products that match the below conditions should be displayed in the list,

  1. Particular Price List.
  2. Particular column value in Product Price (Custom Column ex: UsrProductGrade).
  3. Particular column value in Product Price (Custom Column ex: UsrIsActive).

 

Required Default Value in UOM Lookup:

When the product catalogue page is opened the UOM (Unit of Measure) field should be set with a particular lookup value by default available in that lookup & set to locked (not editable).

 

Filter out/Remove/Hide all product's base prices in the product catalogue

Don't want any base price in the product price and not needed to show this record in the product catalogue.

 

Below is the setup for the above case:
Step 1: Filter applied in ProductSelectionSchema (Not Working)
 

getProductInBasePriceListEsq: function(basePriceList) {
			var basePriceListProductEsq = this.getBaseESQ("Product");
 
			var customPriceList = Terrasoft.SysSettings.cachedSettings.UsrcustomPriceList;
 
			var productPricePrefix = "[ProductPrice:Product:Id].";
			basePriceListProductEsq.rowCount = 40;
			var productGrade = this.sandbox.publish("productGradeMessage", null, "productFilterGradeMessage");
 
			basePriceListProductEsq.addColumn("Price", "ProductPrice");
			basePriceListProductEsq.addColumn(productPricePrefix + "Price", "Price");
			basePriceListProductEsq.addColumn(productPricePrefix + "Currency", "Currency");
			basePriceListProductEsq.addColumn(productPricePrefix + "Tax", "Tax");
			basePriceListProductEsq.addColumn(productPricePrefix + "Tax.Percent", "DiscountTax");
			basePriceListProductEsq.addColumn(productPricePrefix + "PriceList", "PriceList");
			basePriceListProductEsq.addColumn(productPricePrefix + "UsrProductGrade", "UsrProductGrade");
			basePriceListProductEsq.addColumn(productPricePrefix + "UsrIsActive", "UsrIsActive");
 
			//Additional Filters for Grade and Active product
			basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
				this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "PriceList.Id", customPriceList));	
			basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
				this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "UsrProductGrade", productGrade.value));
			basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
				this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "UsrIsActive", true));
 
			this.applyAdditionalFilters(basePriceListProductEsq);
			this.initializePageableOptions(basePriceListProductEsq);
			basePriceListProductEsq.filters.addItem(
				this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL,
					"IsArchive", false));
			return basePriceListProductEsq;
		},

 

Step 2:  Made the value "Base" inactive from pricelist lookup (still all the products base price list is shown).

 

None of the filters applied is working. Instead, it shows the products that are matched with new pricelist value in the pricelist lookup for other products which doesn't has new value it takes the base price list and displays.

Any insight on this would be highly appreciated!

 

 

BR,
Bhoobalan Palanivelu.

Like 0

Like

8 comments

Hello Bhoobalan,

 

Maybe it's much easier to modify the logic of the onGridDataLoaded method in the ProductSelectionSchema module and modify the final gridData collection that will be displayed? When the grid data is loaded in the context of execution of this method you can check all records loaded to this selection page one by one and check whether they have the needed price list (and if so leave it in the grid data, othewise remove this record from grid data) and also you can apply modifications to such records (like setting the default unit of measure). Because creating custom ESQ that is asynchronous can result in inconsistent behavior and also to errors when loading the grid.

Oleg Drobina,

 

It would be of great help if you could assist with a simple sample for this case in the Product selection schema.

And how to set a default value for a Unit Of Measure field and make it locked?

BR,
BBhoobalan Palanivelu.

Bhoobalan Palanivelu,

 

to lock the "Unit Of Measure" column you need to override the getEditableColumns method in the ProductSelectionSchema module. For example like in the example below:

getEditableColumns: function() {
				let parentColumns = this.callParent(arguments);
				if (this.Terrasoft.isCurrentUserSsp()) {
					parentColumns = this.Terrasoft.without(parentColumns, "Price");
				}
				parentColumns = this.Terrasoft.without(parentColumns, "Unit");
				return parentColumns;
			},

As a result you won't be able to modify the Unit Of Measure" column.

 

As for settings the removing some results from the grid: for example I have two products in the selection window: one has the price of 900 and another one has the price of 100. I want to remove the product with the price that is less or equal 100. To do so we override the onGridDataLoaded method in the following manner:

onGridDataLoaded: function(response) {
				if (!response.success || response.queryResults.length === 0) {
					return;
				}
				var dataCollection = this.Ext.create("Terrasoft.Collection");
				this.prepareResponseCollection(dataCollection, response);
				var lastValue = null;
				var gridData = this.getGridData();
				var canLoadData = false;
				for (var i=0; i < dataCollection.getItems().length; i++) {
					var price = dataCollection.getItems()[i].values.Price;
					if (price <= 100) {
						dataCollection.removeByIndex(i);
					}
				}
				if (dataCollection.getCount()) {
					var lastItemIndex = dataCollection.getCount() - 1;
					var lastItem = dataCollection.getByIndex(lastItemIndex);
					var products = gridData.collection.filterBy(
						function(res) {
							var resId = res.get("RealRecordId");
							return resId === lastItem.get("RealRecordId");
						}
					);
					if ((products.length <= 0)) {
						lastValue = lastItem.get("Name");
						canLoadData = true;
					}
				}
				this.set("sortColumnLastValue", lastValue);
				if (canLoadData) {
					gridData.loadAll(dataCollection);
				}
				this._updateGridCaptionContainerVisibility();
				this.set("GridData", gridData);
			},

the main body of the method is a basic body and the customization here goes at:

for (var i=0; i < dataCollection.getItems().length; i++) {
					var price = dataCollection.getItems()[i].values.Price;
					if (price <= 100) {
						dataCollection.removeByIndex(i);
					}
				}

where we prepare received data collection for further basic processing. So you can test this approach on your side.

Oleg Drobina,

Appreciate the detailed response!

How shall we set some particular/specific value as the default value to this Unit Of Measure (UOM) lookup field?

We have locked it in getEditableColumns() and how does the logic go by to set a default value?

Best Regards,
Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

 

this is the custmization inside the onGridDataLoaded method, but additionally to the previous removal of records we will need to set the value for the "Unit of measure" column for each record after the unnecessary records are removed from the dataCollection.

Oleg Drobina,

Thanks for the response!

Still, the filter remains not to work even with the logic of removing values from the collection in OnGridDataLoaded().

 

The code gets executed but still, the products with 0 prices are shown in the Grid. please find the below references.

 

Logic es executing:

 

All records are again loaded into the Grid 

 

 

BR,
Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

 

I've checked and indeed it happens in case there are two records with the price = 0 that are located one after another in the dataCollection (for example the 0 item has 0 price and the 1st item has 0 price). It happens because the logic removes an item with the 0 index (i=0), as a result an item with the 1 index is moved to the 0 index (because the original item with 0 index was deleted) and since we are in a cycle the code goes to check the item with the 1 index and skips that item that moved to the 0 index.

 

Perhaps this dataCollection should be processed in terms of a separate collection and then this custom collection should be placed into the dataCollection.

Oleg Drobina,

Yes, Now we were able to remove all the products where "Price = 0".

Also, how to make a filter to the grid products?
Unable to set the Default Value for the UOM field.

BR,
Bhoobalan Palanivelu.

Show all comments

Hi Team,

I would like to modify the filters for the list of Product Displayed while adding products in OrderProduct (In Order record).

 

Step 1: How does the add button event open ProductSelectionSchema?

Step 2: Need to update the filters in ProductSelectionSchema?

The Product selection schema has "loadGridData" method that calls "getProductInBasePriceListEsq" where the BasePriceList is taken and filtered.

Also, in OOTB the Account and its price list are sent to ProductSelectionSchema and how do the values are transferred?

 

Below are the filters required,
1.Dont need to display any base price list for any products.
2.Filter the Product Price List only if it has start date.
3.Filter the Product Price List only if end date is empty or null.
4.Need an additional parameter to filter the Product (price list table, column is grade).
i.e., Grade column value is passed from Order page and it has to be compared in ProductSelectionSchema.

Note: Date filters or other filters are not applying and it always shows the base price list. And how to get the values from OrderPageV2 to ProductSelectionSchema (if it is through message mechanism, how the OOTB Account and its pricelist is transferred and what are the schemas and where it is defined both subscription and publish of basepricelist)

define("ProductSelectionSchema", [],
function() {
return {
    methods: {
      init: function(callback, scope) {
            this._initViewActionItems();
            this.set("CurrentDataView", "GridDataView");
            this.set("DataViewToChange", "GridDataView");
            this.moneyModule = MoneyModule;
            this.initAttributeDefaultValues();
            this.callParent([function() {
                this.Terrasoft.chain(
                    this.initEntitySchema,
                    this.initProfile,
                    this.requestMasterEntityData,
                    this.loadCurrencyRates,
                    this.initCurrencies,
                    function() {
                        this.loadGridData();
                        this.subscribeSandboxEvents();
                        this.Ext.callback(callback, scope);
                    },
                    this
                );
            }, this]);
        },
 
 
    getProductInBasePriceListEsq: function(basePriceList) {
        var basePriceListProductEsq = this.getBaseESQ("Product");
        var productPricePrefix = "[ProductPrice:Product:Id].";
        basePriceListProductEsq.rowCount = 40;
 
        basePriceListProductEsq.addColumn("Price", "ProductPrice");
        basePriceListProductEsq.addColumn(productPricePrefix + "Price", "Price");
        basePriceListProductEsq.addColumn(productPricePrefix + "Currency", "Currency");
        basePriceListProductEsq.addColumn(productPricePrefix + "Tax", "Tax");
        basePriceListProductEsq.addColumn(productPricePrefix + "Tax.Percent", "DiscountTax");
        basePriceListProductEsq.addColumn(productPricePrefix + "PriceList", "PriceList");
        basePriceListProductEsq.addColumn(productPricePrefix + "DBLStartDate", "StartDate");
        basePriceListProductEsq.addColumn(productPricePrefix + "DBLEndDate", "EndDate");
        basePriceListProductEsq.addColumn(productPricePrefix + "DBLProductGrade", "DBLProductGrade");
 
        basePriceListProductEsq.filters.addItem(this.Terrasoft.createFilter(this.Terrasoft.ComparisonType.EQUAL,
            productPricePrefix + "Product.Id", "Id"));
        basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
            this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "PriceList.Id", basePriceList.value));
 
        /*basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
            this.Terrasoft.ComparisonType.LESS_OR_EQUAL, productPricePrefix + "DBLStartDate", today));
        basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
            this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "DBLEndDate", null));
 
            Need Filters
            1.Dont need to display any base price list for any products.
            2.Filter the Product Price List only if it has start date.
            3.Filter the Product Price List only if end date is empty or null.
            4.Need an additional parameter to filter the Product (price list table, column is grade).
            i.e., Grade column value is passed from Order page and it has to be compared in ProductSelectionSchema.
 
 
        */
 
        basePriceListProductEsq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(
            this.Terrasoft.ComparisonType.EQUAL, productPricePrefix + "DBLProductGrade", productGrade.value));
 
        this.applyAdditionalFilters(basePriceListProductEsq);
        this.initializePageableOptions(basePriceListProductEsq);
        basePriceListProductEsq.filters.addItem(
            this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL,
                "IsArchive", false));
        return basePriceListProductEsq;
    },
    },
    diff: []
};
});

Any support on this case is appreciated!

BR,
Bhoobalan Palanivelu.
 

Like 0

Like

3 comments

Hello Bhoobalan,

 

Regarding the first question, the add button is defined in the ProductDetailV2 schema from the ProductCatalogue package. In this part:

onProductSelectionButtonClick: function() {
					var isCardChanged = this.isCardChanged();
					if (isCardChanged) {
						var args = {
							isSilent: true,
							messageTags: [this.sandbox.id]
						};
						this.set("OpenProductSelectionModule", true);
						this.sandbox.publish("SaveRecord", args, [this.sandbox.id]);
					} else {
						this.loadProductSelectionModule();
					}
				},

 

Regarding the second part where you need custom filters, pleast contact us at support@creatio.com specifying each request and each question in detail in order to understand the business task and what is the current issue.

 

Best regards,

Dariy

 

Dariy Pavlyk,

Thanks for sharing this!

 

Is it possible to make the Product object in the Opportunity section (OpportunityProductInterest) to open the product catalogue?

What are the steps to be carried out to make this OpportunityProductInterest open the product catalogue list?

 

BR,

Bhoobalan Palanivelu.

 

Bhoobalan Palanivelu,

 

We're glad to see that you were able to achieve this functionality as mentioned in these articles

https://community.creatio.com/questions/enable-product-catalog-list-ord…

https://community.creatio.com/questions/enable-product-catalog-list-ord…

 

Unfortunately, as it's mentioned there, it wouldn't be possible to set up a product catalogue using our OOTB object, as it is already implemented for other functionalities. 

 

Best regards,

Dariy

Show all comments

Hi Team,

In Order section, we can place an order against an "Account".
In "Account" we can set a price list for a particular account.

While adding products in the Order section for a corresponding account, the products are displayed based on the price list column set in that account. This is achieved by calling a web service "PriceListService".

PriceListService.cs

	[OperationContract]
		[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,
			ResponseFormat = WebMessageFormat.Json)]
		public Guid GetPriceList(Guid accountId) {
			var priceListPicker = ClassFactory.Get<IPriceListPicker>(new ConstructorArgument("userConnection",
				UserConnection));
			var	preSetPriceList = priceListPicker.GetPriceList(accountId);
			return preSetPriceList != default(Guid)
				? preSetPriceList
				: priceListPicker.GetPriceList(UserConnection.CurrentUser.AccountId);
		}

But which client module is calling this web-service while adding products?

The responsible module must be an order product detail schema or page or the base page in this hierarchy. Please guide me on the module and the place where the web service is called.

BR, 
Bhoobalan Palanivelu.

Like 0

Like

5 comments

That service is being called from BaseOrderPage. In that schema there is a function that calls it named "initializePredefinedPriceList" (the actual service being called is defined in "getPriceListServiceConfig")

Ryan

Ryan Farley,

Thanks, Ryan!

Hopefully, this Base Order page is allowed in Replacing View model. It can override the getPriceListServiceConfig calling method and define a custom web service to filter the products with custom parameters.

BR,
Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

Yes, you should have no issue creating a replacing schema for BaseOrderPage and then override the methods as needed.

Ryan

Ryan Farley,

Thanks!

When the (+) is clicked in Product detail (in the order section) it opens a Product List page though the detail is editable. Where is the code for add record icon and it's not available in "OrderProductDetailV2" ? and how does this product list page is opened (ProductSelectionSchema).

Step 1: Which client schema page has this add event?

Step 2: How does the Account & Price List filter is applied to Product List page.

Insight on the Schema's name and the place where the code triggering the corresponding action will be helpful.

BR,
BHoobalan Palanivelu.

Bhoobalan Palanivelu,

Hello Bhoobalan

Please do you have a suggestion on how to implement the Product Catalog that appears in the order Section, for opportunity Products in Opportunity section. Your suggestions are much appreciated !

Show all comments

Dear Creatio community,

 

we are looking for a way for adding a position number to product positions in invoices and orders.

Is there any out of the box solution that we don't know of or did you implement your own logic for this issue?

 

Thanks a lot

Markus

Like 0

Like

2 comments
Best reply

Hello Markus,

This feature is available in 8.x sections and pages OOTB in Application Hub. You should create an Application and add sections and pages based on existing objects. The "list" tool will help you to achieve the needed list view.

 

In the 7.x pages - there is no no-code solution, you would need development to add numeration to OrderPageV2 and InvoicePageV2 details.

 

I hope my answer was useful for you!

 

Best Regards,

Dan

Hello Markus,

This feature is available in 8.x sections and pages OOTB in Application Hub. You should create an Application and add sections and pages based on existing objects. The "list" tool will help you to achieve the needed list view.

 

In the 7.x pages - there is no no-code solution, you would need development to add numeration to OrderPageV2 and InvoicePageV2 details.

 

I hope my answer was useful for you!

 

Best Regards,

Dan

Thank you very much! 
We will test it out :)

Show all comments

Hi community,

 

Some of our new orders (usually the maintenance orders) need to include some existing products in other orders (the previous maintenance orders or new purchase order) of the same account. I want its behavior like in adding product in order page (all products from another specified existing order were listed already, you can just edit multiple records and save), then these "selected products" (with quantities>0) will be added to this new order.

 

Thanks in advance.

Andrew

Like 0

Like

2 comments

Hi Andrew, 

 

Thank you for the question, but it is quite hard to understand without an example or more details. Can you please provide some test examples (with orders and products) for us to see how you would like to use this functionality? 

 

Best Regards,

Igor

Ihor Skohariev,

For example, I have an account "Streamline Development" that placed an order (ORD-14) in 2019.

This year she wants to place a maintenance order whose products will include some items in ORD-14.

In this case, what would you do? (Ususally, the maintenance order will include hundreds of items that from the previous orders' products)

Show all comments

Hi everyone,

I'm looking for a way to customize the Add order based on opportunity BP.

I added some fields to the 'product in opportunity' object, like: discount amount, discount %, semester and schoolyear. Added semester and schoolyear to the product in order object too (discount amount, discount % fields are already exist there).

Now, I want these values to be copied when creating an order from an opp, just like the other fields of the product in order do.

I found this process does the order and creates the products  
https://beable.creatio.com/0/Nui/ViewModule.aspx?vm=SchemaDesigner#process/be82d4e0-4638-4058-975d-050a3dcff8b5

but don't know how to extend the script there (the script that adds the products in on the Adding opportunity products to order  element. 

Is there a way to get to the function that are being executed in that script?

Adding the element's script here.

Thanks in advance,

Chani

if (ProductItems.ToString() != "" || IsCopyAllProduct) {
	var copyProductsOperation = Factories.ClassFactory.Get<
		Terrasoft.Configuration.CopyOrderProductsFromOpportunityOperation>(
		new Factories.ConstructorArgument("userConnection", UserConnection));
	copyProductsOperation.Execute(new Terrasoft.Configuration
		.CopyOrderProductsFromOpportunityOperation
		.CopyOrderProductsArgs {
			OpportunityId = CurrentOpportunity,
			OrderId = NewOrder,
			IsCopyAllProducts = IsCopyAllProduct,
			ProductItems = ProductItems
	});
}
return true;

 

Like 0

Like

4 comments

Hi Chani,

 

You can create your own process and modify the script-task in the way you need or you can copy products from the opportunity to the created order using the "Add data" process element and the sub-process that will receive a collection of OpportunityProduct records.

 

Now step-by-step:

 

1) In the OpportunityOrderUtilities schema there is the CreateOrderFromOpportunity method that is called upon clicking the "New order" button on the opportunity page:

 

this is the code of the button:

and here is the method itself:

As we can see here the method reads the value for the system setting with "CreateOrderFromOpportunityProcess" code. By default the value for this system setting is "Add order based on opportunity":

So we can place any process with the simple start signal there.

 

2) You can either create your own script task in the newly created process (use the code from the original OOB process as an example or paste it and extend in the new process). Or in the new process you can use the collection of records read from the OpportunityProduct object and if the number of records is greater than 1 you can pass this collection to the sub-process that will add data to the created order (the object is OrderProduct).

 

So you need to select one of these two options: either extend the script-task or use the collection of records and a sub-process.

 

Best regards,

Oscar

Oscar Dylan,

Thank you.

But I do want to use the option of selecting products (see pic), how can I have that and get the products list to use in the add data element?

I tried looking in the  Add order based on opportunity BP, but I only see a text parameter for products list.

 

Chani Karel,

 

This is a part of the showProductDialog method of the same OpportunityOrderUtilities module. This will be called regardless of if the process is changed or not. Once products are selected, they are passed to the runProcessCreateOrder method. The list of selected products will be passed as an array of ID's to the process:

 

Best regards,

Oscar

Oscar Dylan,

Thanks

Show all comments

The system is not respecting the price list registered for the account. I currently work with more than five price types for the same product.
The price list was registered and linked to the specified account, but when starting a new order for the account, it does not load the value referring to the list, but a base value.

Would have any tips or step by step to check this situation.

Like 0

Like

1 comments

Hello Alisosn!

Could you tell me some more information about that issue? What do you see on the page and what is the expected result? That would help us to solve the problem,

Best Regards,
Tetiana Bakai

Show all comments