Table Script Common Functions File

SUGGESTED

I'm sure that it is possible to create a common server side JavaScript file for table script functions but I can find no reference to this.  Does anyone know how to do this?  I thought there was a system parameter for this but I can't find it.  

At the moment I am creating some table scripts which involve quotes and orders, with some functions which are common to the both of them.  Rather than have two copies of the exact same function it would be ideal to have one copy of that function which can be referenced from both the quotes and orders table script.

  • 0
    SUGGESTED

    You can yes. However, you can't do this if you integrate with Sage 300 because Sage 300 uses the same method to create common functions. That aside, you need to add a registry key called ScriptCommonFunctions. It is a string type key and you put it here HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\eWare\Config\/XXX where /XXX is your CRM install name. The value is the name of the common js file you want to include. So if you have a common functions file called myLibrary.js just put the name in the reg key value. The file location is in the CustomPages folder. You can put it in a sub directory in there and to do that include the directory name in the reg key value, for example:

    MyCustomLib/myLibrary.js

    This file will exist in you CRM install folder under wwwroot/CustomPages

  • 0 in reply to Sage CRM

    Brilliant, I was looking for a system parameter, not a registry key.  I find that searching the community hub can be a bit hit and miss as I tried

    shared table script library
    shared table script functions
    common table script functions

    The issue here though is that I want to distribute my code as part of a component but a component cannot update the registry as far as I am aware (it would be very dangerous if it could), so whoever installs the component would also have to have admin rights on the server to update a registry key.

    I did think to myself there must be a reason why I don't use a common table script file as I use the WWWRoot\js\custom directory all the time.