5

I'm to trying to automated appflow creation via cloud formation. I have multiple fields (130+) in source & I'm unable to map it manually. From UI I can directly choose multiple columns but from cloudformation I have to specify, therefore looking if any option which will automatically fetch all columns from source.

AWSTemplateFormatVersion: "2010-09-09"
Metadata:
    Generator: "Automation"
Description: ""
Parameters:
  snowusername:
    Type: String
    MaxLength: 128
  snowpassword:
    Type: String
    MaxLength: 128
  ServicenowUrl:
    Type: String
    MaxLength: 180
Resources:
    AppFlowFlowTest:
        Type: "AWS::AppFlow::Flow"
        Properties:
            FlowName: "IMGroupTest"
            Description: "Servicenow"
            SourceFlowConfig:
                ConnectorType: "Servicenow"
                ConnectorProfileName: !Ref AppFlowConnectorProfile
                SourceConnectorProperties:
                    ServiceNow:
                        Object: "business_service_group"
            DestinationFlowConfigList:
              -
                ConnectorType: "S3"
                DestinationConnectorProperties:
                    S3:
                        BucketName: "raw-data
                        BucketPrefix: "servicenow/appflow"
                        S3OutputFormatConfig:
                            FileType: "PARQUET"
                            PrefixConfig:
                                PrefixType: "FILENAME"
                            AggregationConfig:
                                AggregationType: "None"
            TriggerConfig:
                TriggerType: "OnDemand"
            Tasks:
              -
                SourceFields:
                  - "id"
                  - "site_name"
                  .
                  .
                  .
                  .

4

2 回答 2

1

关于使用 Map_all 的 AWS 文档有点缺乏。Map_all 任务,至少在使用 YAML 时,在没有传递 TaskProperties 时会出错。为了解决这个问题,我添加了 EXCLUDE_SOURCE_FIELDS_LIST 的属性并传递一个空列表,因为我不希望排除任何字段。

以下是模板的相关部分:

Tasks:
  - TaskType: Map_all
    SourceFields: []
    TaskProperties: 
    - Key: EXCLUDE_SOURCE_FIELDS_LIST
      Value: '[]'
    ConnectorOperator:
      Salesforce: NO_OP

这是我的完整模板

    AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation Template for a MAP_ALL Salesforce AppFlow
Parameters:
  Connection:
    Type: String
  S3Bucket:
    Type: String
  BucketPrefix:
    Type: String
  ObjectName:
    Type: String
  FlowName:
    Type: String
Resources:

  GenericFlow:
    Type: 'AWS::AppFlow::Flow'
    Properties:
      Description: !Join [ "", [ 'App Flow for ', !Ref ObjectName, ' object' ] ]
      DestinationFlowConfigList:
        - ConnectorType: S3
          DestinationConnectorProperties:
            S3:
              BucketName: !Ref S3Bucket
              BucketPrefix: !Ref BucketPrefix
              S3OutputFormatConfig:
                AggregationConfig:
                  AggregationType: None
                FileType: PARQUET
      FlowName: !Ref FlowName
      SourceFlowConfig:
        ConnectorProfileName: !Ref Connection
        ConnectorType: Salesforce
        SourceConnectorProperties:
          Salesforce:
            EnableDynamicFieldUpdate: true
            IncludeDeletedRecords: false
            Object: !Ref ObjectName
      Tasks:
        - TaskType: Map_all
          SourceFields: []
          TaskProperties: 
          - Key: EXCLUDE_SOURCE_FIELDS_LIST
            Value: '[]'
          ConnectorOperator:
            Salesforce: NO_OP
      TriggerConfig:
        TriggerType: OnDemand
于 2021-11-08T17:32:56.747 回答
0

要映射所有字段,您必须将taskTypeMap_all和 SourceFields 一起使用,并且任务属性将为空。

    tasks=[
        {
            'sourceFields': [],
            'taskType':'Map_all',
            'taskProperties: '{}'
        },
    ]
于 2021-06-17T11:51:16.540 回答