Importing Lookup items / translations periodically ???

Hi,

I'd like to maintain a lookup value list that should be linked with an external database.


We have decided to use a SQL Job that will insert new items and update translations for the existing ones in the custom_captions table.

Problem is : updates are not visible in the CRM application since the system needs a Metadata refresh through the Admininistration/System/Metadata refresh interface.

Is it possible to trigger this Metadata refresh programmatically (ideally by SQL script, but .NET would do the job too if there is no other solution available) ?

If not, which method would you recommend to implement that ?

Valérian

  • 0

    Hi Proconsult,

    You can do metadata refresh programmatically by creating server side .js file which will contain following code snippet.

    eWare=new ActiveXObject("eWare.");
    eWare.Logon('username','password');
    eWare.RefreshMetaData();

    e.g. My CRM database name is CRM72, hence code will look like below.

    eWare=new ActiveXObject("eWare.CRM72");
    eWare.Logon('admin','xyz');
    eWare.RefreshMetaData();

    If your system/server is 32 bit then you just need to double click on this js file and if system/server is 64 bit then you need to create batch file (.bat) which will contain entire root directory for this .js file. You can run this .bat file by double clicking on it and to run this automatically, you need to create basic task using windows task scheduler.

    To perform your entire operation, I will suggest following two approaches.

    First Approach:

    In this, I will suggest you to perform insert/update operation for custom captions of CRM through server side js file instead of SQL. Advantage of this is you can call “eWare.RefreshMetaData();” method after your insert/update option so that both work can be done in one shot only.

    Second Approach:

    Second approach would be, as you have already scheduled SQL job to perform insert/update operation for custom caption. As soon as your SQL job gets finished, run the .bat file which contains code for metadata refresh using windows scheduler.

    Hope this helps!

    Regards,
    Dinesh

  • 0

    Thanks a lot Dinesh !

    I will test the second approach as a first try and see what happens.

    Regards,

    Valerian

  • 0

    Hi Dinesh,

    I tried the second approach as is and it's not working.

    I have an error message which seems logical.

    Automation server can't create object.

    Server is 2008R2. I've googled quickly the error and did not found something really relevant.

    Are you sure your 3 JS lines are enough ? I'm not a Javascript expert at all so I basically pasted your example, replaced the crm instance name, and removed the user password as we are using NT automatic logon (and I removed the original crm user passwords in the system)

  • 0

    Hi Proconsult,

    Sorry by mistake I have mentioned database name in first line of code, it should be your CRM instance name. Refer below code snippet.

    eWare=new ActiveXObject("eWare.");

    Hope this helps!

    Regards,
    Dinesh