Questions/whishes to RND or someone with the knowledge

Hi!

I have got some question/Whish from a customer of mine and have also perhaps found out some issues with the CRM script triggers. Thanks in advance!

 

  • Possible to define own datatypes for fields/columns in a Service Extra table
    1. Or at least the possibility to define field/column length, when creating the field, eg fro short strings it is 255 letters. Whould be nice to be able to set 10 or 30 or whatever value I want between 1-255. Should be respected in GUI and I should not be able to type more letters than field allows in database.

 

  • Have the possibility to add default value for fields in a service extra table where the fields are Linked to another Extra table. Eg be able to set what Id in the linked field that should be used as a standard value when creating a new post.

 

  • Triggers
    • Triggers for editing extra tables does not seem to work, I can’t get them to fire anywhere.
      • According to a colleague of mine it is possible to get them fire in the service-gui but not when viewed in CRM sales client.  Eg when using: listTableEntries

/scripts/ticket.fcgi?_sf=0&action=listTableEntries&table=y_custom_table&field.0=y_custom_table.x_customer_id&value.0=<cuid>&preview_secret=<usec>

 

  • Would be very nice to have triggers that works when using listTableEntries in the CRM-sales GUI to view /edit / create data in Extra tables that way.

 

  • Can someone confirm that these triggers works and where they work/actually triggers?
    1. Edit extra table entry screen: Loading
    2. Edit extra table entry screen: Before button click
  • Events for before-save and after save table-entry should also exist?? 

RE: Questions/whishes to RND or someone with the knowledge

Hi Anders,

1. Not exactly sure what you mean about own datatypes?

2. Not exactly sure what you mean, but you want to be able to define 1 global standard value pointing to specific entry in another Extra table? 

3. Currently there is an issue with screenchoosers and triggers not firing for action=listTableEntries, this in the backlog and will be corrected.

I can confirm that these triggers work from Service (running from action=searchTable). Looks like naming of these triggers are somewhat confusing;

1. Edit extra table entry screen: Loading, should be before save
2. Edit extra table entry screen: Before button click, should be after save

By: Michel Krohn-Dale 30 Sep 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi!

Thanks for answers

Regarding nr 1, Own datatypes. 

There are sometimes customers that want to have a specfic Extra table fitting there own "bigger" information modell. eg they have string(nvarchar/varchar) type : 40 chars long but in SuperOffice service Extra Table, a stringfield of type short is nvarchar and always 255 chars long. That can couse some issues and/or overhead if integrating towards the Extra Table.

So at least the possibillity to specify length of stringfields would be great.

Regarding nr 2, deafult value for fields pointing to another extra table.

I want to be able to set a defualtvalue on field pointing to another extratable (look up table). Just like for standard text-fields using a list of values, there I can choose to have a default value. When working with extra tables it is quite often dessireble to put lookup values /a list  (of types of som sort for example). And it would be nice to be able to choose a value from that lookuptable as default value. That should be populated in the create new row form.

 

Regarding nr 3, triggers for service Extra Tables

Ok, great that is then is bug for listTableEntires, when will that be fixed. Also great if names of triggers would follow standard name convention. But also a trigger on actually loading the form would be great to be able to run a script setting defaul value for new post for example , if not ale to do it like in Number 1 above. or to manipulate other things depending on user for instance.

I didnt manage to get a script to hit even in the running form action = searchTable view in service

Can you provide a very simple code-snippet for testing this out? 

Best regards

Anders

 

  

By: Anders Larsson 30 Sep 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi,

Provided that we can accomplish triggers to work, it is possible to solve some of your wishes;

1. As we have trigger Edit extra table entry: Before button click, I have created trigger checking length of input in field, and blocking saving:

2. As we have trigger Edit extra table entry screen: Loading, I have created trigger that will set value on field when entering:

Hopefully this will explain how to get it to trigger properly.

By: Michel Krohn-Dale 30 Sep 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi Michel!

 

Thanks for code-examples. Will test them out in my customer test environment.

The problem will still be that they primerly will use the listTableEntries action to show the service Extra Table in the SuperOffice sales client so the script will not hit there id it was a bug in the backlog regarding this. Showing searchtable in the SuperOffice sales client is not perfect, for example there are a bug in IE/Edge (reporterd to SO suport, but they can not reproduce),  when using hideframework or _sf=4.

When do yo think the backlog bug for listTableEntires will be fixed? 

But certanly, if script will trigger when action = listTableEntries that will solve number2 and number3

Best regards

Anders

 

By: Anders Larsson 1 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi Anders,

Resolving this is issue is targeted against next online release, unless some unforeseen events is blocking.

 

By: Michel Krohn-Dale 1 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi agian!

Ok, great, so for SO online that is traget for Release 8.5 R06 around 2019-10-22
And I guess it then will end up in the 8.5 R06 for on prem around 2019-10-30 ?

Any bugid/link that I can follow ?

Are you also interested to get the information about the bug I found around showing data from from serivice in superoffice sales ?

I can then send you an email with my findings or post it here in the community.

/Anders 

 

By: Anders Larsson 1 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi,

You can follow this issue to track progress.

If you have some info about other issues and this can be relevant for other parties please share on community, if not you can contact me by email.

 

By: Michel Krohn-Dale 1 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi,

