Can copy and paste same entity in other module with same Id assign to Labels
Service Studio Version
11.11.10 (Build 46736)

Hy all, 

Hope you all doing well. I am new at Outsystems and I am trying to create the same static entity in another module with the same Id but the challenge I am facing is that the Labels assigned a different Id after publishing in another module. Does it is possible in the Outsystems to have a save entity with the same Id assigned to Label? Below I am sharing a screenshot where both modules have IncidentSubCategor but the Id assigned to Labels is different after publishing.

Thank You.

Regards,

Shubham Janbandhu 

Example.jpg

Hi Shubham,

regarding static entities, each record can be identified by their label. Don't worry about the Ids being different, that also happens in real case scenarios between different environments (DEV/QA/PROD).

So if you want to update an entity that have a foreign key to a static entity, just use the Identifier associated.

i.e. IncidentSubCategory.DataIssue


Regards

Hi Shubham,


welcome to the forum.  

For Outsystems, 2 things with the same name, in another module, are 2 different things.  Outsystems has no idea that for you, these are the same.

If you want the same thing to be used in several modules, it is not a good idea to make a copy.  What you should do, is make that thing public, and then add it as a reference in your other module.  Now you can use it in both, but you only have to define it once.

So in your case, remove the static entity from Prac module.  Make the static entity public in Emp_Inctracker_Core module, publish that, then add it as a dependency in Prac module.

Dorine

Thank You, Dorine, and very appreciate your answer. But I am trying to use Rest API expose and consume method in Outsystems. I used the same structure for both applications to insert data. I exposed the POST method from another application here you can consider the Prac application but I used a different application in my Outsystem. When I am going to consume from Emp_Inctracker_Core module the data saved successfully in Prac Application module, but the entity has in Prac application, IncidentSubCategory not showing correct data that I have chosen in Emp_Inctracker_Core module. Can refer above picture and for example like, I have chosen a 'System issue' that has Id '6' in the Emp_Inctracker_Core module but in the Prac application, Id '6' has a 'Network issue' and it selects this option automatically while saving. If in Prac IncidentSubCategory will have the same Id assign to all labels then consume will work correctly from Emp_Inctracker_Core. But I failed to do that.  Is there another way I can do it?

Thank You.

Regards,

Shubham

Ok,

If you want to have loose coupling between 2 applications by having them interact with each other over a REST API, then it makes no sense to me that you would want details about the implementation of one in the other.  What if prac module changes sub categories, you would have to perform the same change in all the consumers ??

So Prac is your producer exposing a POST REST service to add incidents ???

And Emp_Inctracker_Core is consuming this POST service, and one of the pieces of information to be passed into the POST call is a SubCategory, is that it ?

What you could do, is expose another REST service from the Prac module, giving a list of categories, and have users select one from that list in consumer module.  Then you can pass the selected, with the correct id, into the POST service.

Dorine

Hi Shubham,

regarding static entities, each record can be identified by their label. Don't worry about the Ids being different, that also happens in real case scenarios between different environments (DEV/QA/PROD).

So if you want to update an entity that have a foreign key to a static entity, just use the Identifier associated.

i.e. IncidentSubCategory.DataIssue


Regards

Hy, I would like to thank you Dorine for your help and I appreciate that. I tried that but after selecting from the consumer, it was storing a blank field in the Prac module. I assigned the value but it is not taking at the time of server action from the consumer side. But I found one solution to do it. Outsystems generate Id and assign it to record at the time of publishing. So I created each record and publish it at the same time. It was assigned the same Id to records both in Producer in Consumer module. Hope you will like it. You can apply it if it is relevant. Below sharing an image of the same record with the same Id but in a different module.

Stay home and safe. Thank you.

Best Regards,

Shubham

Example.jpg

Hi Jose,

Thank you for your reply. The solution given is right but in my scenario, I am using two applications where Emp_InciTracker is consuming and Staff_InciTracker is exposing. Here both applications should have a similar structure then only I can insert data in Staff_InciTracker. Previously, SubCategory was given in both applications and was also able to insert data in Staff_InciTracker application but because of different Identifier assigned to the same label, it was chosen different label as per Id. But now I found the solution and it is working. Whatever Label selected in consume time same Label created in Staff_InciTracker. Sharing screenshot below.

Thank you.

Best Regards,

Shubham

Example.jpg


Well, first off, it is perfectly ok for you to do things others don´ t like.  There are usually several ways to do something, with their pros and cons.   

But I have to say, no I don´ t like it.  You have no control over the id, and it is not because they were accidentally correct in dev, that they will be in qa or prod, as José already pointed out.

And as for storing a blank field, that could be any number of reasons, debugging or sharing your code here could help solve that.

Dorine

The Identifier (not the Id) can be changed in design time (Service Studio) anytime, to any value you wish. So you can make both tables have the same identifiers.

Hi Jose, the method I tried is time-consuming, and one more time I applied what you suggested and it is working good and I applied this. I would like to thank you for the solution. 

Good Day. Thank you.

Shubham

Yes, Dorine, the way I choose is time taking and I tried what Jose suggested and marked it as a solution, and it's working fine. Same thanks for the help.

Regards,

Shubham

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.