- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 04:09 PM
Hi
In global app we used ScheduleOnce to run business rule code delayed within after context - we needed to know previous value of an attribute in rule condition.
In Fuji scoped app I get error: "org.mozilla.javascript.EcmaError: "ScheduleOnce" is not defined."
Are there any alternatives to it?
Regards,
Alexey
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 05:02 PM
Hi Alexey,
The ScheduleOnce Script Include is not accessible to scoped applications.
After business rules run after the database operation completes. Why was the decision made to run the script Asynchronously via an after rule? Does the action taken by the script take a long time to complete? If the action is fast, you may consider simplifying this to a normal After business rule.
If that is not an option, you could change the model to be event-driven. Throw an event into the queue whenever the rule would have been triggered. The last two parameters (they must be Strings) give you some places you can store temporary data (like the *previous* values for fields), and it has access to the "current" record which threw the event. A Script Action can react to that event, asynchronously, to perform the required action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 05:02 PM
Hi Alexey,
The ScheduleOnce Script Include is not accessible to scoped applications.
After business rules run after the database operation completes. Why was the decision made to run the script Asynchronously via an after rule? Does the action taken by the script take a long time to complete? If the action is fast, you may consider simplifying this to a normal After business rule.
If that is not an option, you could change the model to be event-driven. Throw an event into the queue whenever the rule would have been triggered. The last two parameters (they must be Strings) give you some places you can store temporary data (like the *previous* values for fields), and it has access to the "current" record which threw the event. A Script Action can react to that event, asynchronously, to perform the required action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 05:56 PM
Thank you, Cory.
I suspected it
Appreciate sharing information on event-driven alternative, will give it a consideration.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 09:00 PM
For future reference, you can call ScheduleOnce is a scoped app, you just have to prefix it with global.
var scheduleJob = new global.ScheduleOnce();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2024 03:27 PM - edited ‎10-29-2024 03:56 PM
Sorry but this does not work and gives an error
Illegal access to package_private script include ScheduleOnce: caller not in scope rhino.global
What is the point of scoped applications when one cannot even use the base global classes of SN? Especially when the processing of scripts within Scoped Apps are dependent on global scripts which have been set as private, like the transform map scripts. Thus, locking them out from basic script processing of passed data with a scoped app.
Clearly this is a flaw of SN's approach to scoped apps.