<#ftl output_format="JSON"> <#-- newInterface: The macro for generating view and template metadata for a new Interface --> <#macro newInterface request recipeObjectId uuid name description ruleFolderUuid ruleContents actionCreateUpdateId="" ruleInputs="" testInputs="" showNonGeneratedPk=true triggers="" hasNext=false> <#assign textResolver = request.getTextResolver()> { <#-- recipe section --> "version": 2, "objectType": "INTERFACE", "replaceable": false, "recipeObjectId": "${recipeObjectId}", "templateForCreate": "ix/v2/createInterface_v2.ftlx", "selectedObjectIndex": 0, "isVisible": true, <#if triggers?has_content> "triggers": ${triggers}, <#-- the set of new and reused objects --> "objects": [ { "objectStatus": "NEW", "templateObjectId": "${recipeObjectId}-0", "objectIndex": 0, <#-- bindings section --> "uuid": "${uuid}", "versionUuids": ["${request.generateUuid("INTERFACE_VERSION")}"], "parentUuid": "${ruleFolderUuid}", "baseRecordUuid": "${request.getTargetObject().uuid}", <#if request.getTargetObject().fields?has_content> "fields": [ <#list request.getTargetObject().fields.recordSourceFields as field> <#if !field.properties.isPrimaryKey || (showNonGeneratedPk && !field.properties.generated)> { "uuid": "${field.uuid}", "name": "${field.name?json_string}", "friendlyName": "${field.properties.friendlyName?json_string}", "required": ${field.properties.nillable?string('false', 'true')}, <#if field.properties.lengthLimit?has_content> "lengthLimit": ${field.properties.lengthLimit?c}, <#if field.properties.auditFieldType?has_content> "auditFieldType": "${field.properties.auditFieldType?json_string}", <#if field.properties.fieldRelationship?has_content> "relationshipType": "${field.properties.fieldRelationship.relationshipType}", "relationshipUuid": "${field.properties.fieldRelationship.relationshipUuid}", "targetUuid": "${field.properties.fieldRelationship.targetUuid}", "targetFieldUuid": "${field.properties.fieldRelationship.targetFieldUuid}", "targetLabelFieldUuid": "${field.properties.fieldRelationship.targetLabelFieldUuid}", "isTargetFieldPkField": "${field.properties.fieldRelationship.isTargetFieldPkField?c}", "relationshipPlaceholderText": "${request.getTextWithKey("recordActionTemplateRecipe.object.interface.recordPicker.placeholderLabel", field.properties.friendlyName)?json_string}", "type": { "xsdType": "${field.properties.type.xsdType}", "qName": "${field.getType().getQualifiedTypeName().toString()}" } }<#sep>, ], <#if request.getTargetObject().relationships?has_content> "relationships": [ <#list request.getTargetObject().relationships as relationship> { "uuid": "${relationship.uuid}", <#if relationship.targetRecordTypeUuid??> "targetRecordTypeUuid": "${relationship.targetRecordTypeUuid}", <#if relationship.targetRecordTypeFieldUuid??> "targetRecordTypeFieldUuid": "${relationship.targetRecordTypeFieldUuid}", <#if relationship.targetRecordTypeFieldUuid??> "sourceRecordTypeFieldUuid": "${relationship.sourceRecordTypeFieldUuid}", "name": "${relationship.nameWithoutAppPrefix?json_string}", "expressionableName": "${textResolver.format(relationship.name, "CAMEL_CASE", "relatedRecord")?json_string}", "relationshipType": "${relationship.relationshipType}", <#if relationship.gridColumnsExpression??> "gridColumnsExpression": "${relationship.gridColumnsExpression?json_string}", "fields": [ <#assign nonPKFields=relationship.fields?filter(f->!f.properties.isPrimaryKey)> <#list nonPKFields as field> { "name": "${field.name?json_string}", "friendlyName": "${field.properties.friendlyName}", "type": "${field.getType().getQualifiedTypeName().toString()}", <#if field.properties.fieldRelationship?has_content> "relationshipType": "${field.properties.fieldRelationship.relationshipType}", "targetUuid": "${field.properties.fieldRelationship.targetUuid}", "targetFieldUuid": "${field.properties.fieldRelationship.targetFieldUuid}", "targetLabelFieldUuid": "${field.properties.fieldRelationship.targetLabelFieldUuid}", <#assign properRelationshipName=field.properties.fieldRelationship.relationshipName?lower_case?cap_first?json_string> "properRelationshipName": "${properRelationshipName}", "uuid": "${field.uuid}" <#if field?has_next> }, <#else> } ] <#if relationship?has_next> }, <#else> } ], "actionCreateUpdateId": "${actionCreateUpdateId}", "ruleContents": "${ruleContents}", <#if ruleInputs?has_content> "ruleInputs": ${ruleInputs}, <#if testInputs?has_content> "testInputs": "${testInputs}", <#-- i18n section --> "name": "${name?json_string}", "description": "${description?json_string}", "i18n": { "booleanYes": "${request.getTextWithKey("recordViewTemplateRecipe.object.interface.booleanField.yes")?json_string}", "booleanNo": "${request.getTextWithKey("recordViewTemplateRecipe.object.interface.booleanField.no")?json_string}", "interfaceSaveButtonLabel": "${request.getTextWithKey("recordActionTemplateRecipe.object.interface.save.button")?json_string}", "interfaceCancelButtonLabel": "${request.getTextWithKey("recordActionTemplateRecipe.object.interface.cancel.button")?json_string}", "interfaceCreateButtonLabel": "${request.getTextWithKey("recordActionTemplateRecipe.object.interface.create.button")?json_string}", "formTitleCreate": "${request.getTextWithKey("recordActionTemplateRecipe.create.object.interface.formTitle", request.getTargetObjectNameWithoutPrefix())?json_string}", "formTitleUpdate": "${request.getTextWithKey("recordActionTemplateRecipe.update.object.interface.formTitle", request.getTargetObjectNameWithoutPrefix())?json_string}" } } ] }<#if hasNext>,