Hi community,

I have a custom button in the product in order detail action menu.

When I click this custom button, I want it to save the parent order page before it continue to do other work.

How may I get the master record and save? Is it like this.parent.save() or something else?

Thank you!

Like 0

Like

2 comments
Best reply

Oleg Drobina,

Thank you Oscar, it works! I provide my codes below:

onButonClick2: function() {	  
  var config = {
	  sysProcessName: "UsrProcess_46b3b57Dynasafe11",
	  parameters: { 
		  ProcessSchemaRecordID: this.get("MasterRecordId")
	  },
	  callback: function() {
		  this.reloadEntity();
		  Terrasoft.showInformation("The process has completed.");
	  },
	  scope: this
  };			  
  var args = {
	  isSilent: true,
	  messageTags: [this.sandbox.id],
	  callback: function() {
		  ProcessModuleUtilities.executeProcess(config);
	  }
  };
  this.sandbox.publish("SaveRecord", args, [this.sandbox.id]);				  
},

 

Hi Andrew,

 

Probably this approach can save the master record of the detail, but it should be tested (taken from the examples in the BaseGridDetailV2):

const args = {
					isSilent: true,
					messageTags: [this.sandbox.id]
				};
				this.sandbox.publish("SaveRecord", args, [this.sandbox.id]);

 

Oleg Drobina,

Thank you Oscar, it works! I provide my codes below:

onButonClick2: function() {	  
  var config = {
	  sysProcessName: "UsrProcess_46b3b57Dynasafe11",
	  parameters: { 
		  ProcessSchemaRecordID: this.get("MasterRecordId")
	  },
	  callback: function() {
		  this.reloadEntity();
		  Terrasoft.showInformation("The process has completed.");
	  },
	  scope: this
  };			  
  var args = {
	  isSilent: true,
	  messageTags: [this.sandbox.id],
	  callback: function() {
		  ProcessModuleUtilities.executeProcess(config);
	  }
  };
  this.sandbox.publish("SaveRecord", args, [this.sandbox.id]);				  
},

 

Show all comments

Hi community,

I made a custom button in the product in order detail action menu.

In this button onClick event, I called a business process and had to pass the order's id to it.

How do I get the order id from within the product in order detail schema so that I can pass it to the business process?

 

Thank you!

Like 0

Like

2 comments
Best reply

Hi,

 

You can use:

this.get("MasterRecordId")

to get the master record Id value and use it in the click handler method.

Hi Andrew,



1. You can pass OrderProductId to the process and read OrderId from OrderProduct



2. You can call process from OrderProductDetailV2 with such a code:



            runMyBusinessProcessAll: function() {

                ProcessModuleUtilities.executeProcess({

                    "sysProcessName": "UsrMyProcess",

                    "parameters": {

                        "OrderId": this.get("MasterRecordId")

                    }

                });

            },

Hi,

 

You can use:

this.get("MasterRecordId")

to get the master record Id value and use it in the click handler method.

Show all comments