M3 UI Adapter 10.3 – Jscripts directory and personalisations have moved

I was at the M3 User Group biannual conference in Australia last month and I was told about an interesting change to how JScripts were handled.

The comment was that under the new M3 UI Adapter, copying scripts in to the mne\jscript directory no longer worked.

I was a little surprised as I hadn’t noticed anything in the documentation I’d skimmed but it was inevitable.

The user and global personalisations are now stored in a database, which was also inevitable.

This leaves a problem – how to administer it all? I had a look in the Core Admin guide and the Install Guide and couldn’t really find anything about how you were supposed to migrate existing scripts and personalisations or how to administer changes for Smart Office.

So, in Smart Office we have the Personalization Manager – seemed like a good place to start.

This will launch a browser session to the H5 Clients Admin Tools section, you will be prompted to log in.

Under the Administration Tools we have Personalisations – Personalisations representing strangely enough the personalisations, and Data files – which allows us to upload various files that were stored on the file system, including JScripts/.dlls

Scripts

Under the Data Files we can change the file type to MForms Script and you can see to the right we have an Import button and an Import Zip. Import will allow us to import a single .js or .dll at a time and we will be prompted to provide a description.

NOTE: with the M3 UI Adapter 10.3.0.0.6664 you must zip your .dlls and use the Import Zip. If you click on the Import button above, your assembly will get corrupted and will not load. (see the bottom of this post for more details)

The import zip will allow us to import multiple scripts/dlls from a single zip file.

Delete will of-course allow you to delete a script and the export button allows you to export one or more scripts. When you select more than one script to export, they will be zipped in to a single file for you to download.

Figure 1 – Example zip file container two scripts

Figure 2 – zip with two scripts imported

Interestingly enough, from a file system perspective, the imported files still get dropped on to the filesystem, under the Jscript directory, and in to a new directory called Infor.

Figure 3 – JScript directory still there…but hold on…nothing there but a directory

Figure 4 – and in our directory our imported scripts

Personalisations

Personalisations work very similar to the scripts.

We can import an individual personalisation from a file, or a group from a zip file.

We can copy personalisations between users, roles, etc. Copying will overwrite the settings in the destination if there are any.

Merge to will merge it with the existing settings.

We can drill down to see what personalisations have been applied to a user.

So under me we can see I have a personalisation on MMS002

Drilling down further we can see that it is panel E and I have a script applied.

And drilling down still further we can see specifically what script.

As you can see, it’s pretty straight forward – just follow your nose. I have encountered a couple of situations where I got unexpected behaviour – I managed to create an empty tab order and then attempting to merge it created some errors and I didn’t appear to be able to delete things like scripts at the panel level (eg. MMS002/E) but for the later, I expect the idea is that you create your personalisations for a user and then copy it rather than trying to individually manipulate the settings.

Other things of note

Through LCM on the M3 UI Adapter there is this handy little option which looks like we can import our scripts and personlisations from a previous version. I haven’t tried this yet due to a lack of environments I’m comfortable messing around with.

And there is a bug / omission in the M3 UI Adapter 10.3 where you can’t run *.dll ‘scripts’, you get an error that “the remote server returned an error. (401) Unauthorized” as seen below

This is due to some changes in the MUA. See KB 1649295 in InforXtreme for detail.

We can fix this issue by editing the \M3_UI_Adapter\webapps\mne\WEB-INF\web.xml file and adding the highlighted line under the security-constraint -> web-resource-collection

And you’ll probably need to restart the MUA for the setting to come in to effect.

It’s also worth noting that if you get this error

“System.BadImageFormatException: Could not load file or assembly ‘52439 bytes loaded from Mango.UI, Version=10.2.10000.51, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

Then it’s because of the way the upload works – you need to zip your .dll and import it as a .zip

I’m guessing that the normal import assumes a ‘text’ upload and corrupts the assembly on upload.

Anyways, hope that provides a place to start.

Cheers,
Scott

This entry was posted in Development, M3 / MoveX. Bookmark the permalink.

