How to develop a ready-to-use component.

How to develop a ready-to-use component.

  
Hi!

We have developed an application that we intend to use in many other applications. How am I suppossed to make it a ready-to-use control that we can use in our other applications?

Regards,
Nikhil Shravage.
Outsystems makes this very easy.  Once you've created the functionality in one or more eSpaces just go into the objects that you want to expose and set the Public property to Yes.  You want to take care in doing this, don't just make everything public without thinking about it.

For example, I have an eSpace that I use for all my data entities.  I want to be sure that callers call the actions that I created for each entity, not the actions created by Outsystems because my actions do additional things I need.  If I make everything public, users could bypass my actions and use the defaults.

You'll notice this technique in many of the sample applications provided by Outsystems.  Install one and you can see how it's done.
Hi Curt!

Will you please elaborate this along with an exmaple?

Thanks & regards,
Nikhil Shravage.
Hi Curt,

Thanks in Advance.

It will be helpfull for me if you explain with an example.

Thanks & Regards,
Swaroop Mutalik
Here's a simple example of what I was talking about. 

In this example I will show how entities can be shared between eSpaces in the Outsystems platform.  Once you understand this the same basic rules can be applied to other components such as Web Screens and Actions.
 
In this example we will create a SharingBackend eSpace that will store a commonly used entity, the States table.  Create the eSpace as normal and create the entity.  The entity can be static if you want it to be read only across the application or a normal entity if you allow updates to the table.
 
After creating the entity in the usual way, look at the entity properties shown Figure 1. 




There are two properties that we will discuss.  The first is the ‘Public’ property.  This tells the Outsystems platform that this entity can be used by any other eSpace.  Note that there is no additional security related to this.  It’s all or nothing.  The second is the ‘Expose Read Only’ property which is only available for normal entities, not static since you can’t update static tables.  When set to ‘Yes’, it exposes all 6 of the actions that can be performed against the entity.  When set to ‘Yes’, only the Get<entity> action is exposed, preventing updates to the entity from foreign eSpaces.  Note that the eSpace containing this entity can still call the other 5 actions to perform updates.  Be sure to publish your eSpace when completed.
 



Now we will create a SharedFrontend eSpace that will use the entity we created previously.  Create the eSpace as normal then click on Data (at the top) then right click Entities and click Add Reference Entities.  You will get the screen shown in Figure 3.




Near the top left (highlighted in Figure 3), click the dropdown where it shows ‘Show In Use’ and change it to ‘Show All’.  It should now look like Figure 4.




Scroll down until you see the SharedBackend eSpace that was published earlier and click on it.  The right side will show the public objects exposed in that eSpace.  You can select all the items or select specific ones and then click OK.  In our example we will just select the States entity as shown in Figure 5.




The SharedBackend eSpace now shows up under Entities and can be used as if it was declared locally.  I then dragged and dropped the States entity to create the web screen to show the data.  The two OML files are attached in follow up messages as I can only attach one file.

Hope this helps,
Curt


SharingBackend OML file
SharingFrontend OML file
Hi Curt,

Thanks for the valuable information shared with us,this helped us a lot.

Thanks & Regards,
Swaroop Mutalik
Thank you so much for your detailed and prompt reply Curt!