How do you pass information from one JS to another

Say you had a custom field called "agent_type" so you have a directory called

custom/clients/base/fields/agent_type

and that directory has agent_type.js in it.  Now in that script it preforms some sort of check on the data in this field, say a duplicate check.  So if there is a duplicate it sets a flag in that JS

How would you get to that flag from the record.js?  That is to say what is the accepted method of accessing shared data between scripts in SugarCRM?

  • There are multiple ways. 

    1) would be to add another field via studio that can use as placeholder for the value. So in your field you can do something like this.model.set(field,<value>)

    2) In your field you can access the parent's controller by app.context.parent.controller or something similar ( i'l look it up later on). 

    3) you can add data to the session storage of the window and let the record.js periodically check that value.