Displaying Message Box using C#

Hi!

 

I am currently working on a functionality that overrides and defines what needs to happen when clicking a button on a detail.

 

This means I am working on a "Source Code" type of file within the configuration, so only C# code involved.

 

I have some trouble debugging the code to see what's wrong besides this message that pops up:

 

I haven't found any debugging tips specifically for this type of "file"/task and I would like to display message boxes with values of variables and so on, just like the one above.

 

I know there is a way to achieve this using business processes and JS code inside the client module, but I haven't found any solution to programatically display this using C# code.

 

Can someone refer me to the class/library where this is located exactly?

 

Thanks,

Laurentiu

Like 1

Like

4 comments

Hello Laurentiu,

 

C# cannot be used to display the popup directly. What can be done is send a websocket message to the client side and display the popup when a websocket message is received. Like described here, but in the onNewMessage method you need to call this.showInformationDialog method (just check how it's called out-of-the-box) and pass the message to it.

If this is a local system you can use debugging with your C# code, see https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

If this is a cloud system, sending messages to the UI to display a message box isn't the best route since the message boxes aren't blocking, meaning if your code sends 3 messages, only the last one will show in the message box, plus it means you have to add client-side code to receive the message and display it. 

It would be far better to just create a lookup object to write your debug messages to, then you just check the lookup to see the messages. 

Ryan

Ryan Farley,

Do you have an example how to write into a lookup  object please ?

You can write to any object using the following: 

var schema = UserConnection.EntitySchemaManager.GetInstanceByName("AccountType");
var entity = schema.CreateEntity(UserConnection)
entity.SetDefColumnValues();
entity.SetColumnValue("Name", "Some new type");
entity.Save();

 

However, for debugging, even better than writing to an object would be to use logging, see https://customerfx.com/article/logging-information-and-errors-in-creatio-c-code-and-viewing-from-cloud-hosted-systems/

Ryan

Show all comments