(Deluge) Filtering fetched records
I am trying to create a script that checks the status of the zoho sign document where the field waiver_status equals sent, unopened or viewed.
We have thousands of records so I was trying to filter the fetched records but it is telling me I cannot and giving me a generic error.
The error is on line two. I am guessing
- // Fetch all records in the form Waiver where Waiver_Status equals sent, unopened, or viewed
- recordsToProcess = Waivers.filter("(Waiver_Status == 'sent' or Waiver_Status == 'unopened' or Waiver_Status == 'viewed')");
- // Loop through each record
- for each record in recordsToProcess
- {
- // Run the provided code for each record
- // Fetch document by Sign_ID
- res = zoho.sign.getDocumentById(record.Sign_ID.tolong());
- // Check if document retrieval is successful
- if(res.get('status') == "success")
- {
- // Get request status
- request_status = res.get('requests').get('request_status');
- // Process based on request status
- if(request_status == 'completed')
- {
- info "Document signed by all parties";
- record.Waiver_Status = "SIGNED";
- }
- else if(request_status == 'inprogress')
- {
- info 'Document in progress';
- // Get actions
- actions = res.get('requests').get('actions');
- // Loop through each action
- for each i in actions
- {
- // Check action status
- if(i.get('action_status') == "UNOPENED" || i.get('action_status') == "VIEWED")
- {
- record.Waiver_Status = i.get('action_status');
- }
- }
- }
- else if(request_status == 'recalled')
- {
- record.Waiver_Status = "RECALLED";
- }
- else if(request_status == 'expired')
- {
- record.Waiver_Status = "EXPIRED";
- }
- // Update the record in Zoho Creator
- Waivers.update(record);
- }
- }
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.