Question

Send message between schemas

Hello,

how can I send messages between two schemas? For instance, I have a detail with fields that roll up to one field on the parent page. I want to send a message from this detail to the parent page to reload.

Thanks in advance!

Like 0

Like

3 comments

Hi Tyler

 

You need to use the SandBox mechanizm as follows.

 

On the detail schema you need to add message like this:

 

        messages: {

                        "UpdateFileTotals": {

                mode: Terrasoft.MessageMode.PTP,

                direction: Terrasoft.MessageDirectionType.PUBLISH

            }

        },

 

and use the Save method to send the message to the parent scgema like this:

 

        onSaved: function(response, config) {

        this.sandbox.publish("UpdateFileTotals", null, ["myTag"]);

        this.callParent(arguments);

    },

 

On the parent schema you need to add message like this:

 

                messages: {

                   "UpdateFileTotals": {

                mode: Terrasoft.MessageMode.PTP,

                direction: Terrasoft.MessageDirectionType.SUBSCRIBE

            }

        },

 

And subscribe to the Sand Box using the Init function like this:

 

            init: function(){ 

    this.callParent(arguments);

    this.sandbox.subscribe("UpdateFileTotals",this.refreshDetail , this,["myTag"]);

  

},

 

And when the function :refreshDetail is fired, you will refresh the page like this:

 

refreshDetail: function(){

               this.reloadEntity();

            },

 

Hope this helps.

 

Oren.

Hello Tyler,

 

As was mentioned by Oren, for your purpose you should use  the Sandbox mechanism. And we can confirm that the message configuration which is presented in the answer above is correct.

 

Also, in the following article you can find additional information about the module message exchange settings:

 

https://academy.creatio.com/documents/technic-sdk/7-16/module-message-exchange



Best regards,



Roman

Oren Diga,

Roman Rak,

 

Thank you!

Show all comments