Thanks Michel for helping out around the issue with script triggers , looking forward to test this out.

What about your thougths around:
Nr1 - be able define own datatypes, or at least set a max value for short text string. as described above.

I know that we will be able to create a validation when the scripttriggers will work. but would still be nice to be able to define max-value already in the table admin gui.

and

Nr2  - Be able to set stanard value (in the table admin GUI) for a field in a extra-table that points to another extra-table (referense value/id eg a list of possible values for a certain field) 

/Anders

By: Anders Larsson 9 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi!

Michel => Any thoughts about my last post / explanation around Nr1 and Nr2

 

By the way in the SOD environment I have been able to get CRM-scripts to trigger when loading and before saving a post in an service extra table. (did have to alter the scripts a bit)

/Anders

By: Anders Larsson 18 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi Anders,

I see your point and feel free to register a wish on this, in mean time it is possible to "programmatically" accomplish this with Triggers.

 

By: Michel Krohn-Dale 21 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Thanks Michel, 

I will register a wish for 

When you say "programaticlly" with triggers, is classical triggers in SQL server you are talking about or the Soft Triggers that Tony mentionend in this thread, below or just Triggers using CRM-script and hokking into events on load/save, like you suggested earlier in the tread (I have this working in my SOD, so seems fixed in 8.5 R06) :

https://community.superoffice.com/en/developer/forum/rooms/topic/superoffice-product-api-group/crm-web-application/how-to-catch-crud-operations-performed-by-built-in-rest-ap

Soft Triggers

 

Best regards

Anders

By: Anders Larsson 21 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Anders:

I think Michel is referring to the "programmatic" examples he included, where he used the two different existing trigger-events you are referring to, for solving two different "use case"-problems.

But, if I understood you correctly, these are only working when viewed/edited in Service right now, not when viewing the screen as a web panel in Sales, right? If I understod Michel correct there, this problem is something that they are looking at. So there doesn't seem to be any solution for that right now.

The actual problem you have, might not be that the event is missing, but that there isn't an implementation for calling the event. From Service the event is called, when doing the same in the screen embedded in a web panel, the event isn't called.

So, trying a solution where web hooks are used would probably don't do any difference as the event isn't called, so the web hook wouldn't get triggered.

If you are onsite, for sure, SQL triggers could be used to identify  a change in the custom table, but using SQL Triggers are often seen as quite bad practice from a dba/development perspective, as they can lead to a bunch of unexpected side effects. Architecure wise it creates dependencies to different parts that you really want to avoid from a maintenance perspectice as well.

So using SQL triggers wouldn't be something I would recommend. :)

As I believe that the number of events you can trigger on when using NetServer Scripts are more extensive than the number of Web Hooks Events available. There might be some other, lower level, event that you could trigger on if you are Onsite. That would probably be of the type "AfterSave" as it is server based and you're probably aren't able to interfere in the GUI-workflow that way.

The SoftTriggers Tony mentioned, I haven't used, so I don't know what's actually possible using those.

/Marcus

 

By: Marcus Svenningsson 21 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi Anders,

I was in fact referencing my code example from with Trigger scripts, as this will allow you to validate field length on save or set values programmatically to fields in loading script for screen.

 

By: Michel Krohn-Dale 21 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Thanks Michel, 

I will register a wish for 

When you say "programaticlly" with triggers, is classical triggers in SQL server you are talking about or the Soft Triggers that Tony mentionend in this thread, below or just Triggers using CRM-script and hokking into events on load/save, like you suggested earlier in the tread (I have this working in my SOD, so seems fixed in 8.5 R06) :

https://community.superoffice.com/en/developer/forum/rooms/topic/superoffice-product-api-group/crm-web-application/how-to-catch-crud-operations-performed-by-built-in-rest-ap

Soft Triggers

 

Best regards

Anders

By: Anders Larsson 22 Oct 2019

RE: Questions/whishes to RND or someone with the knowledge

Hi!

ok great, thanks both Markus and Michel for clearifying. 

Yes, the problem is that in versions before 8.5 R06 the triggers for editing extra tables (when showing them in sales) are not working. In my SOD I have got the 2019-10-15 build I belive that is 8.5 R06. (confusing with dates of builds and RX-versions)

Anyway I have successfully managed to create a validation script after som trial and error (ink debuging) and F12-ing in the browser. I figured out a way to achive validation on short text-field that I want to be max 40 chars long.

(On:Edit extra table entry screen: Before button click) 

This works well in the above version so I expect it work in the upcoming 8.5 R06 version. 

(the exact same script does not work in 8.5 R04, not in serivce not in sales when editing data in extra table forms)

#setLanguageLevel 3;
EventData ed = getEventData();
 
Map values = ed.getInputValues();
if(values.get("table.value") == "y_<your_table>")
{
  if(values.get("y_<your_table>_<x_your_table_field_to_validate>.value").getLength() >40)
  {
    ed.setValidationMessage("Lenght cannot be more then 40 chars");
  }
}
 
No, I agree, SQL triggers should be used with extream care and avoided if possible I think.
I will soon dig into Tonys other post and investigate web hook solution and maybe also soft triggers
 
If anyone have more information about how to build a simple web hook solution that catches for example when a company is saved , feel free to comment and share knowledge :-)
 
/Anders
By: Anders Larsson 22 Oct 2019