IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

Script to update casing of all fields in services (DTOs) #54

Closed chivandikwa closed 1 year ago

chivandikwa commented 1 year ago

Ask a question

Hi,

Please kindly assist me in figuring out a script to update all fields of my Contracts in the Services to be TitleCase

I have managed to do the following for the domain which works, but unable to do the something similar for the services

let attributes = lookupTypesOf("Attribute");
for (let i = 0; i < attributes.length; i++) {
    const attribute = attributes[i];
    const name = attribute.getName();
    attribute.setName(name.charAt(0).toUpperCase() + name.substr(1));    
}
garethbaars commented 1 year ago

Hi Thulani,

You can use the same script, but instead of lookupTypesOf("Attribute");, you'll need to change that to lookupTypesOf("DTO-Field");.

In general, to know the specialization type of any element in the designer, simply click on it and in the properties its name will show. For example on a DTO field: image

Let us know if this doesn't solve your issue.

chivandikwa commented 1 year ago

Thanks @garethbaars that was a lightning fast response!