16 Responses to M3 UI Adapter 10.3 – Jscripts directory and personalisations have moved

  1. Andy says:

    Thanks Scott!

    This will be really helpful as we move to 13.3/10.3

  2. chamath says:

    Hi
    This is not related with post, but this script related question. I’m trying to use MNS150 with CSV file to create user ID’s which are in the csv file. I’m Using this code (texFile = axoTextFileObj.OpenTextFile(“C:\\Jscripts\\MNS150.csv”, ForReading);) to read the csv file, But it is giving me below error every time I ran it.
    “System.IO.DirectoryNotFoundException: Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)”
    I have given access for everyone in the jscript folder. Hope any one have ideas….

    • potatoit says:

      The JScripts are run at the client level, so the C:\JScripts directory needs to be on the local machine that the client is running on.

      It sounds like you have created the directory on a server?

      Cheers,
      Scott

  3. chamath says:

    My Jscript folder is on the my client machine..which I’m running smart office.can you say if there is any wrong in the path I have implemented.
    below is the part of code I’m using, then I’m using other set of code to read the csv file using array…
    import System;
    import System.Windows;
    import System.Windows.Controls;
    import MForms;
    import Mango.UI.Core;
    import Mango.UI.Core.Util;
    import Mango.UI.Services;
    import System.Threading.Thread;

    package MForms.JScript
    {
    class MNS150
    {
    public function Init(element: Object, args: Object, controller : Object, debug : Object)
    {
    var axoTextFileObj, texFile, s, recArray;
    var ForReading = 1;
    axoTextFileObj = new ActiveXObject(“Scripting.FileSystemObject”);
    texFile = axoTextFileObj.OpenTextFile(“C:\\Jscripts\\MNS150.csv”, ForReading);
    while( !texFile.AtEndOfStream )
    {
    s = texFile.ReadLine();
    //debug.WriteLine(“Hello World.”+s+””);
    recArray = new Array();
    recArray = s.split(“,”);
    if(!trim(recArray[0])== “”)
    {
    this.addUser(debug, recArray);
    }
    else
    {
    }
    }
    texFile.Close();
    }

  4. potatoit says:

    The error that you mentioned indicates it can’t find the directory/path. So that would be where I would start.

    I wouldn’t be creating an ActiveX object either, I would personally use one of the readers in the System.IO namespace. Maybe something like the StreamReader.

    https://msdn.microsoft.com/en-us/library/system.io(v=vs.110).aspx

    You would need to import the System.IO namespace, and then have a line like so:

    try
    {
    var reader = new StreamReader(“C:\\Jscripts\\MNS150.csv”);

    // add your code to process the file
    }
    catch(ex)
    {
    debug.WriteLine(“Exception attempting to read file: ” + ex);
    }

    Cheers,
    Scott

  5. roshan says:

    Hi,
    Nice Article,Thank You.
    I have a Question regarding Personalization upload.When we uploading Personalization through LCM via migrate tool, There is a folder structure you need to follow.Do you have information about that,User wise it is working and role wise it is not working.
    When using Per.manager in ISO, when you try to import Personalization zip file it is not work, path coming as ex:- c:\fakepath\Customization.zip.
    Always there is “Fakepath” , no matter where are you import from and then when you press import loading forever nothing happen.

    Thank you for any update/info

    • potatoit says:

      Hi,

      I haven’t done any assignments based on roles.

      But what I’d do is manually create a role assignment, and then Export the personalisations. Open the zipped folder and it should show you the correct folder structure.

      Cheers,
      Scott

      • roshan says:

        Thanks for the update,I have found a work around,you can create a role from personalization manager and then copy xml file from existing user who already have personalization.Then you can create that role in mns405 and add users in mns410.

        Thanks
        Roshan

  6. Salem says:

    Thanks Scott!
    I have a dll script. I zipped it and try to import it using H5 client [Data File –> MForms Script
    –>”Button Import ZIP”. Ishoose the zip file, but no way to import it. Message when trying to upload : “Unable to perform the requested opreration”

  7. Salem says:

    Thanks Scott!
    I have a dll script. I zipped it and try to import it using H5 client [Data File –> MForms Script
    –>”Button Import ZIP”. Ishoose the zip file, but no way to import it. Message when trying to upload : “Unable to perform the requested opreration”
    Salem

    • potatoit says:

      Hi Salem,

      I’m guessing you zipped the directory the .dll was in. When I try that I get the error message you mention.

      From Windows Explorer, Right click on the .dll and select Send To -> Compressed (Zipped) Folder

      Now try uploading the resulting zip file.

      Cheers,
      Scott

  8. Salem says:

    Thaks Scott 🙂
    I tried your method but I had the same error message.
    0200Z {} WARN M3UIAdapterModule ImportExportService: [web-request-176491] Importing aborted. Unable to validate zip file structure. Please verify that it contains at least one known directory.

  9. Salem says:

    Thanks Scott!
    I have the same error message even with Windows Explorer, Right click on the .dll and select Send To -> Compressed (Zipped) Folder.
    The error message is :
    WARN M3UIAdapterModule ImportExportService: [web-request-176491] Importing aborted. Unable to validate zip file structure. Please verify that it contains at least one known directory

    Can you help me please ?
    Thank you in advance

  10. Arun says:

    Hi,
    Could you please help on below query:
    I need to create jscript in smart office that should move all the files from one location to another location once the jscript button gets clicked.

    If you have done this before so could you please help me out.

    Thanks,
    Arun

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s