Skip to main content
12-Amethyst
June 1, 2022
Question

using ImportSourceControlledEntities to import a single entity

  • June 1, 2022
  • 1 reply
  • 2110 views

Hi,
How can i use the ImportSourceControlledEntities  service to import a single entity: I guess i need to use the entityFilter parameter, but i'm not able to find the correct syntax:

   let entityFilter = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
        infoTableName: "InfoTable",
        dataShapeName: "EntityDifference"
    });

    entityFilter.AddRow({name: "myTemplateToImport", entityType:"ThingTemplate"});
    Resources["SourceControlFunctions"].ImportSourceControlledEntities({
         entityFilter: entityFilter,
         repositoryName: "SystemRepository",
         path: "src/twx-source"
    });
 
Any help or example would be appreciate.

1 reply

16-Pearl
August 4, 2022

hi cbaurand

 

entityFilter is not necessary parameter. please refer to below sample code which I ran successfully on TW9.3.2 instance.

 

let params = {
entityFilter: undefined /* INFOTABLE {"dataShape":"EntityDifference"} */,
path: "/Things" /* STRING */,
useDefaultDataProvider: undefined /* BOOLEAN {"defaultValue":true} */,
withSubsystems: undefined /* BOOLEAN {"defaultValue":false} */,
overwritePropertyValues: undefined /* BOOLEAN {"defaultValue":true} */,
repositoryName: "RepThing" /* THINGNAME */
};

// no return
Resources["SourceControlFunctions"].ImportSourceControlledEntities(params);

 

cbaurand12-AmethystAuthor
12-Amethyst
August 4, 2022

My intention was to import a single entity. Your response is irrelevant.

16-Pearl
August 4, 2022

I attached a picture where I ran ImportSourceControlledEntities from composer. I defined entityFilter to only import thing with name "test2".

For your use case, you can define InfoTable with data shaple "EntityDifference", add a row to with entityType as "Thing" and name as target thing name.

wcui_1-1659604704421.png