Manually triggering a job

935 views
Skip to first unread message

Brian Gorsky

unread,
Sep 11, 2023, 4:30:54 PM9/11/23
to NV Autocrat Add-on
Other than going into the AutoCrat add-on in the Google Sheet and clicking the "Run Job" button, is there any other way to force a job to run? 

I have several folks that may need to trigger the job before the time trigger kicks in and am trying to figure out the easiest way to have them run the job.

Joseph Schmidt

unread,
Sep 11, 2023, 5:25:53 PM9/11/23
to nv-autocr...@googlegroups.com
This video talks about a script that will submit a form from a script.  You can set Autocrat to run on Form Submit.

You will end up with some fake responses that can be deleted once a month or so.
 


On Mon, Sep 11, 2023 at 4:31 PM Brian Gorsky <br...@coptechs.com> wrote:
Other than going into the AutoCrat add-on in the Google Sheet and clicking the "Run Job" button, is there any other way to force a job to run? 

I have several folks that may need to trigger the job before the time trigger kicks in and am trying to figure out the easiest way to have them run the job.

--
You received this message because you are subscribed to the Google Groups "NV Autocrat Add-on" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nv-autocrat-add...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nv-autocrat-add-on/04a7e169-6c74-414e-b9be-37cdadc888cfn%40googlegroups.com.

Brian Gorsky

unread,
Sep 17, 2023, 2:03:00 PM9/17/23
to NV Autocrat Add-on
Joe- The problem I have is that the Google Sheet running Autocrat is being fed by a form from Jotform (not a Google Form). Ideally, I am looking to run Autocrat when a new row is added to the Google Sheet (from the Jotform submission). Any thoughts on how I might accomplish that?  A few other thoughts/questions:
  1. If I set up a form to use the onFormSubmit trigger, Google Sheets will create a new tab. If a form is submitted in that other tab I don't think it will trigger Autocrat to run in a different tab will it?
  2. If all else fails, I would consider setting up a custom menu as you have shown in the video to trigger Autocrat to run. Is that possible?

Joseph Schmidt

unread,
Sep 17, 2023, 4:52:39 PM9/17/23
to nv-autocr...@googlegroups.com
Oh how helpful to know the whole story.

Set up a simple Google form to be used with the form submit script.

Autocrat can be set to use a different tab.

Autocrat should run on a submission of a Google form (from the script or otherwise).

Try adding additional triggers to the script.  You may be able to get the fake form to be submitted automatically.  

image.png

You could submit a fake form every 5 minutes.  That would run Autocrat every 5 minutes.

Do a little experimenting and let us know the results.

Brian Gorsky

unread,
Sep 17, 2023, 8:23:41 PM9/17/23
to NV Autocrat Add-on
I tried a time-based trigger running every minute and it worked well. I also tried an onOpen trigger which will send the fake form every time the Sheet is opened and that worked too.

Now that I have that piece in place. Are you saying that I would need to point the Jotform form to deposit submissions into that tab in the Sheet (where the fake form submissions go)? If so, there is a problem in that the Jotform integration with Sheets is similar to Google Forms in that when I set up the integration, I cannot point Jotform to an existing tab in the Sheet; it insists on creating a new tab just like Google Forms creates the Form Responses 1 tab when you link a form.

Joseph Schmidt

unread,
Sep 17, 2023, 9:08:37 PM9/17/23
to nv-autocr...@googlegroups.com
You have to do some experimenting.  I don't believe the merge has to be on the Google Response sheet.  The trigger just says run.  The merge sets which tab to use.

I would turn off the every minute trigger and set a on change trigger to see if that works.  If it does, you reduce a lot of extra running of Autocrat.

Brian Gorsky

unread,
Sep 24, 2023, 11:32:04 AM9/24/23
to NV Autocrat Add-on
Thanks to Joe, I was able to put the following script together that adds a custom menu option to trigger autocrat by using a fake form submission.
My next step is to automatically trigger the script when a row is added by Jotform.

function triggerFormSubmission() {

   var formId = '[ENTER YOUR FORM ID HERE]'; // Replace with your actual form ID from the Edit Form screen.
  var form = FormApp.openById(formId);
 
  // Create a fake form response to trigger the form submission event
  var fakeResponse = form.createResponse();
  var items = form.getItems();
  items.forEach(function(item) {
    if (item.getType() === FormApp.ItemType.TEXT) {
      fakeResponse.withItemResponse(item.asTextItem().createResponse('Script run'));
    }
   
  });
 
  // Submit the fake form response to trigger the form submission trigger
  fakeResponse.submit();
}function myFunction() {
 
}
// add custom menu to update form
// the onOpen function opens automatically.  You do not need a separate trigger.

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Autocrat')
  //  .addItem('Clear Autocrat status, submit a fake form, and run Autocrat', 'clrCell')
  //  .addSeparator()
    .addItem('Process Applications', 'triggerFormSubmission')
    .addToUi();
}

Joseph Schmidt

unread,
Sep 24, 2023, 1:26:50 PM9/24/23
to nv-autocr...@googlegroups.com
Have you tried setting the script to run on change, and on edit?  You might get extra fake forms but it should work.  

I would think that the addition of a row is a change.

Let us know if it works.

Brian Gorsky

unread,
Dec 22, 2023, 2:08:35 PM12/22/23
to NV Autocrat Add-on
So the script had been running perfectly using an "On change" trigger until December 7th. 

As a quick recap:
  • A Jotform submission hits the Google Sheet
  • the Apps Script script gets triggered when the Jotform submission hits the Sheet
  • the script initiates a Google Form "fake response" that hits the Sheet almost immediately
  • that should cause Autocrat to run based on the "Run of form trigger" setting in Autocrat
The trigger is still triggering the script as it should and the fake Google form submission is in fact triggered by the script, however, it looks like the Autocrat extension setting to "Run on form trigger" is not working since December 7th and it has only been running on the hourly time trigger setting that is set up in Autocrat.

Has anyone else had any issues with the Autocrat "Run on form trigger" option no longer working?

Joseph Schmidt

unread,
Dec 22, 2023, 4:04:09 PM12/22/23
to nv-autocr...@googlegroups.com
Brian,

Look at my videos.  You might be able to set a process to audit the merge.  Maybe not if the merge is running on the time trigger.

You can try to reset the form trigger by turning off the triggers from the main menu in Autocrat.  

Then close autocrat.

Open Autocrat and reset the triggers.

I think there is a bug in Autocrat that if it fails, it loses the trigger setting.

On the hidden sheet, to the extreme right, it should tell you when Autocrat last ran on a trigger.
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages