cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How do I make a script run as a rule if it is currently configured to be scheduled?

bcollins-2
6-Contributor

How do I make a script run as a rule if it is currently configured to be scheduled?

I have a scheduled script, and I've modified it to have an additional functionality to run as a rule. However, when I did run my rule trigger I received an error that the script may be run only from a scheduled trigger. I looked in the script and I couldn't find any sort of tag or check which specifically labels it as a scheduled trigger. How do I prevent this error and allow my script to run as a rule?

This is a similar scenario to the other question here.

Error while execution of a Rule based trigger

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
bcollins-2
6-Contributor
(To:bcollins-2)

Actually I found the line that was causing this. That's embarrassing, but I'll leave this here in case anyone else gets stuck on it. The line below ensures that a script will only run in a scheduled context.

if (eb.getEventContext() != "Schedule")

    eb.badConfiguration(rb.handleGetObject("ONLY_SCHEDULED_TRIGGER"));

View solution in original post

1 REPLY 1
bcollins-2
6-Contributor
(To:bcollins-2)

Actually I found the line that was causing this. That's embarrassing, but I'll leave this here in case anyone else gets stuck on it. The line below ensures that a script will only run in a scheduled context.

if (eb.getEventContext() != "Schedule")

    eb.badConfiguration(rb.handleGetObject("ONLY_SCHEDULED_TRIGGER"));

Top Tags