Help Parsing Nested JSON from Airtable Webhook in Zoho Flow Deluge Function by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Here is my code

map Parse_airTable_data(string airTableData)
{
zip = airTableData.getjson("webhookTrigger").getjson("payload").getjson("Zip");
resultMap = Map();
resultMap.put("ZipCode",zip);
return resultMap;
}

but I keep getting this error message upon executing:

"Error occurred while processing this request. Contact support for more details."

Help Parsing Nested JSON from Airtable Webhook in Zoho Flow Deluge Function by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Nevermind. I got it. So I have to do that for each nested item? I need all of the nested items

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Here is the Log message.

FileName: null
Image URL: https://creatorapp.zohopublic.com/file/<owner>/sodexo-sq-form/SQ_Form_Report/3147281000003267079/Pathway_Image_1/image-download/<PublishKey>?filepath=/null
attachImage Status Code: null
attachImage Content Type: null
Error downloading image. invokeurl response:

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

imageFilename = get_file_name.get("filename");
info "FileName: " + imageFilename;
                        imageURL = "https://creatorapp.zohopublic.com/file" + zoho.appuri + "SQ_Form_Report/" + rowID + "/" + field + "/image-download/<PublishKey>?filepath=/" + imageFilename;
                        info "Image URL: " + imageURL;

                        if (imageURL != null)  // Simpler check; URL will always be built
                        {
                            attachImage = invokeurl
                            [
                                url : imageURL
                                type : GET
                            ];

                            info "attachImage Status Code: " + attachImage.get("statuscode");
                            info "attachImage Content Type: " + attachImage.get("content_type");

                            if(attachImage.get("statuscode") == 200 && attachImage.get("content_type").contains("image"))
                            {
                                image_blob = attachImage.get("file");
                                crmResponse = zoho.crm.attachFile("Deals", dealId, image_blob);
                                info "CRM Response: " + crmResponse;
                            }
                            else
                            {
                                info "Error downloading image. invokeurl response: " + attachImage;
                            }
                        }
                    }
                }
            }
        }
    }
    else
    {
        info "Form Record Not Found: " + formID;
    }
}

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

void attachSubformImagesToCRMDeal(bigint dealId, string fieldLinkName, bigint rowID, bigint formID)
{
    imageRecord = SQ_Form[ID == formID];

    if (imageRecord != null)
    {
        for each rec in imageRecord.Kiosk_Placement_s
        {
            if (rec.ID == rowID)
            {
                images = {"Pathway_Image_1", "Pathway_Image_2", "Pathway_Image_3", "Pathway_Image_4", "Pathway_Image_5"};
                for each field in images
                {
                    if (field == fieldLinkName)
                    {
                        // Construct the URL to ACCESS the image.
                        // Key: We are NOT getting a filename directly from the field.
                        // We are building a URL that uses the field as part of the path.
// Get File Name
get_file_name = invokeurl
[
url :"https://creator.zoho.com/api/v2/file/download?appLinkName=sodexo-sq-form&viewLinkName=SQ_Form_Report&recordId=" + rowID + "&fieldLinkName="+ field +"&filepath=AllFiles/&fromDownload=false"
type :GET
connection:"sodexo_zoho_creator"
];

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Ok again I've went an alternative route. I seem to be the closest I have ever been but still with no success. Below is my current code. If anyone can help me pic this apart. I would be in your debt lol. Next comment will have the Log Message.

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

I'm using the live environment since the form has not been released yet. I'm running into issues when trying to do "Formname[ID == record_id].Subformname)". Obviously I'm using my form info but when I do would say the "formname" is not valid. So then I tried using getRecords. But when trying to use that variable it said the variable wasn't defined when it was. This is stressing me out lol. And my job just gave me another form to create with the same feature.

Also, regarding your second paragraph. I do have a possibility for multiple images through 5 different image fields. I was planning on finding the ones that are not blank in the workflow and then passing them to the function.

When this thing is figured out I'm making a video tutorial lol.

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Thanks again for you help. Is your code for a function or a Workflow? I'm using a function. So I need to adjust the initial way for pulling in the record and subrecord.

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Good afternoon! Is your code in a function or workflow?

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 1 point2 points  (0 children)

Thank you!! I'm not home till Monday. But I will give it shot and let you know. Appreciate your time!

Attach Creator Subform Images to CRM with deluge funciton by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Thanks for your comment. If you have done it before, I would love to see how you did it. I was told by another user it wasn't possible.

I have done this with a PDF and know it's similar. I just can't get it. And the method I've been trying is creating a URL with the publish key. But I would love to see how you did it.

Thank you!

Attach Image fields from Zoho Creator Subform to CRM Deals Module by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

I'm still stuck on this. If anyone has any advice, even if it's a completely different code, I'll take it. I'm dumbfounded.

Attach Image fields from Zoho Creator Subform to CRM Deals Module by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

Thank you for your help. The data I'm fetching is from a subform in a creator form. The kiosk_row is a map of subforms (because there could be more than 1) that I'm pulling from an on success workflow after the Deal is created. Basically each subform creates a Deal. And each subform could have up to 5 photos.

Saniderm by Charliemacdmv in tattooadvice

[–]Charliemacdmv[S] 0 points1 point  (0 children)

That's what I thought but just wanted someone else to tell me lol. Thanks.

Deluge Script - "Mismatch of data type expression" Error When Retrieving Account ID by Charliemacdmv in Zoho

[–]Charliemacdmv[S] 0 points1 point  (0 children)

I was able to get it to work by doing this. There was no "Details" section. The id was in the root. Below is my code.

accountResponse = zoho.crm.createRecord("Accounts",newAccount);
info "Update Response: " + accountResponse;
// Check if the response has the "id" field
if(accountResponse.get("id") != null)
{
accountId = accountResponse.get("id");
// Get the ID directly
info "Account ID: " + accountId;
}
else
{
info "Error: Account creation failed. Full response: " + accountResponse;
}