Specify Multiple Paths to Records in HTTP response

Comments

1 comment

  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Ezriah Shteir I would recommend you use a preSavePage script to handle this. So I would not set anything in the "Path to records in HTTP response" field and then I would "re-recordize" within the script. The output will then give you records for phone calls and records for email conversations that you can then branch off of downstream or use input filters for when you need one or the other. Alternatively, you could have use one-to-many path on your downstream lookup and import steps, but that would require you to do it for each step. Here is an example of the script and using Celigo AI:

    function preSavePage(options) {
      // Logic to modify the data
      let modifiedData = [];
      options.data.forEach(record => {
        // Extract email conversations
        if (record.email_conversations) {
          record.email_conversations.forEach(email => {
            modifiedData.push({
              type: 'email_conversation',
              ...email
            });
          });
        }
        // Extract phone calls
        if (record.phone_calls) {
          record.phone_calls.forEach(call => {
            modifiedData.push({
              type: 'phone_call',
              ...call
            });
          });
        }
      });

      // Return the modified data
      return {
        data: modifiedData,
        errors: options.errors,
        abort: false,
        newErrorsAndRetryData: []
      };
    }

    0

Please sign in to leave a comment.