NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?xml version="1.0" encoding="utf-8"?>
<!--
Author: Vincent Van der Linden

Script : RecreateMetadataIn
The XperiDo for MSDyn CRM solution makes use of a metadata entity to store templates and printers.
Records into this entity are used by the workflow engine during select.
At delete (to replace the old solution), all information is removed.
This script will recover the content of the metadata entity and can be called after the installation of the new CRM solution.
This routine can also be called to recover accidental delete or to fix the metadata entity.

Calling this routine requires 1 parameter, the name of the project. (CASE SENSITIVE) !!

Look in the report for errors. Default logging is supressed.

Changes:
VVDL 2014-04-16 First version
VVDL 2015-06-03 DeleteXperiDoMetadata in comment for printers. Removed printers are to be removed manually from the metadata entiry in crm
VVDL 2015-06-12 ClearXDMetaData removed. Was additional to the DeleteXperiDoMetadata

19-10-2015 VVDL Service feedback implemented
-->
<XBscript>

<Imports>
<Import script="'../../Base/XDCRMservices_Helpers.xb'" />

// Invenso services
<Import schema="'/Core/WebServices/Repository/Datatypes.xsd'" />
<Import schema="'/Core/WebServices/Repository/Items.xsd'" />
<Import script="'/Core/WebServices/Repository/RepositoryService.xb'" />
<Import schema="'/Document/Samples/Print/PrinterInfo.xsd'" />

</Imports>

<Data>
<Const name="VERSION" value="'3.3'" />
<Const name="LAST_CHANGED" value="'19-10-2015'" />
</Data>

<Object name="DataOut">
<Field name="success" datatype="boolean" dft="true" />
<Field name="feedback" datatype="Feedback" />
<FieldList name="messageList" datatype="Message" />
</Object>

<Object name="Feedback"/>

<Object name="Message">
<Field name="type" datatype="string"/>
<Field name="text" datatype="string" />
<Constructor>
<Parm name="_type" datatype="string" />
<Parm name="_text" datatype="string" />

<Set var="type" value="_type" />
<Set var="text" value="_text" />
</Constructor>
</Object>

<Main>
<Parm name="projectName" datatype="string"/>

<!--
// remove all existing metadata
<RunScript script="'/' + projectName + '/Base/Repository/ClearXDMetaData.xb'"/>
-->

<Field name="dataOut" datatype="DataOut" />
<Set var="dataOut.success" value="true" />

<ChangeLogLevel level="'debug'">
<Try>
<Eval exp="dataOut.messageList.addAll(setTemplates(projectName))" />
<Eval exp="dataOut.messageList.addAll(setPrinters(projectName))" />
<Catch var="xe">
<GenerateUserWarning>
<Input value="xe.message" />
</GenerateUserWarning>

<Set var="dataOut.success" value="false" />
<Set var="dataOut.messageList[]" value="new(:Message, 'error', xe.message )" />
</Catch>
</Try>
</ChangeLogLevel>

<Return value="dataOut" />
</Main>

<!-- setTemplates -->
<Routine name="setTemplates">
<Parm name="projectName" datatype="string"/>

// check incoming parameter
<If condition="isNullOrBlank(projectName)">
<Throw code="'error'" message="'Project name required XDCRM....'"/>
</If>

// variable declaration
<Field name="items" datatype="Items"/>
<Field name="_items"/>
<Field name="item" datatype="ItemsItem"/>
<Field name="crmLink" datatype="string"/>
<Field name="document" datatype="string"/>
<Field name="template" datatype="string"/>

<FieldList name="messageList" datatype="Message()" />
<Field name="XDHelpers" datatype="XDCRMservices_Helpers"/>

// get all templates in the project
<SearchRepository project="projectName" server="'local'" role="'*current'" includeContent="false">
<Metadata>
<Item key="'Type'" value="'CRM'"/>
</Metadata>
<Output var="_items"/>
</SearchRepository>

<If condition=" isNullOrBlank(_items)">
<Throw code="'Error'" message="'Project not found or project does not have templates'" />
</If>

<Set var="items" value="_items"/>

// for each template found
<ForEach in="items.Item" var="item">
// get template properties
<Set var="crmLink" value="XDHelpers.selectItemProperty(item,'CrmLink' )"/>
<Set var="document" value="XDHelpers.selectItemProperty(item,'Document' )"/>
<Set var="template" value="substr(item.fullname,indexOf(item.fullname,projectName )+length(projectName) ,length(item.fullname) )"/>
// templates without dataset are not registered in the CRM metadata file
<If condition="! isNullOrBlank(crmLink) and ! isNullOrBlank(document)">
// add template name to metadata entity
<RunScript script="'/' + projectName + '/Base/Repository/ExtraServices.xb'" routine="'InsertUpdateXperiDoMetadata'">
<Parameters>
<Item name="'category'" value="'Template'"/>
<Item name="'subcategory'" value="''"/>
<Item name="'key'" value="document"/>
<Item name="'value'" value="template"/>
<Item name="'reference'" value="toLower(template)"/>
<Item name="'description'" value="item.description"/>
</Parameters>
</RunScript>

<Set var="messageList[]" value="new(:Message,'info', 'Template ' + item.name + ' registerd or updated in CRM metadata entity' )" />
<Else>
<Set var="messageList[]" value="new(:Message,'error', 'Properties Document/CrmLink mssing on ' + item.name )" />
</Else>
</If>
</ForEach>
<Return value="messageList" />
</Routine>

<!-- setPrinters -->
<Routine name="setPrinters">
<Parm name="projectName" datatype="string"/>

<Field name="printers" datatype="Printers"/>
<Field name="printerType" datatype="PrinterType"/>
<FieldList name="messageList" datatype="Message" />

<ListPrinters>
<Output var="printers"/>
</ListPrinters>

<!--
// delete printer information in metadata file
<RunScript script="'/' + projectName + '/Base/Repository/ExtraServices.xb'" routine="'DeleteXperiDoMetadata'">
<Parameters>
<Item name="'category'" value="'Printers'"/>
<Item name="'value'" value="''"/>
<Item name="'reference'" value="'getPrinterNames'"/>
</Parameters>
</RunScript>
-->

<ForEach in="printers.Printer" var="printerType">

// add printer as metadata entity into CRM
<RunScript script="'/' + projectName + '/Base/Repository/ExtraServices.xb'" routine="'InsertUpdateXperiDoMetadata'">
<Parameters>
<Item name="'category'" value="'Printers'"/>
<Item name="'subcategory'" value="''"/>
<Item name="'key'" value="printerType.name"/>
<Item name="'value'" value="printerType.name"/>
<Item name="'reference'" value="printerType.name"/>
<Item name="'description'" value="''"/>
</Parameters>
</RunScript>
<Set var="messageList[]" value="new(:Message,'info', 'Printer ' + printerType.name + ' registerd or updated in CRM metadata entity' )" />

</ForEach>
<Return value="messageList" />
</Routine>
</XBscript>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.