- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 01:28 AM
Hi all,
I would like to use Run Script activity in Workflow for updating RITM field based on some script logic.
I'm using current.update(), but when I validate or publish workflow, I got following warning:
ValidateScriptForCurrentDotUpdate
This workflow uses 'current.update()' in 1 JavaScript statements. When a record is inserted, current.update() can cause the workflow to execute an infinite loop. When a record is updated, current.update() causes all script engines to run twice. To avoid an infinite loop when a record is inserted, remove unnecessary current.update() calls from custom scripts.
The behavior of workflow is strange, because for each requested item I'm getting now two workflow instances (of the same workflow).
Is there any way/workaround how to update RITM in workflow scripts?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 02:36 AM
Hi Peter,
If you have created workflow on the RITM table then you can directly update the fields in a run script activity. Just add
current.ritm_field_name = current.variables.variable_name;
If the workflow is on a different table like request, then you need to first fetch RITM via Glide query.
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 02:12 AM
good to know, but do you know about any other way how can I update RITM in workflow? (without using Set Value activity, because it's not possible to write script logic in this activity)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 02:36 AM
Hi Peter,
If you have created workflow on the RITM table then you can directly update the fields in a run script activity. Just add
current.ritm_field_name = current.variables.variable_name;
If the workflow is on a different table like request, then you need to first fetch RITM via Glide query.
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 04:07 AM
Hi Alikutty,
you are right. I don't have to call current.update(), because if I use Run Script activity it updates RITM automatically. I found it also in documentation
Note: All changes to current
are automatically updated. There is no need to call current.update()
I did not know this before.
However what's still happening is that I have two instances of workflow.
Couldn't find a reason why....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 04:13 AM
Are they 2 instances of same workflow or different once? Did you check the workflow names
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2017 02:32 AM
Hi Alikutty,
they are instances of the same workflow. I created new question for this issue:
Usage of Timer activity creates two workflow contexts