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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

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

bcollins-2
10-Marble

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

ACCEPTED SOLUTION

Accepted Solutions

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

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"));

Announcements


Top Tags